Skip to content
This repository has been archived by the owner on Feb 7, 2019. It is now read-only.

Signal for missing keys #9

Closed
iurisilvio opened this issue Aug 7, 2014 · 5 comments
Closed

Signal for missing keys #9

iurisilvio opened this issue Aug 7, 2014 · 5 comments

Comments

@iurisilvio
Copy link
Contributor

I want to add the key to my sqlalchemy database if it does not exist in any other handler. I can listen to some flask signal in this case to do that.

Is it a good idea? I can work on it, but maybe others have better ideas about how to handle it.

@catermelon
Copy link
Collaborator

I think it's a fine idea to add blinker signals for critical events, so I'm all for that.

I don't want to add support for adding keys automatically, because I think it's a likely uncommon use case and could be potentially dangerous if you didn't know what you were doing. I'm willing to be convinced otherwise, but that's my first response.

@iurisilvio
Copy link
Contributor Author

I agree, I want this signal to make it an option, not a built-in thing.

I'll provide you an example soon.

@iurisilvio
Copy link
Contributor Author

Done.

I don't know if a global event is better than a class level event.

from flask.ext.featureflags import missing_feature

@missing_feature.connect
def f(obj, feature):
    pass

If I change it to class level:

ff = FeatureFlag()

@ff.missing_feature.connect
def f(obj, feature):
    # obj is my FeatureFlag instance
    pass

catermelon pushed a commit that referenced this issue Aug 13, 2014
When a feature isn't handled by anything, send a signal. Ref #9
@iurisilvio
Copy link
Contributor Author

Closing it, because it is merged.

@catermelon
Copy link
Collaborator

thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants