Commits

Michael Elsdörfer committed b41de95

Fixed two NameErrors which were introduced by the merge. Also, my editor removed a bunch of trailing whitespace."

Comments (0)

Files changed (2)

registration/models.py

         activation and they key thus becomes invalid.
 
         """
-        
+
         # Make sure the key we're trying conforms to the pattern of a
         # SHA1 hash; if it doesn't, no point trying to look it up in
         # the database.
         return False
 
     def create_inactive_user(self, username, email, password, site,
-                    active_by_default=False, send_email=True, **kwargs):
+                             active_by_default=False, send_email=True,
+                             **kwargs):
         """
         Create a new, by default inactive, ``User``, generate a
         ``RegistrationProfile`` and email its activation key to the
         ``User``, returning the new ``User``.
 
-
         Using the ``active_by_default`` parameter, you may chose to
         enable the account immediately. You can still request for an
         activation email to be sent out. The activation process
         in this case will then only cause the user's
         ``email_confirmed`` flag to be set.
 
-        By default, an activation email will be sent to the new 
+        By default, an activation email will be sent to the new
         user. To disable this, pass ``send_email=False``.
 
         """
         if send_email:
             registration_profile.send_activation_email(site, **kwargs)
         return new_user
-    create_user = transaction.commit_on_success(create_user)
+    create_inactive_user = transaction.commit_on_success(create_inactive_user)
 
     def reset_password(self, user, email_template=None,
                        email_subject_template=None,
     activation_key_expired.boolean = True
 
     def send_activation_email(self, site, email_subject_template='registration/activation_email_subject.txt',
-                              email_template='registration/activation_email.txt', 
+                              email_template='registration/activation_email.txt',
                               email_extra_context={},):
         """
         Send an activation email to the user associated with this
         ``RegistrationProfile``.
-        
+
         The activation email will make use of two templates:
 
         ``registration/activation_email_subject.txt``
         subject = render_to_string(email_subject_template, ctx_dict)
         # Email subject *must not* contain newlines
         subject = ''.join(subject.splitlines())
-        
+
         message = render_to_string(email_template, ctx_dict)
-        
+
         self.user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL)
-		
-		
+
+
 #
 # Add new field ``email_confirmed`` to the ``User`` model. The idea is
 # that while a site might want to enable user accounts instantly

registration/views.py

 
 
 from django.shortcuts import redirect
+from django.conf import settings
 from registration.template import render_to_response
 from django.template import RequestContext
 
 
 def activate(request, backend,
              template_name='registration/activate.html',
-             success_url=None, extra_context=None, 
+             success_url=None, extra_context=None,
              on_success=None, **kwargs):
     """
     Activate a user's account.
         acivation. This is optional; if not specified, this will be
         obtained by calling the backend's
         ``post_activation_redirect()`` method.
-    
+
     ``template_name``
         A custom template to use. This is optional; if not specified,
         this will default to ``registration/activate.html``.
         Any keyword arguments captured from the URL, such as an
         activation key, which will be passed to the backend's
         ``activate()`` method.
-    
+
     **Context:**
-    
+
     The context will be populated from the keyword arguments captured
     in the URL, and any extra variables supplied in the
     ``extra_context`` argument (see above).
-    
+
     **Template:**
-    
+
     registration/activate.html or ``template_name`` keyword argument.
-    
+
     """
     backend = get_backend(backend)
     account = backend.activate(request, **kwargs)
        the ``HttpRequest`` and the new ``User``, to determine the URL
        to redirect the user to. To override this, see the list of
        optional arguments for this view (below).
-    
+
     **Required arguments**
-    
+
     None.
-    
+
     **Optional arguments**
 
     ``backend``
         passed to ``django.shortcuts.redirect``. If not supplied, this
         will be whatever URL corresponds to the named URL pattern
         ``registration_disallowed``.
-    
+
     ``form_class``
         The form class to use for registration. If not supplied, this
         will be retrieved from the registration backend.
-    
+
     ``extra_context``
         A dictionary of variables to add to the template context. Any
         callable object in this dictionary will be called to produce
 
     ``on_success``
         Callable to run after successful activation.
-    
+
     ``template_name``
         A custom template to use. If not supplied, this will default
         to ``registration/registration_form.html``.
-    
+
     **Context:**
-    
+
     ``form``
         The registration form.
-    
+
     Any extra variables supplied in the ``extra_context`` argument
     (see above).
-    
+
     **Template:**
-    
+
     registration/registration_form.html or ``template_name`` keyword
     argument.
-    
+
     """
     backend = get_backend(backend)
     if not backend.registration_allowed(request):
                               context_instance=context)
 
 
+from registration.forms import RestorePasswordByEmailForm
 
 def restore_password(request, form_class=RestorePasswordByEmailForm,
                      success_url='/accounts/restore_pw/sent/',
     All other keyword arguments will be passed on to the "restore
     password" form's ``save()`` method. This allow you to change
     email templates and other behaviour.
+
+    TODO: This could be adapted to use the new backend mechanism.
     """
 
     # If the user is already logged in, he has no business here
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.