From b669d9c095360a2c20f282f7c04b1289d15921e1 Mon Sep 17 00:00:00 2001 From: Sofia Papagiannaki Date: Thu, 19 Jul 2012 13:22:20 +0300 Subject: [PATCH] add logging for additional mail --- snf-astakos-app/astakos/im/activation_backends.py | 4 ++-- snf-astakos-app/astakos/im/views.py | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/snf-astakos-app/astakos/im/activation_backends.py b/snf-astakos-app/astakos/im/activation_backends.py index dc73ed1..71b0abe 100644 --- a/snf-astakos-app/astakos/im/activation_backends.py +++ b/snf-astakos-app/astakos/im/activation_backends.py @@ -89,7 +89,7 @@ class ActivationBackend(object): 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' @@ -152,7 +152,7 @@ class InvitationsBackend(ActivationBackend): 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. diff --git a/snf-astakos-app/astakos/im/views.py b/snf-astakos-app/astakos/im/views.py index b9b27aa..ac19286 100644 --- a/snf-astakos-app/astakos/im/views.py +++ b/snf-astakos-app/astakos/im/views.py @@ -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.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__) @@ -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. - 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 @@ -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); - 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. @@ -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``. - ``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) + 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) -- 1.7.10.4