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

Python settings should be parsed before the calling includeme #200

Open
cheungpat opened this issue Apr 17, 2018 · 1 comment
Open

Python settings should be parsed before the calling includeme #200

cheungpat opened this issue Apr 17, 2018 · 1 comment

Comments

@cheungpat
Copy link
Contributor

cheungpat commented Apr 17, 2018

Currently py-skygear does the following in order before accepting requests from plugin transport:

  • load python module
  • call includeme
  • call parse_all_settings

The desired order should be:

  • load python module
  • call parse_all_settings
  • call includeme

In the desired order, the settings is available to module in includeme.

@cheungpat cheungpat changed the title Python settings should be loaded Python settings should be parsed before the calling includeme Apr 17, 2018
@rickmak
Copy link
Member

rickmak commented Apr 17, 2018

Here is the example code that I comfirm the behaviour

at __init__.py

import os
import skygear
from skygear.settings import settings

settings.injectsettings.t = 'Code over ride'

skygear.config('injectsettings')

At injectsettings/__init__.py

from skygear.settings import add_parser, SettingsParser

s = SettingsParser('INJECT_SETTINGS')
s.add_setting('t', default='default t')
add_parser('injectsettings', s)

def includeme(s):
    print(s.injectsettings.t)

When I run INJECT_SETTINGS_T=portalvalue py-skygear injectsettings __init__.py

Expected result
Code over ride

Actual result (at 1.4.0)
portalvalue

Use-case

Developer want to override forgot password html template for beautiful design.

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

2 participants