Skip to content
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

As an open source user settings is already pre-populated (never null) #1262

Open
chrisjsimpson opened this issue Oct 22, 2023 · 0 comments
Open

Comments

@chrisjsimpson
Copy link
Contributor

chrisjsimpson commented Oct 22, 2023

Is your feature request related to a problem? Please describe.
When using Subscribie standalone , (without Subscribie Deployer) the settings model is empty by default which causes:

File "subscribie/utils.py", line 58, in get_shop_default_country_code
 default_country_code = settings.default_country_code
 AttributeError: 'NoneType' object has no attribute 'default_country_code'

Describe the solution you'd like

During blueprint first run, pre-populate the Settings model with a row of settings, with the column insertion defaults.

  1. replace before_app_first_request with record_once because before_app_first_request has been deprecated (unable to find reason) record_once may or may not be the correct replacement*.
    @bp.before_app_first_request

*Update: record_once not used- instead we've moved initialisation logic to new bootstrap_app.py and passed an application context to that.

Describe alternatives you've considered

Additional context
We crudely populate Settings model here but that's programming by coincidence and should also be removed.

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

No branches or pull requests

1 participant