/usr/lib/python2.7/dist-packages/model_mommy/timezone.py is in python-model-mommy 1.5.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # coding: utf-8
'''
Add support for Django 1.4+ safe datetimes.
https://docs.djangoproject.com/en/1.4/topics/i18n/timezones/
'''
from datetime import datetime
from django.conf import settings
try:
from django.utils.timezone import now, utc
except ImportError:
now = lambda: datetime.now()
def smart_datetime(*args):
value = datetime(*args)
return tz_aware(value)
def tz_aware(d):
value = d
if settings.USE_TZ:
value = d.replace(tzinfo=utc)
return value
|