diff options
Diffstat (limited to 'django/utils/dateparse.py')
| -rw-r--r-- | django/utils/dateparse.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/django/utils/dateparse.py b/django/utils/dateparse.py index f90d952581..d142e161b6 100644 --- a/django/utils/dateparse.py +++ b/django/utils/dateparse.py @@ -6,27 +6,27 @@ # - The date/datetime/time constructors produce friendlier error messages. import datetime -import re +from django.utils.regex_helper import _lazy_re_compile from django.utils.timezone import get_fixed_timezone, utc -date_re = re.compile( +date_re = _lazy_re_compile( r'(?P<year>\d{4})-(?P<month>\d{1,2})-(?P<day>\d{1,2})$' ) -time_re = re.compile( +time_re = _lazy_re_compile( r'(?P<hour>\d{1,2}):(?P<minute>\d{1,2})' r'(?::(?P<second>\d{1,2})(?:\.(?P<microsecond>\d{1,6})\d{0,6})?)?' ) -datetime_re = re.compile( +datetime_re = _lazy_re_compile( r'(?P<year>\d{4})-(?P<month>\d{1,2})-(?P<day>\d{1,2})' r'[T ](?P<hour>\d{1,2}):(?P<minute>\d{1,2})' r'(?::(?P<second>\d{1,2})(?:\.(?P<microsecond>\d{1,6})\d{0,6})?)?' r'(?P<tzinfo>Z|[+-]\d{2}(?::?\d{2})?)?$' ) -standard_duration_re = re.compile( +standard_duration_re = _lazy_re_compile( r'^' r'(?:(?P<days>-?\d+) (days?, )?)?' r'(?P<sign>-?)' @@ -39,7 +39,7 @@ standard_duration_re = re.compile( # Support the sections of ISO 8601 date representation that are accepted by # timedelta -iso8601_duration_re = re.compile( +iso8601_duration_re = _lazy_re_compile( r'^(?P<sign>[-+]?)' r'P' r'(?:(?P<days>\d+(.\d+)?)D)?' @@ -54,7 +54,7 @@ iso8601_duration_re = re.compile( # Support PostgreSQL's day-time interval format, e.g. "3 days 04:05:06". The # year-month and mixed intervals cannot be converted to a timedelta and thus # aren't accepted. -postgres_interval_re = re.compile( +postgres_interval_re = _lazy_re_compile( r'^' r'(?:(?P<days>-?\d+) (days? ?))?' r'(?:(?P<sign>[-+])?' |
