예제 #1
0
파일: tasks.py 프로젝트: fdev31/drink
    def description(self):
        if len(self.content) > 100:
            txt = self.content[:100].rsplit(None, 1)[0]+" ..."
        else:
            txt = self.content

        if self.date:
            txt = "(%s) %s"%(dt2str(self.date), txt)

        return txt
예제 #2
0
파일: generic.py 프로젝트: fdev31/drink
 def _getset(k):
     v = getattr(obj, k, None)
     if isinstance(v, (basestring, int, float)):
         pass # serializes well in json
     elif isinstance(v, drink.Model):
         if not 'r' in a(v):
             return
         v = v.struct(False, full)
         if k != v['id']:
             log.error('children ID not consistant with parent (%r != %r) !', k, v['id'])
     elif isinstance(v, datetime):
         v = dt2str(v)
     else:
         v = "N/A"
     d[k] = v