diff options
| author | Honza Král <honza.kral@gmail.com> | 2009-09-11 21:23:55 +0000 |
|---|---|---|
| committer | Honza Král <honza.kral@gmail.com> | 2009-09-11 21:23:55 +0000 |
| commit | 9222091de8fa2fcb4fedd74ac99b65c88d295135 (patch) | |
| tree | 32069d6f3f1fce7bc06d257113999f41a0ce31c1 /django | |
| parent | 78d75b86e3e45ec3ca9f2ace21255922046dd509 (diff) | |
[soc2009/model-validation] Merged to trunk at r11499
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@11513 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/admin/sites.py | 2 | ||||
| -rw-r--r-- | django/contrib/admin/templates/admin/edit_inline/tabular.html | 3 | ||||
| -rw-r--r-- | django/contrib/admin/templatetags/admin_list.py | 4 | ||||
| -rw-r--r-- | django/contrib/admin/widgets.py | 3 | ||||
| -rw-r--r-- | django/contrib/auth/tests/__init__.py | 4 | ||||
| -rw-r--r-- | django/core/management/base.py | 4 | ||||
| -rw-r--r-- | django/core/urlresolvers.py | 11 | ||||
| -rw-r--r-- | django/forms/widgets.py | 5 | ||||
| -rw-r--r-- | django/utils/datastructures.py | 2 |
9 files changed, 24 insertions, 14 deletions
diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py index abcff14cd1..5f397ecb01 100644 --- a/django/contrib/admin/sites.py +++ b/django/contrib/admin/sites.py @@ -300,7 +300,7 @@ class AdminSite(object): user = authenticate(username=username, password=password) if user is None: message = ERROR_MESSAGE - if u'@' in username: + if username is not None and u'@' in username: # Mistakenly entered e-mail address instead of username? Look it up. try: user = User.objects.get(email=username) diff --git a/django/contrib/admin/templates/admin/edit_inline/tabular.html b/django/contrib/admin/templates/admin/edit_inline/tabular.html index ecc14a46d3..211573ebfc 100644 --- a/django/contrib/admin/templates/admin/edit_inline/tabular.html +++ b/django/contrib/admin/templates/admin/edit_inline/tabular.html @@ -15,6 +15,7 @@ {% if inline_admin_formset.formset.can_delete %}<th>{% trans "Delete?" %}</th>{% endif %} </tr></thead> + <tbody> {% for inline_admin_form in inline_admin_formset %} {% if inline_admin_form.form.non_field_errors %} <tr><td colspan="{{ inline_admin_form.field_count }}">{{ inline_admin_form.form.non_field_errors }}</td></tr> @@ -57,7 +58,7 @@ </tr> {% endfor %} - + </tbody> </table> </fieldset> diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index d97c36a207..9a4ce3b266 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -22,7 +22,7 @@ def paginator_number(cl,i): elif i == cl.page_num: return mark_safe(u'<span class="this-page">%d</span> ' % (i+1)) else: - return mark_safe(u'<a href="%s"%s>%d</a> ' % (cl.get_query_string({PAGE_VAR: i}), (i == cl.paginator.num_pages-1 and ' class="end"' or ''), i+1)) + return mark_safe(u'<a href="%s"%s>%d</a> ' % (escape(cl.get_query_string({PAGE_VAR: i})), (i == cl.paginator.num_pages-1 and ' class="end"' or ''), i+1)) paginator_number = register.simple_tag(paginator_number) def pagination(cl): @@ -265,7 +265,7 @@ def date_hierarchy(cl): day_lookup = cl.params.get(day_field) year_month_format, month_day_format = get_partial_date_formats() - link = lambda d: mark_safe(cl.get_query_string(d, [field_generic])) + link = lambda d: cl.get_query_string(d, [field_generic]) if year_lookup and month_lookup and day_lookup: day = datetime.date(int(year_lookup), int(month_lookup), int(day_lookup)) diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py index eacea44a31..fb5acb5295 100644 --- a/django/contrib/admin/widgets.py +++ b/django/contrib/admin/widgets.py @@ -7,6 +7,7 @@ import copy from django import forms from django.forms.widgets import RadioFieldRenderer from django.forms.util import flatatt +from django.utils.html import escape from django.utils.text import truncate_words from django.utils.translation import ugettext as _ from django.utils.safestring import mark_safe @@ -148,7 +149,7 @@ class ForeignKeyRawIdWidget(forms.TextInput): def label_for_value(self, value): key = self.rel.get_related_field().name obj = self.rel.to._default_manager.get(**{key: value}) - return ' <strong>%s</strong>' % truncate_words(obj, 14) + return ' <strong>%s</strong>' % escape(truncate_words(obj, 14)) class ManyToManyRawIdWidget(ForeignKeyRawIdWidget): """ diff --git a/django/contrib/auth/tests/__init__.py b/django/contrib/auth/tests/__init__.py index 9a381ef93d..14428d0fc8 100644 --- a/django/contrib/auth/tests/__init__.py +++ b/django/contrib/auth/tests/__init__.py @@ -10,10 +10,6 @@ from django.contrib.auth.tests.tokens import TOKEN_GENERATOR_TESTS __test__ = { 'BASIC_TESTS': BASIC_TESTS, - 'PASSWORDRESET_TESTS': PasswordResetTest, 'FORM_TESTS': FORM_TESTS, 'TOKEN_GENERATOR_TESTS': TOKEN_GENERATOR_TESTS, - 'CHANGEPASSWORD_TESTS': ChangePasswordTest, - 'LOGIN_TESTS': LoginTest, - 'LOGOUT_TESTS': LogoutTest, } diff --git a/django/core/management/base.py b/django/core/management/base.py index b5efdbc108..76b9c0967c 100644 --- a/django/core/management/base.py +++ b/django/core/management/base.py @@ -398,7 +398,9 @@ def copy_helper(style, app_or_project, name, directory, other_name=''): if subdir.startswith('.'): del subdirs[i] for f in files: - if f.endswith('.pyc'): + if not f.endswith('.py'): + # Ignore .pyc, .pyo, .py.class etc, as they cause various + # breakages. continue path_old = os.path.join(d, f) path_new = os.path.join(top_dir, relative_dir, f.replace('%s_name' % app_or_project, name)) diff --git a/django/core/urlresolvers.py b/django/core/urlresolvers.py index 4f9eb982e2..eedb8f126c 100644 --- a/django/core/urlresolvers.py +++ b/django/core/urlresolvers.py @@ -287,8 +287,17 @@ class RegexURLResolver(object): candidate = result % unicode_kwargs if re.search(u'^%s' % pattern, candidate, re.UNICODE): return candidate + # lookup_view can be URL label, or dotted path, or callable, Any of + # these can be passed in at the top, but callables are not friendly in + # error messages. + m = getattr(lookup_view, '__module__', None) + n = getattr(lookup_view, '__name__', None) + if m is not None and n is not None: + lookup_view_s = "%s.%s" % (m, n) + else: + lookup_view_s = lookup_view raise NoReverseMatch("Reverse for '%s' with arguments '%s' and keyword " - "arguments '%s' not found." % (lookup_view, args, kwargs)) + "arguments '%s' not found." % (lookup_view_s, args, kwargs)) def resolve(path, urlconf=None): return get_resolver(urlconf).resolve(path) diff --git a/django/forms/widgets.py b/django/forms/widgets.py index cecafa880b..b1d2cb7cda 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -275,9 +275,10 @@ class FileInput(Input): class Textarea(Widget): def __init__(self, attrs=None): # The 'rows' and 'cols' attributes are required for HTML correctness. - self.attrs = {'cols': '40', 'rows': '10'} + default_attrs = {'cols': '40', 'rows': '10'} if attrs: - self.attrs.update(attrs) + default_attrs.update(attrs) + super(Textarea, self).__init__(default_attrs) def render(self, name, value, attrs=None): if value is None: value = '' diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py index ce2424065d..85cdd443f8 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -117,7 +117,7 @@ class SortedDict(dict): return iter(self.keyOrder) def values(self): - return [super(SortedDict, self).__getitem__(k) for k in self.keyOrder] + return map(super(SortedDict, self).__getitem__, self.keyOrder) def itervalues(self): for key in self.keyOrder: |
