示例#1
0
 def __unicode__(self):
     return u"{1} event \"{0}\" at {2}".format(
         self.Description,
         unicode(self.EventClass)
         if self.EventClass is not None else u"raw",
         TimeUtils.fromTimestamp(self.StartTime).strftime(
             Formatting.priyomdate))
示例#2
0
def appendDateElement(parentNode, name, value, useNamespace=namespace):
    date = TimeUtils.fromTimestamp(value)
    node = appendTextElement(parentNode,
                             name,
                             date.strftime(Formatting.priyomdate),
                             useNamespace=useNamespace)
    node.set(u"unix", unicode(value))
    return node
示例#3
0
 def priyom_timestamp(s):
     if allowNone and (((type(s) == str or type(s) == unicode) and (len(s) == 0 or s.lower() == "none")) or s is None):
         return None
     if type(s) == int or type(s) == float:
         if asDate:
             return TimeUtils.fromTimestamp(s)
         else:
             return s
     if asDate:
         return datetime.strptime(s, Formatting.priyomdate)
     else:
         return TimeUtils.toTimestamp(datetime.strptime(s, Formatting.priyomdate))
示例#4
0
 def timestamp(value):
     return TimeUtils.fromTimestamp(value).strftime(priyomdate)
示例#5
0
文件: Event.py 项目: priyom/priyomdb
 def __unicode__(self):
     return u"{1} event \"{0}\" at {2}".format(
         self.Description,
         unicode(self.EventClass) if self.EventClass is not None else u"raw",
         TimeUtils.fromTimestamp(self.StartTime).strftime(Formatting.priyomdate)
     )
示例#6
0
 def toTableRow(self, tr):
     HTMLIntf.SubElement(tr, u"td").text = TimeUtils.fromTimestamp(
         self.Timestamp).strftime(priyomdate)
     HTMLIntf.SubElement(tr, u"th").text = self.Title
     HTMLIntf.SubElement(HTMLIntf.SubElement(tr, u"td"),
                         u"p").text = self.Contents
示例#7
0
 def timestamp(value):
     return TimeUtils.fromTimestamp(value).strftime(priyomdate)
示例#8
0
 def toTableRow(self, tr):
     HTMLIntf.SubElement(tr, u"td").text = TimeUtils.fromTimestamp(self.Timestamp).strftime(priyomdate)
     HTMLIntf.SubElement(tr, u"th").text = self.Title
     HTMLIntf.SubElement(HTMLIntf.SubElement(tr, u"td"), u"p").text = self.Contents
示例#9
0
def appendDateElement(parentNode, name, value, useNamespace=namespace):
    date = TimeUtils.fromTimestamp(value)
    node = appendTextElement(parentNode, name, date.strftime(Formatting.priyomdate), useNamespace=useNamespace)
    node.set(u"unix", unicode(value))
    return node