Exemplo n.º 1
0
    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
Exemplo n.º 2
0
 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