Beispiel #1
0
    def _fromRpcDateTime(self, rpcDateTimeStr):
        u"""Converts the xml rpc date time string to datetime.datetime object."""  #$NON-NLS-1$
        # eg: 20050417T09:57:06  (Wordpress - it does not have time zone though it returns zulu time)
        # eg: 2005-07-29T01:47:13Z (Typepad)
        # eg: 2005-03-25T01:21:54Z (another Typepad for 2005-03-24T20:21:54-05:00 local time))

        # FIXME (PJ) use params to figure out if the dateformat needs to be overridden and handle cases where incoming time is in local tz (eg LiveJournal)
        schemaDateTime = dateutil.getIso8601Date(toUnicode(rpcDateTimeStr))
        if schemaDateTime:
            return schemaDateTime.getDateTime()
        else:
            return getCurrentUtcDateTime()
Beispiel #2
0
    def _fromRpcDateTime(self, rpcDateTimeStr):
        u"""Converts the xml rpc date time string to datetime.datetime object.""" #$NON-NLS-1$
        # eg: 20050417T09:57:06  (Wordpress - it does not have time zone though it returns zulu time)
        # eg: 2005-07-29T01:47:13Z (Typepad)
        # eg: 2005-03-25T01:21:54Z (another Typepad for 2005-03-24T20:21:54-05:00 local time))

        # FIXME (PJ) use params to figure out if the dateformat needs to be overridden and handle cases where incoming time is in local tz (eg LiveJournal)
        schemaDateTime = dateutil.getIso8601Date( toUnicode(rpcDateTimeStr) )
        if schemaDateTime:
            return schemaDateTime.getDateTime()
        else:
            return getCurrentUtcDateTime()
Beispiel #3
0
 def _parseISO8601Date(self, dateStr, dflt = None):
     u"Parses a date string formatted in extended ISO8601 date-time format (aka xsd:dateTime format)." #$NON-NLS-1$
     if dateStr:
         dateStr = dateStr.strip(u"\r\n")  #$NON-NLS-1$
         dateStr = dateStr.strip(u"\r")  #$NON-NLS-1$
         dateStr = dateStr.strip(u"\n")  #$NON-NLS-1$
     schemaDt = getIso8601Date(dateStr)
     rval = None
     if schemaDt:
         rval = schemaDt.getDateTime()
     if not schemaDt and dflt:
         rval = dflt
     elif not schemaDt:
         rval = getCurrentUtcDateTime()
     return rval