diff options
| author | Robin Munn <robin.munn@gmail.com> | 2006-10-24 07:49:37 +0000 |
|---|---|---|
| committer | Robin Munn <robin.munn@gmail.com> | 2006-10-24 07:49:37 +0000 |
| commit | 0b059aa4eadc1d95ceca3a32821b65a9fb2a53e8 (patch) | |
| tree | 76f84c62e3ac5cd5172d43dd73a651bb8574e2d1 /django/contrib | |
| parent | 1bb4fa2cb66269b1eff3b7d73f8c7864c0622368 (diff) | |
sqlalchemy: Merged revisions 3832 to 3917 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/sqlalchemy@3918 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/contrib')
| -rw-r--r-- | django/contrib/admin/templates/admin_doc/view_detail.html | 2 | ||||
| -rw-r--r-- | django/contrib/admin/views/decorators.py | 2 | ||||
| -rw-r--r-- | django/contrib/auth/create_superuser.py | 1 | ||||
| -rw-r--r-- | django/contrib/auth/decorators.py | 4 | ||||
| -rw-r--r-- | django/contrib/auth/forms.py | 6 | ||||
| -rw-r--r-- | django/contrib/auth/models.py | 2 | ||||
| -rw-r--r-- | django/contrib/sitemaps/templates/sitemap.xml | 2 | ||||
| -rw-r--r-- | django/contrib/sitemaps/templates/sitemap_index.xml | 6 |
8 files changed, 13 insertions, 12 deletions
diff --git a/django/contrib/admin/templates/admin_doc/view_detail.html b/django/contrib/admin/templates/admin_doc/view_detail.html index ed90657361..ba90399358 100644 --- a/django/contrib/admin/templates/admin_doc/view_detail.html +++ b/django/contrib/admin/templates/admin_doc/view_detail.html @@ -8,7 +8,7 @@ <h1>{{ name }}</h1> -<h2 class="subhead">{{ summary|escape }}</h2> +<h2 class="subhead">{{ summary }}</h2> <p>{{ body }}</p> diff --git a/django/contrib/admin/views/decorators.py b/django/contrib/admin/views/decorators.py index fce50909f0..9dfe651fe6 100644 --- a/django/contrib/admin/views/decorators.py +++ b/django/contrib/admin/views/decorators.py @@ -87,7 +87,7 @@ def staff_member_required(view_func): # The user data is correct; log in the user in and continue. else: - if user.is_staff: + if user.is_active and user.is_staff: login(request, user) # TODO: set last_login with an event. user.last_login = datetime.datetime.now() diff --git a/django/contrib/auth/create_superuser.py b/django/contrib/auth/create_superuser.py index f42d30539e..2e93c35b93 100644 --- a/django/contrib/auth/create_superuser.py +++ b/django/contrib/auth/create_superuser.py @@ -46,6 +46,7 @@ def createsuperuser(username=None, email=None, password=None): if not username.isalnum(): sys.stderr.write("Error: That username is invalid. Use only letters, digits and underscores.\n") username = None + continue try: User.objects.get(username=username) except User.DoesNotExist: diff --git a/django/contrib/auth/decorators.py b/django/contrib/auth/decorators.py index 8164d8314e..37e948f8fe 100644 --- a/django/contrib/auth/decorators.py +++ b/django/contrib/auth/decorators.py @@ -29,8 +29,8 @@ login_required.__doc__ = ( def permission_required(perm, login_url=LOGIN_URL): """ - Decorator for views that checks if a user has a particular permission - enabled, redirectiing to the log-in page if necessary. + Decorator for views that checks whether a user has a particular permission + enabled, redirecting to the log-in page if necessary. """ return user_passes_test(lambda u: u.has_perm(perm), login_url=login_url) diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py index 206cd06e06..24c69cb73e 100644 --- a/django/contrib/auth/forms.py +++ b/django/contrib/auth/forms.py @@ -13,7 +13,7 @@ class UserCreationForm(forms.Manipulator): validator_list=[validators.isAlphaNumeric, self.isValidUsername]), forms.PasswordField(field_name='password1', length=30, maxlength=60, is_required=True), forms.PasswordField(field_name='password2', length=30, maxlength=60, is_required=True, - validator_list=[validators.AlwaysMatchesOtherField('password1', "The two password fields didn't match.")]), + validator_list=[validators.AlwaysMatchesOtherField('password1', _("The two password fields didn't match."))]), ) def isValidUsername(self, field_data, all_data): @@ -21,7 +21,7 @@ class UserCreationForm(forms.Manipulator): User.objects.get(username=field_data) except User.DoesNotExist: return - raise validators.ValidationError, 'A user with that username already exists.' + raise validators.ValidationError, _('A user with that username already exists.') def save(self, new_data): "Creates the user." @@ -81,7 +81,7 @@ class PasswordResetForm(forms.Manipulator): try: self.user_cache = User.objects.get(email__iexact=new_data) except User.DoesNotExist: - raise validators.ValidationError, _("That e-mail address doesn't have an associated user acount. Are you sure you've registered?") + raise validators.ValidationError, _("That e-mail address doesn't have an associated user account. Are you sure you've registered?") def save(self, domain_override=None, email_template_name='registration/password_reset_email.html'): "Calculates a new password randomly and sends it to the user" diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py index eb5713ba57..73bcfe92aa 100644 --- a/django/contrib/auth/models.py +++ b/django/contrib/auth/models.py @@ -216,6 +216,8 @@ class User(models.Model): def has_module_perms(self, app_label): "Returns True if the user has any permissions in the given app label." + if not self.is_active: + return False if self.is_superuser: return True return bool(len([p for p in self.get_all_permissions() if p[:p.index('.')] == app_label])) diff --git a/django/contrib/sitemaps/templates/sitemap.xml b/django/contrib/sitemaps/templates/sitemap.xml index 3ee4f914f7..ad24c045d4 100644 --- a/django/contrib/sitemaps/templates/sitemap.xml +++ b/django/contrib/sitemaps/templates/sitemap.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.google.com/schemas/sitemap/0.84"> +{% spaceless %} {% for url in urlset %} <url> <loc>{{ url.location|escape }}</loc> @@ -8,4 +9,5 @@ {% if url.priority %}<priority>{{ url.priority }}</priority>{% endif %} </url> {% endfor %} +{% endspaceless %} </urlset> diff --git a/django/contrib/sitemaps/templates/sitemap_index.xml b/django/contrib/sitemaps/templates/sitemap_index.xml index e9d722ac7f..c89b192ecc 100644 --- a/django/contrib/sitemaps/templates/sitemap_index.xml +++ b/django/contrib/sitemaps/templates/sitemap_index.xml @@ -1,8 +1,4 @@ <?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84"> -{% for location in sitemaps %} - <sitemap> - <loc>{{ location|escape }}</loc> - </sitemap> -{% endfor %} +{% for location in sitemaps %}<sitemap><loc>{{ location|escape }}</loc></sitemap>{% endfor %} </sitemapindex> |
