add logging for additional mail
authorSofia Papagiannaki <papagian@gmail.com>
Thu, 19 Jul 2012 10:22:20 +0000 (13:22 +0300)
committerSofia Papagiannaki <papagian@gmail.com>
Thu, 19 Jul 2012 10:22:20 +0000 (13:22 +0300)
snf-astakos-app/astakos/im/activation_backends.py
snf-astakos-app/astakos/im/views.py

index dc73ed1..71b0abe 100644 (file)
@@ -89,7 +89,7 @@ class ActivationBackend(object):
     
     def get_signup_form(self, provider='local', instance=None):
         """
     
     def get_signup_form(self, provider='local', instance=None):
         """
-        Returns the form class name
+        Returns a form instance of the relevant class
         """
         main = provider.capitalize() if provider == 'local' else 'ThirdParty'
         suffix  = 'UserCreationForm'
         """
         main = provider.capitalize() if provider == 'local' else 'ThirdParty'
         suffix  = 'UserCreationForm'
@@ -152,7 +152,7 @@ class InvitationsBackend(ActivationBackend):
 
     def get_signup_form(self, provider='local', instance=None):
         """
 
     def get_signup_form(self, provider='local', instance=None):
         """
-        Returns the form class
+        Returns a form instance of the relevant class
         
         raises Invitation.DoesNotExist and ValueError if invitation is consumed
         or invitation username is reserved.
         
         raises Invitation.DoesNotExist and ValueError if invitation is consumed
         or invitation username is reserved.
index b9b27aa..ac19286 100644 (file)
@@ -60,7 +60,7 @@ from astakos.im.util import get_context, prepare_response, set_cookie, get_query
 from astakos.im.forms import *
 from astakos.im.functions import send_greeting, send_feedback, SendMailError, \
     invite as invite_func, logout as auth_logout
 from astakos.im.forms import *
 from astakos.im.functions import send_greeting, send_feedback, SendMailError, \
     invite as invite_func, logout as auth_logout
-from astakos.im.settings import DEFAULT_CONTACT_EMAIL, DEFAULT_FROM_EMAIL, COOKIE_NAME, COOKIE_DOMAIN, IM_MODULES, SITENAME, LOGOUT_NEXT
+from astakos.im.settings import DEFAULT_CONTACT_EMAIL, DEFAULT_FROM_EMAIL, COOKIE_NAME, COOKIE_DOMAIN, IM_MODULES, SITENAME, LOGOUT_NEXT, LOGGING_LEVEL
 
 logger = logging.getLogger(__name__)
 
 
 logger = logging.getLogger(__name__)
 
@@ -279,7 +279,7 @@ def signup(request, template_name='im/signup.html', on_success='im/signup_comple
     """
     Allows a user to create a local account.
 
     """
     Allows a user to create a local account.
 
-    In case of GET request renders a form for providing the user information.
+    In case of GET request renders a form for entering the user information.
     In case of POST handles the signup.
 
     The user activation will be delegated to the backend specified by the ``backend`` keyword argument
     In case of POST handles the signup.
 
     The user activation will be delegated to the backend specified by the ``backend`` keyword argument
@@ -287,7 +287,7 @@ def signup(request, template_name='im/signup.html', on_success='im/signup_comple
     if settings.ASTAKOS_INVITATIONS_ENABLED is True or ``astakos.im.activation_backends.SimpleBackend`` if not
     (see activation_backends);
     
     if settings.ASTAKOS_INVITATIONS_ENABLED is True or ``astakos.im.activation_backends.SimpleBackend`` if not
     (see activation_backends);
     
-    Upon successful user creation if ``next`` url parameter is present the user is redirected there
+    Upon successful user creation, if ``next`` url parameter is present the user is redirected there
     otherwise renders the same page with a success message.
     
     On unsuccessful creation, renders ``template_name`` with an error message.
     otherwise renders the same page with a success message.
     
     On unsuccessful creation, renders ``template_name`` with an error message.
@@ -298,7 +298,6 @@ def signup(request, template_name='im/signup.html', on_success='im/signup_comple
         A custom template to render. This is optional;
         if not specified, this will default to ``im/signup.html``.
 
         A custom template to render. This is optional;
         if not specified, this will default to ``im/signup.html``.
 
-
     ``on_success``
         A custom template to render in case of success. This is optional;
         if not specified, this will default to ``im/signup_complete.html``.
     ``on_success``
         A custom template to render in case of success. This is optional;
         if not specified, this will default to ``im/signup_complete.html``.
@@ -334,6 +333,8 @@ def signup(request, template_name='im/signup.html', on_success='im/signup_comple
                     additional_email = form.cleaned_data['additional_email']
                     if additional_email != user.email:
                         user.additionalmail_set.create(email=additional_email)
                     additional_email = form.cleaned_data['additional_email']
                     if additional_email != user.email:
                         user.additionalmail_set.create(email=additional_email)
+                        msg = 'Additional email: %s saved for user %s.' % (additional_email, user.email)
+                        logger._log(LOGGING_LEVEL, msg, [])
                 if user and user.is_active:
                     next = request.POST.get('next', '')
                     return prepare_response(request, user, next=next)
                 if user and user.is_active:
                     next = request.POST.get('next', '')
                     return prepare_response(request, user, next=next)