def get_record(uid=None): """ returns a single record """ obj = None if uid is not None: obj = get_object_by_uid(uid) else: form = req.get_form() obj = get_object_by_record(form) if obj is None: raise APIError(404, "No object found") complete = req.get_complete(default=_marker) if complete is _marker: complete = True items = make_items_for([obj], complete=complete) return _.first(items)
def get_items(portal_type=None, request=None, uid=None, endpoint=None): """ returns a list of items 1. If the UID is given, fetch the object directly => should return 1 item 2. If no UID is given, search for all items of the given portal_type """ # fetch the catalog results results = get_search_results(portal_type=portal_type, uid=uid) complete = req.get_complete() if not complete: # if the uid is given, get the complete information set complete = uid and True or False return make_items_for(results, endpoint, complete=complete)
def get_record(uid=None): """ returns a single record """ obj = None if uid is not None: obj = get_object_by_uid(uid) else: form = req.get_form() obj = get_object_by_record(form) if obj is None: fail(404, "No object found") complete = req.get_complete(default=_marker) if complete is _marker: complete = True items = make_items_for([obj], complete=complete) return u.first(items)
def get_items(portal_type=None, uid=None, endpoint=None, **kw): """ returns a list of items 1. If the UID is given, fetch the object directly => should return 1 item 2. If no UID is given, search for all items of the given portal_type """ # fetch the catalog results results = get_search_results(portal_type=portal_type, uid=uid, **kw) # check for existing complete flag complete = req.get_complete(default=_marker) if complete is _marker: # if the uid is given, get the complete information set complete = uid and True or False return make_items_for(results, endpoint, complete=complete)
def get_batched(portal_type=None, request=None, uid=None, endpoint=None): """ returns a batched result record (dictionary) """ # fetch the catalog results results = get_search_results(portal_type=portal_type, uid=uid) # fetch the batch params from the request size = req.get_batch_size() start = req.get_batch_start() complete = req.get_complete() if not complete: # if the uid is given, get the complete information set complete = uid and True or False # return a batched record return get_batch(results, size, start, endpoint=endpoint, complete=complete)
def get_batched(portal_type=None, uid=None, endpoint=None, **kw): """ returns a batched result record (dictionary) """ # fetch the catalog results results = get_search_results(portal_type=portal_type, uid=uid, **kw) # fetch the batch params from the request size = req.get_batch_size() start = req.get_batch_start() # check for existing complete flag complete = req.get_complete(default=_marker) if complete is _marker: # if the uid is given, get the complete information set complete = uid and True or False # return a batched record return get_batch(results, size, start, endpoint=endpoint, complete=complete)
def test_complete_parameter(self): self.assertFalse(req.get_complete()) request = req.get_request() request.form["complete"] = "yes" self.assertTrue(req.get_complete())