mirror of
https://github.com/django/django.git
synced 2025-12-18 23:03:16 +00:00
More attacking E302 violators
This commit is contained in:
parent
65c4ac3b24
commit
7548aa8ffd
150 changed files with 433 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ import sys
|
|||
# module to maintain backwards compatibility.
|
||||
from django.core.exceptions import ValidationError
|
||||
|
||||
|
||||
def flatatt(attrs):
|
||||
"""
|
||||
Convert a dictionary of attributes to a single string.
|
||||
|
|
@ -37,6 +38,7 @@ def flatatt(attrs):
|
|||
)
|
||||
return format_html_join('', ' {0}="{1}"', sorted(attrs.items()))
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class ErrorDict(dict):
|
||||
"""
|
||||
|
|
@ -59,6 +61,7 @@ class ErrorDict(dict):
|
|||
def as_text(self):
|
||||
return '\n'.join('* %s\n%s' % (k, '\n'.join(' * %s' % force_text(i) for i in v)) for k, v in self.items())
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class ErrorList(list):
|
||||
"""
|
||||
|
|
@ -84,6 +87,7 @@ class ErrorList(list):
|
|||
def __repr__(self):
|
||||
return repr([force_text(e) for e in self])
|
||||
|
||||
|
||||
# Utilities for time zone support in DateTimeField et al.
|
||||
|
||||
def from_current_timezone(value):
|
||||
|
|
@ -109,6 +113,7 @@ def from_current_timezone(value):
|
|||
), sys.exc_info()[2])
|
||||
return value
|
||||
|
||||
|
||||
def to_current_timezone(value):
|
||||
"""
|
||||
When time zone support is enabled, convert aware datetimes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue