-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Split redash/__init__.py to prevent import time side-effects. #3601
Conversation
from .organization import DATE_FORMAT | ||
|
||
|
||
def all_settings(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't needed since Flask has app.config.from_object
from .utils import routes | ||
|
||
|
||
class Redash(Flask): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I basically tried to separate Flask app specific code in the flask.Flask subclass and all Redash specific code in the create_app
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! See comments.
Btw, you could just move the version check into create_app
, but making the code tidier is a good thing too :-)
@arikfr Is there anything else needed to merge this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but let's move the Celery events connections back to decorators.
Thanks.
09b18da
to
a279e7a
Compare
…ash#3601) ## What type of PR is this? (check all applicable) <!-- Please leave only what's applicable --> - [x] Refactor - [x] Bug Fix ## Description This basically makes sure that when import the redash package we don't accidentally trigger import-time side-effects such as requiring Redis. Refs getredash#3569 and getredash#3466.
What type of PR is this? (check all applicable)
Description
This basically makes sure that when import the redash package we don't accidentally trigger import-time side-effects such as requiring Redis.
Refs #3569 and #3466.