Revision 794852f2 astakos/im/views.py
b/astakos/im/views.py | ||
---|---|---|
111 | 111 |
except Invitation.DoesNotExist: |
112 | 112 |
return code |
113 | 113 |
|
114 |
def _send_invitation(baseurl, inv): |
|
115 |
url = settings.SIGNUP_TARGET % (baseurl, inv.code, quote(baseurl)) |
|
116 |
subject = _('Invitation to Pithos') |
|
114 |
def _send_invitation(request, baseurl, inv): |
|
115 |
subject = _('Invitation to Astakos') |
|
117 | 116 |
site = get_current_site(request) |
117 |
url = settings.SIGNUP_TARGET % (baseurl, inv.code, site.domain) |
|
118 | 118 |
message = render_to_string('invitation.txt', { |
119 | 119 |
'invitation': inv, |
120 | 120 |
'url': url, |
121 | 121 |
'baseurl': baseurl, |
122 |
'service': site_name,
|
|
122 |
'service': site.name,
|
|
123 | 123 |
'support': settings.DEFAULT_CONTACT_EMAIL}) |
124 | 124 |
sender = settings.DEFAULT_FROM_EMAIL |
125 | 125 |
send_mail(subject, message, sender, [inv.username]) |
... | ... | |
178 | 178 |
defaults={'code': code, 'realname': realname}) |
179 | 179 |
|
180 | 180 |
try: |
181 |
_send_invitation(request.build_absolute_uri('/').rstrip('/'), invitation) |
|
181 |
baseurl = request.build_absolute_uri('/').rstrip('/') |
|
182 |
_send_invitation(request, baseurl, invitation) |
|
182 | 183 |
if created: |
183 | 184 |
inviter.invitations = max(0, inviter.invitations - 1) |
184 | 185 |
inviter.save() |
... | ... | |
301 | 302 |
if next: |
302 | 303 |
return redirect(next) |
303 | 304 |
messages.add_message(request, status, message) |
304 |
except (Invitation.DoesNotExist), e: |
|
305 |
except (Invitation.DoesNotExist, Exception), e:
|
|
305 | 306 |
messages.add_message(request, messages.ERROR, e) |
306 | 307 |
return render_response(template_name, |
307 | 308 |
form = form if 'form' in locals() else UserCreationForm(), |
Also available in: Unified diff