本文整理汇总了Python中tg.configuration.AppConfig.mimetype_lookup方法的典型用法代码示例。如果您正苦于以下问题:Python AppConfig.mimetype_lookup方法的具体用法?Python AppConfig.mimetype_lookup怎么用?Python AppConfig.mimetype_lookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tg.configuration.AppConfig
的用法示例。
在下文中一共展示了AppConfig.mimetype_lookup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ApplicationAuthMetadata
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import mimetype_lookup [as 别名]
base_config.sa_auth.authmetadata = ApplicationAuthMetadata(base_config.sa_auth)
# You can use a different repoze.who Authenticator if you want to
# change the way users can login
#base_config.sa_auth.authenticators = [('myauth', SomeAuthenticator()]
# You can add more repoze.who metadata providers to fetch
# user metadata.
# Remember to set base_config.sa_auth.authmetadata to None
# to disable authmetadata and use only your own metadata providers
#base_config.sa_auth.mdproviders = [('myprovider', SomeMDProvider()]
# override this if you would like to provide a different who plugin for
# managing login and logout of your application
base_config.sa_auth.form_plugin = None
# override this if you are using a different charset for the login form
base_config.sa_auth.charset = 'utf-8'
# You may optionally define a page where you want users to be redirected to
# on login:
base_config.sa_auth.post_login_url = '/post_login'
# You may optionally define a page where you want users to be redirected to
# on logout:
base_config.sa_auth.post_logout_url = '/post_logout'
# by MattRock
#base_config.mimetype_lookup = {'.ext':'my-mimetype'}
base_config.mimetype_lookup = {'.pls':'audio/x-scpls'}
示例2: RemoteUserIdentifier
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import mimetype_lookup [as 别名]
# Configure the authentication backend
base_config.auth_backend = 'sqlalchemy'
base_config.sa_auth.dbsession = model.DBSession
base_config.sa_auth.user_class = model.User
base_config.sa_auth.group_class = model.Group
base_config.sa_auth.permission_class = model.Permission
base_config.sa_auth.translations.user_name = 'uid'
base_config.sa_auth.translations.group_name = 'gid'
base_config.sa_auth.translations.permission_name = 'pid'
# override this if you would like to provide a different who plugin for
# managing login and logout of your application
base_config.sa_auth.identifiers = [('remote_user_identifier', RemoteUserIdentifier(model.User, model.DBSession))]
base_config.sa_auth.remote_user_key = 'repoze.who.remote_user'
# override this if you are using a different charset for the login form
base_config.sa_auth.charset = 'utf-8'
# You may optionally define a page where you want users to be redirected to on login:
base_config.sa_auth.post_login_url = '/post_login'
# You may optionally define a page where you want users to be redirected to on logout:
base_config.sa_auth.post_logout_url = '/post_logout'
# MIME types
base_config.mimetype_lookup = {'.7': 'application/octet-stream',
'.bvec': 'application/octet-stream',
'.bval': 'application/octet-stream',
}