Chromium Code Reviews| Index: appengine/components/components/auth/ui/ui.py |
| diff --git a/appengine/components/components/auth/ui/ui.py b/appengine/components/components/auth/ui/ui.py |
| index c0b3956a2df13c86bb0832fdfb2dd4af58c96d9c..39a2b08a7f1a8cb13ad151fd2b1604ff621add8f 100644 |
| --- a/appengine/components/components/auth/ui/ui.py |
| +++ b/appengine/components/components/auth/ui/ui.py |
| @@ -32,26 +32,26 @@ TEMPLATES_DIR = os.path.join( |
| # Global static configuration set in 'configure_ui'. |
| _ui_app_name = 'Unknown' |
| -_ui_env_callback = None |
| +_ui_data_callback = None |
| _ui_navbar_tabs = () |
| -def configure_ui(app_name, ui_tabs=None, env_callback=None): |
| +def configure_ui(app_name, ui_tabs=None, ui_data_callback=None): |
| """Modifies global configuration of Auth UI. |
| Args: |
| app_name: name of the service (visible in page headers, titles, etc.) |
| ui_tabs: list of UINavbarTabHandler subclasses that define tabs to show, or |
| None to show the standard set of tabs. |
| - env_callback: callable that returns a dict with additional environment for |
| - templates. Will be called each time a template is rendered with single |
| - argument: UIHandler instance. Used by auth_service. |
| + ui_data_callback: an argumentless callable that returns a dict with |
| + additional data to return to authenticated users. It can be used by |
|
nodir
2017/04/28 17:49:24
FWIU additional data is sent to non-authenticated
Vadim Sh.
2017/04/29 01:59:10
No, it doesn't. All auth pages require authenticat
|
| + server and client side code to render templates. Used by auth_service. |
| """ |
| global _ui_app_name |
| - global _ui_env_callback |
| + global _ui_data_callback |
| global _ui_navbar_tabs |
| _ui_app_name = app_name |
| - _ui_env_callback = env_callback |
| + _ui_data_callback = ui_data_callback |
| if ui_tabs is not None: |
| assert all(issubclass(cls, UINavbarTabHandler) for cls in ui_tabs) |
| _ui_navbar_tabs = tuple(ui_tabs) |
| @@ -339,8 +339,8 @@ class UIHandler(handler.AuthenticatingHandler): |
| 'using_gae_auth': self.auth_method == handler.gae_cookie_authentication, |
| 'xsrf_token': self.generate_xsrf_token(), |
| } |
| - if _ui_env_callback: |
| - common.update(_ui_env_callback(self)) |
| + if _ui_data_callback: |
| + common.update(_ui_data_callback()) |
| # Name of Javascript module with page code. |
| js_module_name = None |