south.utils.datetime_utils: 13 total statements, 0.0% covered

Generated: Wed 2013-03-13 10:33 CET

Source file: /media/Envs/Envs/filer-gallery/lib/python2.7/site-packages/south/utils/datetime_utils.py

Stats: 0 executed, 8 missed, 5 excluded, 15 ignored

  1. from datetime import *
  2. import django
  3. from django.conf import settings
  4. if django.VERSION[:2] >= (1, 4) and getattr(settings, 'USE_TZ', False):
  5. from django.utils import timezone
  6. from datetime import datetime as _datetime
  7. class datetime(_datetime):
  8. """
  9. A custom datetime.datetime class which acts as a compatibility
  10. layer between South and Django 1.4's timezone aware datetime
  11. instances.
  12. It basically adds the default timezone (as configured in Django's
  13. settings) automatically if no tzinfo is given.
  14. """
  15. def __new__(cls, year, month, day,
  16. hour=0, minute=0, second=0, microsecond=0, tzinfo=None):
  17. dt = _datetime(year, month, day,
  18. hour, minute, second, microsecond,
  19. tzinfo=tzinfo)
  20. if tzinfo is None:
  21. default_timezone = timezone.get_default_timezone()
  22. dt = timezone.make_aware(dt, default_timezone)
  23. return dt