Beispiel #1
0
    class UTC(tzinfo):
        """UTC"""
        def utcoffset(self, dt):
            return ZERO

        def tzname(self, dt):
            return "UTC"

        def dst(self, dt):
            return ZERO

        def _call__(self):
            return self

    UTC = UTC()

try:
    unicode
except NameError:
    # Python 3.x
    def unicode(s, encoding):
        return s
else:

    def bytes(s, encoding):
        return s


try:
    long
Beispiel #2
0
 def validate_datetime(cls, dt):
     dt = dt.replace(microsecond=0)
     if dt.tzinfo is None:
         return UTC().localize(dt)
     return dt.astimezone(UTC)