def get_session_key(self, connection):
        '''
        Queries the publisher's server and returns a session key for use in
        future queries.
        '''
        # Create an Auth object to create the request to the publisher.
        auth = Auth()
        auth.config = self.config

        schemas = AUTH_SCHEMAS
        url, status, headers, body = auth.request(connection, schemas=schemas)

        return body['sessionKey']
Beispiel #2
0
redirectUrl = inifile.get('settings', 'app_top_dir')
RELOADER = inifile.get('settings', 'RELOADER')
DEBUG = inifile.get('settings', 'DEBUG')

#トップURLの最後の/を削除
appUrl = re.sub("/$", "", redirectUrl)

session_opts = {
    'session.type': 'file',
    'session.cookie_expires': 1000,
    'session.data_dir': './data',
    'session.auto': True
}
app = SessionMiddleware(btl.app(), session_opts)

Auth.config(get_role_from_db=ut.get_role)

# decorators for access controll
req_admin = Auth(appUrl,
                 role='admin',
                 message='Only admin users can access this page.')
req_login = Auth(appUrl)

# index.pyが設置されているディレクトリの絶対パスを取得
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_DIR = os.path.join(BASE_DIR, 'static')

# テンプレートファイルを設置するディレクトリのパスを指定
TEMPLATE_PATH.append(BASE_DIR + "/views")