2

I want to modify something with database hook, but I think on_fetch_item not working for me.

Here is my code:

def before_returning_contract(response):
    print('About to return a contact')

if __name__ == '__main__':

    app.on_fetched_item_contract += before_returning_contract
    Bootstrap(app)
    app.register_blueprint(eve_docs, url_prefix='/docs')

    app.run(debug=True, host="127.0.0.1")

When I run it, (I mean when I go to 127.0.0.1:5000/contract/ObjID I didn't see print result in the console. I have just saw one time within 100 tries, but I never changed anything.

yigitozmen
  • 947
  • 4
  • 23
  • 42
  • Please post the schema and domain definition from your eve app. Isn't it because you need to set `app.on_fetched_item_contracts` in plural instead of `app.on_fetched_item_contract ` ? – gcw Dec 21 '18 at 09:54

0 Answers0