from django.template.loader import render_to_string
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
+from django.core.exceptions import ValidationError
+
from urllib import quote
from urlparse import urljoin
from smtplib import SMTPException
Raises SendInvitationError
"""
subject = _('Invitation to %s alpha2 testing' % SITENAME)
- url = '%s?code=%d' % (urljoin(BASEURL, reverse('astakos.im.views.signup')), invitation.code)
+ url = '%s?code=%d' % (urljoin(BASEURL, reverse('astakos.im.views.index')), invitation.code)
message = render_to_string('im/invitation.txt', {
'invitation': invitation,
'url': url,
"""
Activates the specific user and sends email.
- Raises SendGreetingError
+ Raises SendGreetingError, ValidationError
"""
user.is_active = True
user.save()
def set_user_credibility(email, has_credits):
try:
- user = AstakosUser.objects.get(email=email)
+ user = AstakosUser.objects.get(email=email, is_active=True)
user.has_credits = has_credits
user.save()
except AstakosUser.DoesNotExist, e:
logger.exception(e)
+ except ValidationError, e:
+ logger.exception(e)
class SendMailError(Exception):
pass