Пример #1
0
 def flatten(self):
     """
         Recursively transforms non-json-serializable values and simplifies
         $oid and $data BISON structures. Intended for final output
     """
     dd = dict([(key, self[key]) for key in self.keys()])
     flatten(dd)
     return dd
Пример #2
0
 def flatten(self):
     """
         Recursively transforms non-json-serializable values and simplifies
         $oid and $data BISON structures. Intended for final output
     """
     dd = dict([(key, self[key]) for key in self.keys()])
     flatten(dd)
     return dd
Пример #3
0
def getActivityComments(context, request):
    """
    """
    activityid = request.matchdict['activity']

    mmdb = MADMaxDB(context.db)
    refering_activity = mmdb.activity[activityid]
    #cond1 = {'object.objectType' : 'comment'}
    #cond2 = {'object.inReplyTo._id' : refering_activity['_id']}
    #query = {'$and' : [ cond1, cond2 ] }
    #activities = mmdb.activity.search(query, sort="_id", limit=10, flatten=1)

    #handler = JSONResourceRoot(activities)
    replies = refering_activity.get('replies', {})
    items = replies.get('items', [])
    flatten(items)
    handler = JSONResourceRoot(items)
    return handler.buildResponse()
Пример #4
0
def getActivityComments(context, request):
    """
    """
    activityid = request.matchdict['activity']

    mmdb = MADMaxDB(context.db)
    refering_activity = mmdb.activity[activityid]
    #cond1 = {'object.objectType' : 'comment'}
    #cond2 = {'object.inReplyTo._id' : refering_activity['_id']}
    #query = {'$and' : [ cond1, cond2 ] }
    #activities = mmdb.activity.search(query, sort="_id", limit=10, flatten=1)

    #handler = JSONResourceRoot(activities)
    replies = refering_activity.get('replies', {})
    items = replies.get('items', [])
    flatten(items)
    handler = JSONResourceRoot(items)
    return handler.buildResponse()