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
load application from factory function #2178
Conversation
Use `ast.parse` to validate that the string passed to the CLI is either an attribute name or a function call. Use `ast.literal_eval` to parse any positional and keyword arguments to the function. Call the function to get the real application. Co-authored-by: Connor Brinton <connor.brinton@gmail.com>
@benoitc I was going to add a news entry, but couldn't figure out where to add it. There's no section for the next 20.x version, and the |
sounds good for me. I will do some tests this afternoon. Thanks for the patch! |
* load application from factory function Use `ast.parse` to validate that the string passed to the CLI is either an attribute name or a function call. Use `ast.literal_eval` to parse any positional and keyword arguments to the function. Call the function to get the real application. Co-authored-by: Connor Brinton <connor.brinton@gmail.com> * test coverage for util.import_app * document app factory pattern
Thank you so much for the help on this. |
@davidism sorry I missed your message. The changes should be added to https://github.com/benoitc/gunicorn/blob/master/docs/source/news.rst also I don't link anymore to issues or ids now since it makes the changes history too much dependent of Github. So a change is a line describing the change. Rest of the history must be in git :) |
Use
ast.parse
to validate that the string passed to the CLI is either an attribute name or a function call. Useast.literal_eval
to parse positional and keyword arguments to the function. Call the function to get the real application.fixes #2159
Todo: