Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(714)

Unified Diff: appengine/components/components/auth/ui/ui.py

Issue 2840053003: auth_service: Fetch revisions of all configs (for UI) at once. (Closed)
Patch Set: comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/components/components/auth/ui/templates/oauth_config.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
+ 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
« no previous file with comments | « appengine/components/components/auth/ui/templates/oauth_config.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698