コード例 #1
0
def create_application(debug):
    replication.configure_as_primary()
    rest_api.set_config_locked(config.is_remote_configured)

    # Configure UI appearance, add all custom tabs.
    ui.configure_ui(app_name='Auth Service',
                    ui_tabs=[
                        ui.GroupsHandler,
                        ui.ChangeLogHandler,
                        ui.LookupHandler,
                        ServicesHandler,
                        ui.OAuthConfigHandler,
                        ui.IPWhitelistsHandler,
                        ConfigHandler,
                        ui.ApiDocHandler,
                    ],
                    ui_data_callback=get_additional_ui_data)
    template.bootstrap({'auth_service': TEMPLATES_DIR})

    # Add a fake admin for local dev server.
    if utils.is_local_dev_server():
        auth.bootstrap_group(
            auth.ADMIN_GROUP,
            [auth.Identity(auth.IDENTITY_USER, '*****@*****.**')],
            'Users that can manage groups')
    return webapp2.WSGIApplication(get_routes(), debug=debug)
コード例 #2
0
def create_frontend_app():
  template.bootstrap({
      'templates': os.path.join(THIS_DIR, 'templates'),
  })
  routes = get_routes()
  routes.extend(handlers_endpoints.get_routes())
  return webapp2.WSGIApplication(routes)
コード例 #3
0
ファイル: handlers_frontend.py プロジェクト: rmistry/luci-py
def create_application(debug):
  replication.configure_as_primary()
  rest_api.set_config_locked(config.is_remote_configured)

  # Configure UI appearance, add all custom tabs.
  ui.configure_ui(
      app_name='Auth Service',
      ui_tabs=[
        ui.GroupsHandler,
        ui.ChangeLogHandler,
        ServicesHandler,
        ui.OAuthConfigHandler,
        ui.IPWhitelistsHandler,
        ConfigHandler,
      ],
      env_callback=get_additional_ui_environment)
  template.bootstrap({'auth_service': TEMPLATES_DIR})

  # Add a fake admin for local dev server.
  if utils.is_local_dev_server():
    auth.bootstrap_group(
        auth.ADMIN_GROUP,
        [auth.Identity(auth.IDENTITY_USER, '*****@*****.**')],
        'Users that can manage groups')
  return webapp2.WSGIApplication(get_routes(), debug=debug)
コード例 #4
0
ファイル: main.py プロジェクト: onecityuni/luci-py
def bootstrap_templates():
  TEMPLATES_DIR = os.path.join(
    os.path.dirname(os.path.abspath(__file__)), 'templates')
  template.bootstrap(
      {'templates': TEMPLATES_DIR},
      global_env={
        'hostname': app_identity.get_default_version_hostname()
      })
コード例 #5
0
ファイル: handlers_frontend.py プロジェクト: stefb965/luci-py
def create_frontend_app():
    template.bootstrap({
        'templates': os.path.join(THIS_DIR, 'templates'),
    })
    routes = []
    if not utils.should_disable_ui_routes():
        routes.extend(get_routes())
    return webapp2.WSGIApplication(routes)
コード例 #6
0
ファイル: ui.py プロジェクト: pombreda/luci-py
def configure_ui(app_name, ui_tabs=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.
  """
    global _ui_app_name
    global _ui_navbar_tabs
    _ui_app_name = app_name
    if ui_tabs is not None:
        assert all(issubclass(cls, UINavbarTabHandler) for cls in ui_tabs)
        _ui_navbar_tabs = tuple(ui_tabs)
    template.bootstrap({'auth': TEMPLATES_DIR})
コード例 #7
0
ファイル: ui.py プロジェクト: nodirt/luci-py
def configure_ui(app_name, ui_tabs=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.
  """
  global _ui_app_name
  global _ui_navbar_tabs
  _ui_app_name = app_name
  if ui_tabs is not None:
    assert all(issubclass(cls, UINavbarTabHandler) for cls in ui_tabs)
    _ui_navbar_tabs = tuple(ui_tabs)
  template.bootstrap({'auth': TEMPLATES_DIR})
コード例 #8
0
ファイル: ui.py プロジェクト: rmistry/luci-py
def configure_ui(app_name, ui_tabs=None, env_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.
  """
  global _ui_app_name
  global _ui_env_callback
  global _ui_navbar_tabs
  _ui_app_name = app_name
  _ui_env_callback = env_callback
  if ui_tabs is not None:
    assert all(issubclass(cls, UINavbarTabHandler) for cls in ui_tabs)
    _ui_navbar_tabs = tuple(ui_tabs)
  template.bootstrap({'auth': TEMPLATES_DIR})
コード例 #9
0
ファイル: ui.py プロジェクト: amymariaparker2401/luci-py
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.
    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_data_callback
  global _ui_navbar_tabs
  _ui_app_name = app_name
  _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)
  template.bootstrap({'auth': TEMPLATES_DIR})
コード例 #10
0
ファイル: ui.py プロジェクト: onecityuni/luci-py
def configure_ui(app_name, ui_tabs=None, env_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.
  """
    global _ui_app_name
    global _ui_env_callback
    global _ui_navbar_tabs
    _ui_app_name = app_name
    _ui_env_callback = env_callback
    if ui_tabs is not None:
        assert all(issubclass(cls, UINavbarTabHandler) for cls in ui_tabs)
        _ui_navbar_tabs = tuple(ui_tabs)
    template.bootstrap({'auth': TEMPLATES_DIR})
コード例 #11
0
def explorer_proxy_route(base_path):
  """Returns a route to a handler which serves an API explorer proxy.

  Args:
    base_path: The base path under which all service paths exist.

  Returns:
    A webapp2.Route.
  """
  class ProxyHandler(webapp2.RequestHandler):
    """Returns a proxy capable of handling requests from API explorer."""

    def get(self):
      self.response.write(template.render(
          'adapter/proxy.html', params={'base_path': base_path}))

  template.bootstrap({
      'adapter': os.path.join(THIS_DIR, 'templates'),
  })
  return webapp2.Route('%s/static/proxy.html' % base_path, ProxyHandler)
コード例 #12
0
def create_application(debug):
  replication.configure_as_primary()

  # Configure UI appearance, add all custom tabs.
  ui.configure_ui(
      app_name='Auth Service',
      ui_tabs=[
        # Standard tabs provided by auth component.
        ui.GroupsHandler,
        ui.OAuthConfigHandler,
        ui.IPWhitelistsHandler,
        # Additional tabs available only on auth service.
        ConfigHandler,
        ServicesHandler,
      ])
  template.bootstrap({'auth_service': TEMPLATES_DIR})

  # Add a fake admin for local dev server.
  if utils.is_local_dev_server():
    auth.bootstrap_group(
        auth.ADMIN_GROUP,
        [auth.Identity(auth.IDENTITY_USER, '*****@*****.**')],
        'Users that can manage groups')
  return webapp2.WSGIApplication(get_routes(), debug=debug)
コード例 #13
0
ファイル: template.py プロジェクト: misscache/luci-py
def bootstrap():
    template.bootstrap({"isolate": os.path.join(ROOT_DIR, "templates")})
コード例 #14
0
ファイル: template.py プロジェクト: mellowdistrict/luci-py
def bootstrap():
  template.bootstrap({'ereporter2': os.path.join(ROOT_DIR, 'templates')})
コード例 #15
0
ファイル: template.py プロジェクト: mellowdistrict/luci-py
def bootstrap():
  template.bootstrap({'isolate': os.path.join(ROOT_DIR, 'templates')})
コード例 #16
0
    else:
      self.response.set_status(500, 'could not find latest message')

  def update_msg(self, msg_type):
    if self.request.get('deactivate'):
      return self.deactivate_latest_msg(BannerMessageHandler.MSG_TYPE)
    else:
      content = self.request.get('content')
      if content:
        return self.store_msg(msg_type, content)

  @auth.require(is_trooper_or_admin)
  def post(self):
    user = users.get_current_user()
    if user:
      msg = self.update_msg(BannerMessageHandler.MSG_TYPE)
      if msg:
        data = msg.to_json_data()
        memcache.set(BannerMessageHandler.MSG_TYPE, data)

      self.redirect('/banner-msg-form')
    else:
      self.response.set_status(401, 'No user auth')

template.bootstrap({'som': os.path.dirname(__file__)})

app = webapp2.WSGIApplication([
    ('/banner-msg', BannerMessageHandler),
    ('/banner-msg-form', BannerMessageFormHandler),
])
コード例 #17
0
ファイル: template.py プロジェクト: mellowdistrict/luci-py
def bootstrap():
  template.bootstrap({'swarming': os.path.join(ROOT_DIR, 'templates')})
コード例 #18
0
import logging

from components.main.base import ComponentsData
from components import template
from corona_app import create_app

template.bootstrap()
data = ComponentsData()
app = create_app(data)
server = app.server


@server.route("/reload_data")
def reload_data():
    data.__init__()
    logging.info("ALL DATA RELOADED")
    return "ALL DATA RELOADED"
コード例 #19
0
ファイル: template.py プロジェクト: misscache/luci-py
def bootstrap():
    template.bootstrap({"swarming": os.path.join(ROOT_DIR, "templates")})
コード例 #20
0
def main():
    template.bootstrap()
    data = ComponentsData()
    app = create_app(data)
    app.run_server(host="0.0.0.0", port=8051, debug=True)
コード例 #21
0
ファイル: handlers.py プロジェクト: eunchong/infra
import json
import logging
import os

from google.appengine.api import users

import jinja2
import webapp2

from components import decorators
from components import template

import docs

TEMPLATES_DIR = os.path.join(os.path.dirname(__file__), 'templates')
template.bootstrap({'doc': TEMPLATES_DIR})


class MainHandler(webapp2.RequestHandler):
  """Main page"""

  def get(self):
    query = self.request.get('q')

    user = users.get_current_user()
    data = {
      'query': query,
      'error': None,
      'search_results': [],
      'user': {
        'email': user.email() if user else None,