1. JohnRandom
  2. django-registration

Commits

JohnRandom  committed 7214913 Draft Merge
  • Participants
  • Parent commits 47ac957, 27bccd1
  • Branches default

Comments (0)

Files changed (21)

File .hgtags

View file
  • Ignore whitespace
 dc2bf754aa9462c1d9a1dd70503e14ff4e0e0b9c v0.5
 e263c551ef7be3d99813effdc7a4f22041539f83 v0.6
 d073602dc103edfae55419b043af1f4b6a58e1e5 v0.7
+2d6fcc0c55d0c63d5e506b59e32cad9329963509 v0.8

File AUTHORS

View file
  • Ignore whitespace
 * Carles Barrobés (Catalan translation)
 * Nuno Mariz (Portuguese translation)
 * Patrick Samson (French translation)
-* Recep Kirmizi (Turkish translation)
+* Recep Kirmizi (Turkish translation)
+* Mohsen Mansouryar (Persian translation)

File CHANGELOG

View file
  • Ignore whitespace
 django-registration changelog
 =============================
 
+Version 0.8, 24 March 2012:
+---------------------------
+
+* Backend-based rewrite. See docs/upgrade.rst for details.
+
+* Compatibility through Django 1.4.
+
 
 Version 0.7, 6 November 2008:
 -----------------------------

File INSTALL

View file
  • Ignore whitespace
 somewhere on your Python path; this is useful if you're working from a
 Mercurial checkout.
 
-Note that this application requires Python 2.3 or later, and a
-functional installation of Django 1.` or newer. You can obtain Python
+Note that this application requires Python 2.4 or later, and a
+functional installation of Django 1.3 or newer. You can obtain Python
 from http://www.python.org/ and Django from
 http://www.djangoproject.com/.

File LICENSE

View file
  • Ignore whitespace
-Copyright (c) 2007-2011, James Bennett
+Copyright (c) 2007-2012, James Bennett
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without

File README

View file
  • Ignore whitespace
 Django user registration
 ========================
 
-This is a fairly simple user-registration application for Django_,
+This is a fairly simple user-registration application for Django,
 designed to make allowing user signups as painless as possible. It
-requires a functional installation of Django 1.1 or newer, but has no
+requires a functional installation of Django 1.3 or newer, but has no
 other dependencies.
 
 For installation instructions, see the file "INSTALL" in this

File docs/conf.py

View file
  • Ignore whitespace
 
 # General information about the project.
 project = u'django-registration'
-copyright = u'2009, James Bennett'
+copyright = u'2007-2012, James Bennett'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the

File docs/upgrade.rst

View file
  • Ignore whitespace
 Django version requirement
 --------------------------
 
-As of |version|, django-registration requires Django 1.1 or newer;
-older Django releases will not work, as django-registration |version|
-takes advantage of several Django features which are only present as
-of 1.1.
+As of |version|, django-registration requires Django 1.3 or newer;
+older Django releases may work, but are officially unsupported.
 
 
 Backwards-incompatible changes

File registration/__init__.py

View file
  • Ignore whitespace
-VERSION = (0, 8, 0, 'alpha', 1)
+VERSION = (0, 8, 0, 'final', 0)
 
-def get_version():
-    version = '%s.%s' % (VERSION[0], VERSION[1])
-    if VERSION[2]:
-        version = '%s.%s' % (version, VERSION[2])
-    if VERSION[3:] == ('alpha', 0):
-        version = '%s pre-alpha' % version
-    else:
-        if VERSION[3] != 'final':
-            version = "%s %s" % (version, VERSION[3])
-            if VERSION[4] != 0:
-                version = '%s %s' % (version, VERSION[4])
-    return version
+def get_version(version=None):
+    """Derives a PEP386-compliant version number from VERSION."""
+    if version is None:
+        version = VERSION
+    assert len(version) == 5
+    assert version[3] in ('alpha', 'beta', 'rc', 'final')
+
+    # Now build the two parts of the version number:
+    # main = X.Y[.Z]
+    # sub = .devN - for pre-alpha releases
+    #     | {a|b|c}N - for alpha, beta and rc releases
+
+    parts = 2 if version[2] == 0 else 3
+    main = '.'.join(str(x) for x in version[:parts])
+
+    sub = ''
+    if version[3] == 'alpha' and version[4] == 0:
+        # At the toplevel, this would cause an import loop.
+        from django.utils.version import get_svn_revision
+        svn_revision = get_svn_revision()[4:]
+        if svn_revision != 'unknown':
+            sub = '.dev%s' % svn_revision
+
+    elif version[3] != 'final':
+        mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
+        sub = mapping[version[3]] + str(version[4])
+
+    return main + sub

File registration/forms.py

View file
  • Ignore whitespace
                                 max_length=30,
                                 widget=forms.TextInput(attrs=attrs_dict),
                                 label=_("Username"),
-                                error_messages={'invalid': _("This value must contain only letters, numbers and underscores.")})
+                                error_messages={'invalid': _("This value may contain only letters, numbers and @/./+/-/_ characters.")})
     email = forms.EmailField(widget=forms.TextInput(attrs=dict(attrs_dict,
                                                                maxlength=75)),
                              label=_("E-mail"))
         in use.
         
         """
-        try:
-            user = User.objects.get(username__iexact=self.cleaned_data['username'])
-        except User.DoesNotExist:
+        existing = User.objects.filter(username__iexact=self.cleaned_data['username'])
+        if existing.exists():
+            raise forms.ValidationError(_("A user with that username already exists."))
+        else:
             return self.cleaned_data['username']
-        raise forms.ValidationError(_("A user with that username already exists."))
 
     def clean(self):
         """

File registration/locale/cs/LC_MESSAGES/django.mo

  • Ignore whitespace
Binary file added.

File registration/locale/cs/LC_MESSAGES/django.po

View file
  • Ignore whitespace
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <michal.pilar@implayo.cz>, 2011.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2009-10-12 14:09-0500\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: Implayo s.r.o. <michal.pilar@implayo.cz>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: cs\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: admin.py:23
+msgid "Activate users"
+msgstr "Aktivovat uživatele"
+
+#: admin.py:43
+msgid "Re-send activation emails"
+msgstr "Znovu odeslat aktivační e-maily"
+
+#: forms.py:35
+msgid "username"
+msgstr "uživatelské jméno"
+
+#: forms.py:36
+msgid "This value must contain only letters, numbers and underscores."
+msgstr "Tato hodnota může obsahovat pouze písmena, čísla a podtržítka."
+
+#: forms.py:39
+msgid "Email address"
+msgstr "E-mailová adresa"
+
+#: forms.py:41
+msgid "Password"
+msgstr "Heslo"
+
+#: forms.py:43
+msgid "Password (again)"
+msgstr "Heslo (znovu)"
+
+#: forms.py:55
+msgid "A user with that username already exists."
+msgstr "Uživatel s tímto jménem již existuje."
+
+#: forms.py:67
+msgid "The two password fields didn't match."
+msgstr "Zadaná 2 hesla se neshodují."
+
+#: forms.py:78
+msgid "I have read and agree to the Terms of Service"
+msgstr "Přečetl jsem si a souhlasím s podmínkami služby"
+
+#: forms.py:79
+msgid "You must agree to the terms to register"
+msgstr "Musíte odsouhlasit podmínky služby pro pokračování v registraci."
+
+#: forms.py:95
+msgid ""
+"This email address is already in use. Please supply a different email "
+"address."
+msgstr ""
+"Tato e-mailová adresa se již používá. Prosím zadejte jinou e-mailovou "
+"adresu."
+
+#: forms.py:122
+msgid ""
+"Registration using free email addresses is prohibited. Please supply a "
+"different email address."
+msgstr ""
+"Používání volných e-mailových adres je zakázáno. Prosím zadejte "
+"jinou e-mailovou adresu."
+
+#: models.py:165
+msgid "user"
+msgstr "uživatel"
+
+#: models.py:166
+msgid "activation key"
+msgstr "aktivační klíč"
+
+#: models.py:171
+msgid "registration profile"
+msgstr "registrační profil"
+
+#: models.py:172
+msgid "registration profiles"
+msgstr "registrační profily"

File registration/locale/fa/LC_MESSAGES/django.mo

  • Ignore whitespace
Binary file added.

File registration/locale/fa/LC_MESSAGES/django.po

View file
  • Ignore whitespace
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# Mohsen Mansouryar <mohsen.brian@gmail.com>, 2011.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: django-registration 0.8\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2007-09-19 19:30-0500\n"
+"PO-Revision-Date: 2011-11-18 01:11+0330\n"
+"Last-Translator: Mohsen Mansouryar <mohsen.brian@gmail.com>\n"
+"Language-Team: erixe <mohsen.brian@gmail.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-Language: Persian\n"
+"X-Poedit-Country: IRAN, ISLAMIC REPUBLIC OF\n"
+"X-Poedit-SourceCharset: utf-8\n"
+
+#: forms.py:38
+msgid "username"
+msgstr "نام کاربری"
+
+#: forms.py:41
+msgid "email address"
+msgstr "پست الکترونیکی"
+
+#: forms.py:43
+msgid "password"
+msgstr "گذرواژه"
+
+#: forms.py:45
+msgid "password (again)"
+msgstr "گذرواژه(تکرار)"
+
+#: forms.py:54
+msgid "Usernames can only contain letters, numbers and underscores"
+msgstr "نام های کاربری تنها می توانند شامل حرف، رقم و یا _ باشند."
+
+#: forms.py:59
+msgid "This username is already taken. Please choose another."
+msgstr "این نام کاربری گرفته شده است. لطفا نام دیگری انتخاب کنید."
+
+#: forms.py:68
+msgid "You must type the same password each time"
+msgstr "دو گذرواژه باید مطابق باشند!"
+
+#: forms.py:96
+msgid "I have read and agree to the Terms of Service"
+msgstr "من شرایط استفاده از این سرویس را مطالعه کرده و می پذیرم."
+
+#: forms.py:105
+msgid "You must agree to the terms to register"
+msgstr "شما باید شرایط عضویت را بپذیرید!"
+
+#: forms.py:124
+msgid "This email address is already in use. Please supply a different email address."
+msgstr "این آدرس استفاده شده است. لطفا آدرس دیگری ارائه دهید."
+
+#: forms.py:149
+msgid "Registration using free email addresses is prohibited. Please supply a different email address."
+msgstr "ثبت نام با استفاده از پست های الکترونیکی رایگان امکان پذیر نمی باشد."
+
+#: models.py:188
+msgid "user"
+msgstr "کاربر"
+
+#: models.py:189
+msgid "activation key"
+msgstr "کد فعالسازی"
+
+#: models.py:194
+msgid "registration profile"
+msgstr "مشخصات ثبت نام"
+
+#: models.py:195
+msgid "registration profiles"
+msgstr "پروفایل های ثبت نام"
+

File registration/locale/hr/LC_MESSAGES/django.mo

  • Ignore whitespace
Binary file added.

File registration/locale/hr/LC_MESSAGES/django.po

View file
  • Ignore whitespace
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: 0.8.1beta\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-12-01 14:09-0500\n"
+"PO-Revision-Date: 2010-12-01 15:49+0100\n"
+"Last-Translator: Enis Afgan <afgane@gmail.com>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-Language: Croatian\n"
+"X-Poedit-Country: CROATIA\n"
+
+#: admin.py:23
+msgid "Activate users"
+msgstr "Aktiviraj korisnike"
+
+#: admin.py:43
+msgid "Re-send activation emails"
+msgstr "Ponovno pošlji aktivacijski email"
+
+#: forms.py:35
+msgid "username"
+msgstr "Korisničko ime"
+
+#: forms.py:36
+msgid "This value must contain only letters, numbers and underscores."
+msgstr "Ova vrijednost mora sadržavati samo slova, brojeve i podvlake."
+
+#: forms.py:39
+msgid "Email address"
+msgstr "Email adresa"
+
+#: forms.py:41
+msgid "Password"
+msgstr "Lozinka"
+
+#: forms.py:43
+msgid "Password (again)"
+msgstr "Lozinka (ponovno)"
+
+#: forms.py:55
+msgid "A user with that username already exists."
+msgstr "Ovo korisničko ime već postoji."
+
+#: forms.py:67
+msgid "The two password fields didn't match."
+msgstr "Oba polja za lozinku nisu ista."
+
+#: forms.py:78
+msgid "I have read and agree to the Terms of Service"
+msgstr "Pročitao sam i slažem se s uvijetima uporabe."
+
+#: forms.py:79
+msgid "You must agree to the terms to register"
+msgstr "Morate se složiti sa uvijetima uporabe prije registracije."
+
+#: forms.py:95
+msgid "This email address is already in use. Please supply a different email address."
+msgstr "Ova email adresa je već korištena. Molimo da koristite drugu email adresu."
+
+#: forms.py:122
+msgid "Registration using free email addresses is prohibited. Please supply a different email address."
+msgstr "Registracija gdje se koristi besplati email servis nije dopuštena. Molimo da koristite drugu email adresu."
+
+#: models.py:165
+msgid "user"
+msgstr "Korisnik"
+
+#: models.py:166
+msgid "activation key"
+msgstr "Aktivacijski ključ"
+
+#: models.py:171
+msgid "registration profile"
+msgstr "Registracijski profil"
+
+#: models.py:172
+msgid "registration profiles"
+msgstr "Registracijski profili"

File registration/locale/sl/LC_MESSAGES/django.mo

  • Ignore whitespace
Binary file modified.

File registration/locale/sl/LC_MESSAGES/django.po

View file
  • Ignore whitespace
 "Project-Id-Version: 0.8.1beta\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2009-10-12 14:09-0500\n"
-"PO-Revision-Date: 2009-10-23 15:49+0100\n"
-"Last-Translator: Domen Kožar <domen@dev.si>\n"
+"PO-Revision-Date: 2011-11-05 21:20+0100\n"
+"Last-Translator: Marko Mrdjenovic <m@mmm.si>\n"
 "Language-Team: Slovenian <domen@dev.si>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 
 #: admin.py:43
 msgid "Re-send activation emails"
-msgstr "Ponovno pošlju aktivacijske emaile"
+msgstr "Ponovno pošlji aktivacijsko e-pošto"
 
 #: forms.py:35
 msgid "username"
 
 #: forms.py:39
 msgid "Email address"
-msgstr "Elektronska pošta"
+msgstr "E-naslov"
 
 #: forms.py:41
 msgid "Password"
 
 #: forms.py:55
 msgid "A user with that username already exists."
-msgstr "Uporabnik z tem uporabniškim imenom že obstaja."
+msgstr "Uporabnik s tem uporabniškim imenom že obstaja."
 
 #: forms.py:67
 msgid "The two password fields didn't match."
 
 #: forms.py:78
 msgid "I have read and agree to the Terms of Service"
-msgstr "Strinjam se z pogoji uporable"
+msgstr "Strinjam se s pogoji uporabe"
 
 #: forms.py:79
 msgid "You must agree to the terms to register"
-msgstr "Za registracijo se morate strinjati z pogoji uporabe"
+msgstr "Za registracijo se morate strinjati s pogoji uporabe"
 
 #: forms.py:95
 msgid "This email address is already in use. Please supply a different email address."
-msgstr "Email je že v uporabi, prosimo vnesite drugega."
+msgstr "E-naslov je že v uporabi, prosimo vnesite drugega."
 
 #: forms.py:122
 msgid "Registration using free email addresses is prohibited. Please supply a different email address."
-msgstr "Registracija ni mogoča z brezplačnimi email naslovi. Prosimo vnesite drug email naslov."
+msgstr "Registracija ni mogoča z brezplačnimi e-naslovi. Prosimo vnesite drug e-naslov."
 
 #: models.py:165
 msgid "user"

File registration/models.py

View file
  • Ignore whitespace
 import datetime
+import hashlib
 import random
 import re
 
 from django.db import models
 from django.db import transaction
 from django.template.loader import render_to_string
-from django.utils.hashcompat import sha_constructor
 from django.utils.translation import ugettext_lazy as _
 
+try:
+    from django.utils.timezone import now as datetime_now
+except ImportError:
+    datetime_now = datetime.datetime.now
+
 
 SHA1_RE = re.compile('^[a-f0-9]{40}$')
 
         username and a random salt.
         
         """
-        salt = sha_constructor(str(random.random())).hexdigest()[:5]
+        salt = hashlib.sha1(str(random.random())).hexdigest()[:5]
         username = user.username
         if isinstance(username, unicode):
             username = username.encode('utf-8')
-        activation_key = sha_constructor(salt+username).hexdigest()
+        activation_key = hashlib.sha1(salt+username).hexdigest()
         return self.create(user=user,
                            activation_key=activation_key)
         
         
         """
         for profile in self.all():
-            if profile.activation_key_expired():
-                user = profile.user
-                if not user.is_active:
-                    user.delete()
-
+            try:
+                if profile.activation_key_expired():
+                    user = profile.user
+                    if not user.is_active:
+                        user.delete()
+                        profile.delete()
+            except User.DoesNotExist:
+                profile.delete()
 
 class RegistrationProfile(models.Model):
     """
         """
         expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)
         return self.activation_key == self.ACTIVATED or \
-               (self.user.date_joined + expiration_date <= datetime.datetime.now())
+               (self.user.date_joined + expiration_date <= datetime_now())
     activation_key_expired.boolean = True
 
     def send_activation_email(self, site):

File registration/tests/forms.py

View file
  • Ignore whitespace
                       'email': 'foo@example.com',
                       'password1': 'foo',
                       'password2': 'foo'},
-            'error': ('username', [u"This value must contain only letters, numbers and underscores."])},
+            'error': ('username', [u"This value may contain only letters, numbers and @/./+/-/_ characters."])},
             # Already-existing username.
             {'data': {'username': 'alice',
                       'email': 'alice@example.com',

File setup.py

View file
  • Ignore whitespace
       author='James Bennett',
       author_email='james@b-list.org',
       url='http://www.bitbucket.org/ubernostrum/django-registration/wiki/',
-      download_url='http://www.bitbucket.org/ubernostrum/django-registration/get/v0.7.gz',
+      download_url='http://www.bitbucket.org/ubernostrum/django-registration/get/v0.8.gz',
       package_dir={'registration': 'registration'},
       packages=packages,
       package_data={'registration': data_files},