Created
February 28, 2015 01:08
-
-
Save mkandalf/18e5e4ed5d3131e7c04a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserActions(HasManyView): | |
def index(self): | |
page = int(request.args.get('page', PAGE)) | |
per_page = int(request.args.get('per_page', PER_PAGE)) | |
mandate = request.args.get('mandate', MANDATE) | |
rel_spec = parse_mandate(mandate) | |
results = self.obj.find(self.spec, | |
self.rel_name, | |
rel_spec, | |
page, | |
per_page) | |
results.map( | |
lambda repr_: representation.render(self.obj, repr_, self.rel_name) | |
) | |
results.map( | |
obj = lookup_entity(res['type']) | |
spec = select(repr_, obj.keys) | |
lambda res: res['uris']['obj'] = url_for_obj(lookup_entity(res['type']), **spec) | |
) | |
return results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment