Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an event in the event chain for transforming retrieved data from the upstream datasource before its rendered into the response. #65

Closed
davidjreese opened this issue Jul 4, 2013 · 0 comments

Comments

@davidjreese
Copy link

It would be useful to transform data retrieved by the upstream datasource (mongoDB fo example). Manipulating that as a dict object and then passing the parsed result along so that Eve can use it to generate the response.data field later on.

something like what I have below is what I am thinking:

# not sure if context is required, but it may be useful to support conditional logic based on knowing the caller URI, users session or some other kind of details.
def people_callback(context,data):
    customData = dict()
    customData['something'] = _code_to_make_something_
    for k,v in data.iteritems():
        v['somethingElse'] = _code_to_make_something_else_
        customData[k] = v
    return customData

`...'

app.on_get_on_read_people += people_callback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant