Ejemplo n.º 1
0
 def parse_event(self):
     """转换豆瓣数据模型到iCal数据模型"""
     event = Event()
     event.add('summary', self.title)
     desc = self.summary
     if isinstance(self.participants, int):
         desc += '\n\n' + u'参与人数 %d, 感兴趣人数 %d' \
                 %(self.participants, self.wishers)
     desc += '\n\n' + self.alternate_link
     event.add('DESCRIPTION', desc)
     #event.add('dtstart', self.start_time)
     event['dtstart'] = datetime.strftime(
         get_utc_datetime(self.start_time),
         '%Y%m%dT%H%M%SZ'
         )
     #event.add('dtend', self.end_time)
     event['dtend'] = datetime.strftime(
         get_utc_datetime(self.end_time),
         '%Y%m%dT%H%M%SZ'
         )
     event.add('STATUS', 'CONFIRMED')
     location = self.where
     if self.geo_point != None:
         location += u' @(%s)' %self.geo_point
     event.add('location', location)
     #event.add('dtstamp', datetime.now())
     event['dtstamp'] = datetime.strftime(self.create_at, '%Y%m%dT%H%M%SZ')
     event['uid'] = self.id
     return event
Ejemplo n.º 2
0
 def parse_event(self):
     """转换豆瓣数据模型到iCal数据模型"""
     event = Event()
     event.add("summary", self.title)
     desc = self.summary
     if isinstance(self.participants, int):
         desc += "\n\n" + u"参与人数 %d, 感兴趣人数 %d" % (self.participants, self.wishers)
     desc += "\n\n" + self.alternate_link
     event.add("DESCRIPTION", desc)
     # event.add('dtstart', self.start_time)
     event["dtstart"] = datetime.strftime(get_utc_datetime(self.start_time), "%Y%m%dT%H%M%SZ")
     # event.add('dtend', self.end_time)
     event["dtend"] = datetime.strftime(get_utc_datetime(self.end_time), "%Y%m%dT%H%M%SZ")
     event.add("STATUS", "CONFIRMED")
     location = self.where
     if self.geo_point != None:
         location += u" @(%s)" % self.geo_point
     event.add("location", location)
     # event.add('dtstamp', datetime.now())
     event["dtstamp"] = datetime.strftime(self.create_at, "%Y%m%dT%H%M%SZ")
     event["uid"] = self.id
     return event
Ejemplo n.º 3
0
 def isMoreThenAWeek(self):
     """活动距今时间是否大于一周了"""
     delta = datetime.utcnow() - get_utc_datetime(self.end_time)
     return delta.days > 7
Ejemplo n.º 4
0
 def isMoreThenAWeek(self):
     """活动距今时间是否大于一周了"""
     delta = datetime.utcnow() - get_utc_datetime(self.end_time)
     return delta.days > 7