Fuyukai / Kyoukai

[OLD] A fully async web framework for Python3.5+ using asyncio
https://mirai.veriny.tf
MIT License
298 stars 14 forks source link

share objects in a blueprint #9

Closed njordr closed 7 years ago

njordr commented 7 years ago

Hi.

Is there a way to share an object (let say for example a dict) in a blueprint?

I've a before request fuction that validate a token. I'm wandering if a I can create a dict with all the valid tokens and launch the validate function passing the dict to it

Fuyukai commented 7 years ago

Well, you can just monkeypatch the item onto the Blueprint, ala bp.whatever = {"my": "dict}.

I suppose there could be a use-case for per blueprint configuration.

njordr commented 7 years ago

Thanks, it works