issue #41#57
Conversation
First pass at factoring out the code that fixes the up failed service request-id. The Chicago specific code has been moved to fix_request_id_chi, which is assigned to fix_request_id, which is the function that is actually called in show_request(). Any other cities need to write an equivalent to fix_request_id_chi and assign it to fix_request_id (presumably, there is a way to make this more pluggable/configurable).
|
This looks like a pretty good start. Thanks for taking a crack at it! I like how you are reassigning the function to a more generic name. Looking at this, I'm thinking having a separate file full of methods like this one that could be called by the main application would be a good model. It could either have a standard name (maybe So you might have this folder structure: And try:
import localized_behaviors as hooks
except:
hooks = Noneor hooks = None
if 'localized_behaviors' in app.config:
hooks = importlib.import_module(app.config['localized_behaviors'])Any thoughts? |
|
Also, in either of these cases, I think we'd either ship Chicago's as the example or have a separate branch that includes the Chicago version of the methods in |
|
I left it the way I did because I have no experience writing pluggable stuff like this. I think from your comment I should be able to get something working. |
|
Great! sounded like that might be the case. Always happy to provide pointers. You can also check out |
First pass at factoring out the code that fixes the up failed service
request-id.
The Chicago specific code has been moved to fix_request_id_chi, which
is assigned to fix_request_id, which is the function that is actually
called in show_request(). Any other cities need to write an
equivalent to fix_request_id_chi and assign it to fix_request_id
(presumably, there is a way to make this more pluggable/configurable).