def find(self, endpoint_name, where, max_results=0): """Find items for given endpoint using mongo query in python dict object. It handles request creation here so no need to do this in service. :param string endpoint_name :param dict where :param int max_results """ req = ParsedRequest() req.where = MongoJSONEncoder().encode(where) req.max_results = max_results return self.get_from_mongo(endpoint_name, req, None)
def dumps(o): with superdesk.app.app_context(): return MongoJSONEncoder().encode(o)
def dumps(o): with koldocta.app.app_context(): return MongoJSONEncoder().encode(o)
def dumps(o): with newsroom.app.app_context(): return MongoJSONEncoder().encode(o)
def step_impl_given_role(context, role_name): with context.app.test_request_context(context.app.config['URL_PREFIX']): role = get_resource_service('roles').find_one(name=role_name, req=None) data = MongoJSONEncoder().encode({'role': role.get('_id')}) response = patch_current_user(context, data) assert_ok(response)