~ubuntu-branches/debian/sid/python-django/sid

« back to all changes in this revision

Viewing changes to django/forms/util.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone
  • Date: 2013-11-07 15:33:49 UTC
  • mfrom: (1.3.12)
  • Revision ID: package-import@ubuntu.com-20131107153349-e31sc149l2szs3jb
Tags: 1.6-1
* New upstream version. Closes: #557474, #724637.
* python-django now also suggests the installation of ipython,
  bpython, python-django-doc, and libgdal1.
  Closes: #636511, #686333, #704203
* Set package maintainer to Debian Python Modules Team.
* Bump standards version to 3.9.5, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
from django.conf import settings
4
4
from django.utils.html import format_html, format_html_join
5
5
from django.utils.encoding import force_text, python_2_unicode_compatible
6
 
from django.utils.safestring import mark_safe
7
6
from django.utils import timezone
8
7
from django.utils.translation import ugettext_lazy as _
 
8
from django.utils import six
 
9
import sys
9
10
 
10
11
# Import ValidationError so that it can be imported from this
11
12
# module to maintain backwards compatibility.
78
79
        try:
79
80
            return timezone.make_aware(value, current_timezone)
80
81
        except Exception:
81
 
            raise ValidationError(_('%(datetime)s couldn\'t be interpreted '
82
 
                                    'in time zone %(current_timezone)s; it '
83
 
                                    'may be ambiguous or it may not exist.')
84
 
                                  % {'datetime': value,
85
 
                                     'current_timezone': current_timezone})
 
82
            message = _(
 
83
                '%(datetime)s couldn\'t be interpreted '
 
84
                'in time zone %(current_timezone)s; it '
 
85
                'may be ambiguous or it may not exist.'
 
86
            )
 
87
            params = {'datetime': value, 'current_timezone': current_timezone}
 
88
            six.reraise(ValidationError, ValidationError(
 
89
                message,
 
90
                code='ambiguous_timezone',
 
91
                params=params,
 
92
            ), sys.exc_info()[2])
86
93
    return value
87
94
 
88
95
def to_current_timezone(value):