Exemplo n.º 1
0
 def getSubjects(self, fingerprint, daysToSubtract):
     posts = Hermes.getSubjects(fingerprint, daysToSubtract)
     returnList = []
     if posts.__len__() == 0:
         return "[]"
     else:
         for post in posts:
             # asDict only converts to dict the values in models table. add the rest by hand.
             postDict = post.asDict()
             postDict['FirstPostBody'] = post.FirstPostBody
             postDict['FirstPostOwner'] = post.FirstPostOwner
             postJSON = ujson.dumps(postDict, ensure_ascii=False)
             returnList.append(postJSON)
         return ujson.dumps(returnList, ensure_ascii=False)
Exemplo n.º 2
0
 def getSubjects(self, fingerprint, daysToSubtract):
     posts = Hermes.getSubjects(fingerprint, daysToSubtract)
     returnList = []
     if posts.__len__() == 0:
         return "[]"
     else:
         for post in posts:
             # asDict only converts to dict the values in models table. add the rest by hand.
             postDict = post.asDict()
             postDict['FirstPostBody'] = post.FirstPostBody
             postDict['FirstPostOwner'] = post.FirstPostOwner
             postJSON = ujson.dumps(postDict, ensure_ascii=False)
             returnList.append(postJSON)
         return ujson.dumps(returnList, ensure_ascii=False)