1. Luke Plant
  2. django

Commits

adr...@bcc190cf-cafb-0310-a4f2-bffc1f526a37  committed ab8faa0

new-admin: Merged to trunk 1424

  • Participants
  • Parent commits 55b7ffc
  • Branches new-admin

Comments (0)

Files changed (5)

File django/contrib/admin/templatetags/adminmedia.py

View file
  • Ignore whitespace
-from django.core import template
+from django.core.template.decorators import simple_tag
 
-class AdminMediaPrefixNode(template.Node):
-    def render(self, context):
-        try:
-            from django.conf.settings import ADMIN_MEDIA_PREFIX
-        except ImportError:
-            return ''
-        return ADMIN_MEDIA_PREFIX
-
-def admin_media_prefix(parser, token):
-    """
-    {% admin_media_prefix %}
-    """
-    return AdminMediaPrefixNode()
-
-template.register_tag('admin_media_prefix', admin_media_prefix)
+def admin_media_prefix():
+    try:
+        from django.conf.settings import ADMIN_MEDIA_PREFIX
+    except ImportError:
+        return ''
+    return ADMIN_MEDIA_PREFIX
+admin_media_prefix = simple_tag(admin_media_prefix)

File django/core/formfields.py

View file
  • Ignore whitespace
 
     def isValidLength(self, data, form):
         if data and self.maxlength and len(data.decode(DEFAULT_CHARSET)) > self.maxlength:
-            raise validators.ValidationError, ngettext("Ensure your text is less than %s character",
+            raise validators.ValidationError, ngettext("Ensure your text is less than %s character.",
                 "Ensure your text is less than %s characters.", self.maxlength) % self.maxlength
 
     def hasNoNewlines(self, data, form):

File django/core/meta/fields.py

View file
  • Ignore whitespace
         if len(objects) != len(pks):
             badkeys = [k for k in pks if k not in objects]
             raise validators.ValidationError, ngettext("Please enter valid %(self)s IDs. The value %(value)r is invalid.",
-                    "Please enter valid %(self)s IDs. The values %(value)r are invalid", len(badkeys)) % {
+                    "Please enter valid %(self)s IDs. The values %(value)r are invalid.", len(badkeys)) % {
                 'self': self.verbose_name,
                 'value': len(badkeys) == 1 and badkeys[0] or tuple(badkeys),
             }

File django/templatetags/i18n.py

View file
  • Ignore whitespace
-"Default tags used by the template system, available to all templates."
-
 from django.core.template import Node, NodeList, Template, Context, resolve_variable, resolve_variable_with_filters, registered_filters
 from django.core.template import TemplateSyntaxError, register_tag, TokenParser
 from django.core.template import TOKEN_BLOCK, TOKEN_TEXT, TOKEN_VAR
 from django.utils import translation
-
-import sys
-import re
+import re, sys
 
 class GetAvailableLanguagesNode(Node):
-
     def __init__(self, variable):
         self.variable = variable
 
         return ''
 
 class GetCurrentLanguageNode(Node):
-
     def __init__(self, variable):
         self.variable = variable
 
         return ''
 
 class TranslateNode(Node):
-
     def __init__(self, value, noop):
         self.value = value
         self.noop = noop
             return translation.gettext(value)
 
 class BlockTranslateNode(Node):
-
     def __init__(self, extra_context, singular, plural=None, countervar=None, counter=None):
         self.extra_context = extra_context
         self.singular = singular
     This will store a list of available languages
     in the context.
 
-    Usage is as follows::
+    Usage::
 
         {% get_available_languages as languages %}
         {% for language in languages %}
     your setting file (or the default settings) and
     put it into the named variable.
     """
-
     args = token.contents.split()
     if len(args) != 3 or args[1] != 'as':
         raise TemplateSyntaxError, "'get_available_languages' requires 'as variable' (got %r)" % args
 
 def do_get_current_language(parser, token):
     """
-    This will store the current language in
-    the context.
+    This will store the current language in the context.
 
-    Usage is as follows::
+    Usage::
 
         {% get_current_language as language %}
 
     put it's value into the ``language`` context
     variable.
     """
-
     args = token.contents.split()
     if len(args) != 3 or args[1] != 'as':
         raise TemplateSyntaxError, "'get_available_languages' requires 'as variable' (got %r)" % args
     This will mark a string for translation and will
     translate the string for the current language.
 
-    Usage is like this::
+    Usage::
 
         {% trans "this is a test" %}
 
     the variable ``variable``. Make sure that the string
     in there is something that is in the .po file.
     """
-
     class TranslateParser(TokenParser):
-
         def top(self):
             value = self.value()
             if self.more():
             else:
                 noop = False
             return (value, noop)
-
     (value, noop) = TranslateParser(token.contents).top()
     return TranslateNode(value, noop)
 
     """
     This will translate a block of text with parameters.
 
-    Format is like this::
+    Usage::
 
         {% blocktrans with foo|filter as bar and baz|filter as boo %}
         This is {{ bar }} and {{ boo }}.
         {% endblocktrans %}
 
-    Additionally this supports pluralization::
+    Additionally, this supports pluralization::
 
         {% blocktrans count var|length as count %}
         There is {{ count }} object.
 register_tag('get_current_language', do_get_current_language)
 register_tag('trans', do_translate)
 register_tag('blocktrans', do_block_translate)
-

File django/views/registration/passwords.py

View file
  • Ignore whitespace
 from django.core import formfields, validators
 from django.core.extensions import DjangoContext, render_to_response
-from django.core.template import loader
+from django.core.template import Context, loader
 from django.models.auth import users
 from django.views.decorators.auth import login_required
 from django.utils.httpwrappers import HttpResponseRedirect