mirror of https://github.com/django/django.git
Made django.utils.timezone.localtime a private API -- it's too specific to the template engine.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17642 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
c988397279
commit
7ce1ad7c03
|
@ -17,7 +17,7 @@ from django.conf import settings
|
|||
__all__ = [
|
||||
'utc', 'get_default_timezone', 'get_current_timezone',
|
||||
'activate', 'deactivate', 'override',
|
||||
'localtime', 'is_naive', 'is_aware', 'make_aware', 'make_naive',
|
||||
'is_naive', 'is_aware', 'make_aware', 'make_naive',
|
||||
]
|
||||
|
||||
|
||||
|
@ -204,7 +204,7 @@ class override(object):
|
|||
del _active.value
|
||||
|
||||
|
||||
# Utilities
|
||||
# Templates
|
||||
|
||||
def localtime(value, use_tz=None):
|
||||
"""
|
||||
|
@ -212,6 +212,8 @@ def localtime(value, use_tz=None):
|
|||
|
||||
If use_tz is provided and is not None, that will force the value to
|
||||
be converted (or not), overriding the value of settings.USE_TZ.
|
||||
|
||||
This function is designed for use by the template engine.
|
||||
"""
|
||||
if (isinstance(value, datetime)
|
||||
and (settings.USE_TZ if use_tz is None else use_tz)
|
||||
|
@ -224,6 +226,9 @@ def localtime(value, use_tz=None):
|
|||
value = timezone.normalize(value)
|
||||
return value
|
||||
|
||||
|
||||
# Utilities
|
||||
|
||||
def now():
|
||||
"""
|
||||
Returns an aware or naive datetime.datetime, depending on settings.USE_TZ.
|
||||
|
|
|
@ -666,11 +666,6 @@ For a complete discussion on the usage of the following see the
|
|||
``None``, the :ref:`current time zone <default-current-time-zone>` is unset
|
||||
on entry with :func:`deactivate()` instead.
|
||||
|
||||
.. function:: localtime(value, use_tz=None)
|
||||
|
||||
This function is used by the template engine to convert datetimes to local
|
||||
time where appropriate.
|
||||
|
||||
.. function:: now()
|
||||
|
||||
Returns an aware or naive :class:`~datetime.datetime` that represents the
|
||||
|
|
Loading…
Reference in New Issue