def test_sqlalchemy_doom(self): fake_transaction = FakeTransaction() import transaction prev_transaction_manager = transaction.manager transaction.manager = fake_transaction class RootController(TGController): @expose() def test(self): fake_transaction.doom() return 'HI!' package = PackageWithModel() conf = AppConfig(minimal=True, root_controller=RootController()) conf.package = package conf.model = package.model conf.use_sqlalchemy = True conf.use_transaction_manager = True conf['sqlalchemy.url'] = 'sqlite://' app = conf.make_wsgi_app() app = TestApp(app) app.get('/test') assert fake_transaction.aborted == True transaction.manager = prev_transaction_manager
def test_setup_sqla_auth(self): if PY3: raise SkipTest() class RootController(TGController): @expose() def test(self): return str(request.environ) package = PackageWithModel() conf = AppConfig(minimal=True, root_controller=RootController()) conf.package = package conf.model = package.model conf.auth_backend = 'sqlalchemy' conf.use_sqlalchemy = True conf['sa_auth'] = {'authmetadata': ApplicationAuthMetadata(), 'dbsession': None, 'user_class': None, 'cookie_secret':'12345'} conf['sqlalchemy.url'] = 'sqlite://' app = conf.make_wsgi_app() app = TestApp(app) assert 'repoze.who.plugins' in app.get('/test') self.config.auth_backend = None
def test_sqlalchemy_retry(self): fake_transaction = FakeTransaction() import transaction prev_transaction_manager = transaction.manager transaction.manager = fake_transaction from transaction.interfaces import TransientError class RootController(TGController): attempts = [] @expose() def test(self): self.attempts.append(True) if len(self.attempts) == 3: return 'HI!' raise TransientError() package = PackageWithModel() conf = AppConfig(minimal=True, root_controller=RootController()) conf.package = package conf.model = package.model conf.use_sqlalchemy = True conf.use_transaction_manager = True conf['sqlalchemy.url'] = 'sqlite://' conf['tm.attempts'] = 3 app = conf.make_wsgi_app() app = TestApp(app) resp = app.get('/test') assert 'HI' in resp transaction.manager = prev_transaction_manager
def test_setup_sqla_auth(self): if PY3: raise SkipTest() class RootController(TGController): @expose() def test(self): return str(request.environ) package = PackageWithModel() conf = AppConfig(minimal=True, root_controller=RootController()) conf.package = package conf.model = package.model conf.auth_backend = 'sqlalchemy' conf.use_sqlalchemy = True conf['sa_auth'] = { 'authmetadata': ApplicationAuthMetadata(), 'dbsession': None, 'user_class': None, 'cookie_secret': '12345' } conf['sqlalchemy.url'] = 'sqlite://' app = conf.make_wsgi_app() app = TestApp(app) assert 'repoze.who.plugins' in app.get('/test') self.config.auth_backend = None
def test_sqla_auth_logging_stderr(self): past_config_sa_auth = config.sa_auth config.sa_auth = {} package = PackageWithModel() conf = AppConfig(minimal=True, root_controller=None) conf.package = package conf.model = package.model conf.auth_backend = 'sqlalchemy' conf.use_sqlalchemy = True conf['sqlalchemy.url'] = 'sqlite://' alwaysadmin = _AuthenticationForgerPlugin(fake_user_key='FAKE_USER') conf['sa_auth'] = {'authmetadata': ApplicationAuthMetadata(), 'cookie_secret':'12345', 'form_plugin':alwaysadmin, 'log_level':'DEBUG', 'authenticators':UncopiableList([('alwaysadmin', alwaysadmin)]), 'identifiers':[('alwaysadmin', alwaysadmin)], 'challengers':[]} conf['sa_auth']['log_file'] = 'stderr' app = conf.make_wsgi_app() conf['sa_auth']['log_file'] = 'stdout' app = conf.make_wsgi_app() import tempfile f = tempfile.NamedTemporaryFile() conf['sa_auth']['log_file'] = f.name app = conf.make_wsgi_app() self.config['sa_auth'] = {} self.config.auth_backend = None config.sa_auth = past_config_sa_auth
def test_sqlalchemy_commit_veto(self): class RootController(TGController): @expose() def test(self): return 'HI!' @expose() def crash(self): raise Exception('crash') @expose() def forbidden(self): response.status = 403 return 'FORBIDDEN' @expose() def notfound(self): response.status = 404 return 'NOTFOUND' def custom_commit_veto(environ, status, headers): if status.startswith('404'): return True return False fake_transaction = FakeTransaction() import transaction prev_transaction_manager = transaction.manager transaction.manager = fake_transaction package = PackageWithModel() conf = AppConfig(minimal=True, root_controller=RootController()) conf.package = package conf.model = package.model conf.use_sqlalchemy = True conf.use_transaction_manager = True conf['sqlalchemy.url'] = 'sqlite://' conf.commit_veto = custom_commit_veto app = conf.make_wsgi_app() app = TestApp(app) app.get('/test') assert fake_transaction.aborted == False try: app.get('/crash') except: pass assert fake_transaction.aborted == True app.get('/forbidden', status=403) assert fake_transaction.aborted == False app.get('/notfound', status=404) assert fake_transaction.aborted == True transaction.manager = prev_transaction_manager
def test_setup_ming_persistance_with_url_alone(self): if PY3: raise SkipTest() package = PackageWithModel() conf = AppConfig(minimal=True, root_controller=None) conf.package = package conf.model = package.model conf.use_ming = True conf['ming.url'] = 'mim://inmemdb' app = conf.make_wsgi_app() assert app is not None
def test_setup_ming_persistance_advanced_options(self): if PY3: raise SkipTest() package = PackageWithModel() conf = AppConfig(minimal=True, root_controller=None) conf.package = package conf.model = package.model conf.use_ming = True conf['ming.url'] = 'mim://inmemdb' conf['ming.connection.read_preference'] = 'PRIMARY' app = conf.make_wsgi_app() assert app is not None
def test_sqla_auth_middleware_only_mine(self): past_config_sa_auth = config.sa_auth config.sa_auth = {} class RootController(TGController): @expose() def test(self): return str(request.environ) @expose() def forbidden(self): response.status = "401" package = PackageWithModel() conf = AppConfig(minimal=True, root_controller=RootController()) conf.package = package conf.model = package.model conf.auth_backend = 'sqlalchemy' conf.use_sqlalchemy = True conf['sqlalchemy.url'] = 'sqlite://' alwaysadmin = _AuthenticationForgerPlugin(fake_user_key='FAKE_USER') conf['sa_auth'] = { 'authmetadata': ApplicationAuthMetadata(), 'cookie_secret': '12345', 'form_plugin': alwaysadmin, 'authenticators': UncopiableList([('alwaysadmin', alwaysadmin)]), 'identifiers': [('alwaysadmin', alwaysadmin)], 'challengers': [] } app = conf.make_wsgi_app() authenticators = [x[0] for x in conf['sa_auth']['authenticators']] assert authenticators[0] == 'alwaysadmin' assert 'sqlauth' not in authenticators challengers = [x[1] for x in conf['sa_auth']['challengers']] assert alwaysadmin in challengers app = TestApp(app) assert 'repoze.who.identity' in app.get( '/test', extra_environ={'FAKE_USER': '******'}) assert app.get('/forbidden', status=401) self.config['sa_auth'] = {} self.config.auth_backend = None config.sa_auth = past_config_sa_auth
def test_setup_sqlalchemy(self): class RootController(TGController): @expose() def test(self): return 'HI!' package = PackageWithModel() conf = AppConfig(minimal=True, root_controller=RootController()) conf.package = package conf.model = package.model conf.use_sqlalchemy = True conf['sqlalchemy.url'] = 'sqlite://' app = conf.make_wsgi_app() app = TestApp(app) assert 'HI!' in app.get('/test') assert package.model.DBSession.DBSESSION_REMOVED
def test_sqla_auth_middleware_only_mine(self): past_config_sa_auth = config.sa_auth config.sa_auth = {} class RootController(TGController): @expose() def test(self): return str(request.environ) @expose() def forbidden(self): response.status = "401" package = PackageWithModel() conf = AppConfig(minimal=True, root_controller=RootController()) conf.package = package conf.model = package.model conf.auth_backend = 'sqlalchemy' conf.use_sqlalchemy = True conf['sqlalchemy.url'] = 'sqlite://' alwaysadmin = _AuthenticationForgerPlugin(fake_user_key='FAKE_USER') conf['sa_auth'] = {'authmetadata': ApplicationAuthMetadata(), 'cookie_secret':'12345', 'form_plugin':alwaysadmin, 'authenticators':UncopiableList([('alwaysadmin', alwaysadmin)]), 'identifiers':[('alwaysadmin', alwaysadmin)], 'challengers':[]} app = conf.make_wsgi_app() authenticators = [x[0] for x in conf['sa_auth']['authenticators']] assert authenticators[0] == 'alwaysadmin' assert 'sqlauth' not in authenticators challengers = [x[1] for x in conf['sa_auth']['challengers']] assert alwaysadmin in challengers app = TestApp(app) assert 'repoze.who.identity' in app.get('/test', extra_environ={'FAKE_USER':'******'}) assert app.get('/forbidden', status=401) self.config['sa_auth'] = {} self.config.auth_backend = None config.sa_auth = past_config_sa_auth
def test_sqla_auth_logging_stderr(self): past_config_sa_auth = config.sa_auth config.sa_auth = {} package = PackageWithModel() conf = AppConfig(minimal=True, root_controller=None) conf.package = package conf.model = package.model conf.auth_backend = 'sqlalchemy' conf.use_sqlalchemy = True conf['sqlalchemy.url'] = 'sqlite://' alwaysadmin = _AuthenticationForgerPlugin(fake_user_key='FAKE_USER') conf['sa_auth'] = { 'authmetadata': ApplicationAuthMetadata(), 'cookie_secret': '12345', 'form_plugin': alwaysadmin, 'log_level': 'DEBUG', 'authenticators': UncopiableList([('alwaysadmin', alwaysadmin)]), 'identifiers': [('alwaysadmin', alwaysadmin)], 'challengers': [] } conf['sa_auth']['log_file'] = 'stderr' app = conf.make_wsgi_app() conf['sa_auth']['log_file'] = 'stdout' app = conf.make_wsgi_app() import tempfile f = tempfile.NamedTemporaryFile() conf['sa_auth']['log_file'] = f.name app = conf.make_wsgi_app() self.config['sa_auth'] = {} self.config.auth_backend = None config.sa_auth = past_config_sa_auth
from paste.deploy.converters import asbool setting = asbool(global_conf.get('the_setting')) """ from tg.configuration import AppConfig import helloworld from helloworld import model from helloworld.lib import app_globals, helpers base_config = AppConfig() base_config.renderers = [] base_config.package = helloworld #Set the default renderer base_config.default_renderer = 'genshi' base_config.renderers.append('genshi') # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations #base_config.renderers.append('chameleon_genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = helloworld.model base_config.DBSession = helloworld.model.DBSession
from tw2jittg21demo.lib import app_globals, helpers base_config = AppConfig() base_config.renderers = [] base_config.package = tw2jittg21demo #Enable json in expose base_config.renderers.append('json') #Set the default renderer base_config.default_renderer = 'mako' base_config.renderers.append('mako') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = tw2jittg21demo.model base_config.DBSession = tw2jittg21demo.model.DBSession # Configure the authentication backend # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "ChangeME" base_config.auth_backend = 'sqlalchemy' base_config.sa_auth.dbsession = model.DBSession # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User # what is the class you want to use to search for groups in the database base_config.sa_auth.group_class = model.Group # what is the class you want to use to search for permissions in the database base_config.sa_auth.permission_class = model.Permission
from narcissus import model from narcissus.lib import app_globals, helpers base_config = AppConfig() base_config.renderers = [] base_config.package = narcissus #Enable json in expose base_config.renderers.append('json') #Set the default renderer base_config.default_renderer = 'mako' base_config.renderers.append('mako') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = narcissus.model base_config.DBSession = narcissus.model.DBSession # Configure the authentication backend # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "ChangeME" base_config.auth_backend = 'sqlalchemy' base_config.sa_auth.dbsession = model.DBSession # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User # what is the class you want to use to search for groups in the database base_config.sa_auth.group_class = model.Group # what is the class you want to use to search for permissions in the database base_config.sa_auth.permission_class = model.Permission
base_config = AppConfig() base_config.renderers = [] base_config.package = budget #Enable json in expose base_config.renderers.append('json') #Set the default renderer base_config.default_renderer = 'mako' base_config.renderers.append('mako') base_config.renderers.append('genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = budget.model base_config.DBSession = budget.model.DBSession # Configure the authentication backend # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "bothshit" base_config.auth_backend = 'sqlalchemy' base_config.sa_auth.dbsession = model.DBSession # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User # what is the class you want to use to search for groups in the database base_config.sa_auth.group_class = model.Group # what is the class you want to use to search for permissions in the database base_config.sa_auth.permission_class = model.Permission
from artists import model from artists.lib import app_globals, helpers base_config = AppConfig() base_config.renderers = [] base_config.package = artists #Enable json in expose base_config.renderers.append('json') #Set the default renderer base_config.default_renderer = 'mako' base_config.renderers.append('mako') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = artists.model base_config.DBSession = artists.model.DBSession # Configure the authentication backend # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "ChangeME" base_config.auth_backend = 'sqlalchemy' base_config.sa_auth.dbsession = model.DBSession # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User # what is the class you want to use to search for groups in the database base_config.sa_auth.group_class = model.Group # what is the class you want to use to search for permissions in the database base_config.sa_auth.permission_class = model.Permission
#Enable json in expose base_config.renderers.append('json') #Enable genshi in expose to have a lingua franca for extensions and pluggable apps #you can remove this if you don't plan to use it. base_config.renderers.append('genshi') #Set the default renderer base_config.default_renderer = 'genshi' # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations #base_config.renderers.append('chameleon_genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = ebetl.model base_config.DBSession = ebetl.model.DBSession # Configure the authentication backend # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "ChangeME" base_config.auth_backend = 'sqlalchemy' # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User from tg.configuration.auth import TGAuthMetadata #This tells to TurboGears how to retrieve the data for your user class ApplicationAuthMetadata(TGAuthMetadata):
base_config.renderers.append('json') # Set the default renderer base_config.renderers.append('mako') base_config.renderers.append('kajiki') base_config[ 'templating.kajiki.strip_text'] = False # Change this in setup.py too for i18n to work. base_config.default_renderer = 'mako' # Configure Sessions, store data as JSON to avoid pickle security issues base_config['session.enabled'] = True base_config['session.data_serializer'] = 'json' # Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = empty.model base_config.DBSession = empty.model.DBSession # Configure the authentication backend base_config.auth_backend = 'sqlalchemy' # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "766c96cf-0e2b-4b1a-b621-941ba60f1b7a" # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User from tg.configuration.auth import TGAuthMetadata # This tells to TurboGears how to retrieve the data for your user class ApplicationAuthMetadata(TGAuthMetadata): def __init__(self, sa_auth): self.sa_auth = sa_auth
base_config.prefer_toscawidgets2 = True base_config.package = wiki20 # Enable json in expose base_config.renderers.append('json') # Enable genshi in expose to have a lingua franca # for extensions and pluggable apps. # You can remove this if you don't plan to use it. base_config.renderers.append('genshi') # Set the default renderer base_config.default_renderer = 'genshi' # Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = wiki20.model base_config.DBSession = wiki20.model.DBSession # Configure the authentication backend base_config.auth_backend = 'sqlalchemy' # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "de112dc1-fdf6-4152-859a-391c4034419d" # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User from tg.configuration.auth import TGAuthMetadata # This tells to TurboGears how to retrieve the data for your user class ApplicationAuthMetadata(TGAuthMetadata): def __init__(self, sa_auth): self.sa_auth = sa_auth
# Enable json in expose base_config.renderers.append('json') # Set the default renderer base_config.renderers.append('kajiki') base_config[ 'templating.kajiki.strip_text'] = False # Change this in setup.py too for i18n to work. base_config.default_renderer = 'kajiki' # Configure Sessions, store data as JSON to avoid pickle security issues base_config['session.enabled'] = True base_config['session.data_serializer'] = 'json' # Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = mozzarella.model base_config.DBSession = mozzarella.model.DBSession # Configure the authentication backend base_config.auth_backend = 'sqlalchemy' # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "2a654f87-1cb4-43fb-834b-413c449a71a8" # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User from tg.configuration.auth import TGAuthMetadata # This tells to TurboGears how to retrieve the data for your user class ApplicationAuthMetadata(TGAuthMetadata): def __init__(self, sa_auth): self.sa_auth = sa_auth
setting = asbool(global_conf.get('the_setting')) """ from tg.configuration import AppConfig import zojstat from zojstat import model from zojstat.lib import app_globals, helpers base_config = AppConfig() base_config.renderers = [] base_config.package = zojstat #Enable json in expose base_config.renderers.append('json') #Set the default renderer base_config.default_renderer = 'genshi' base_config.renderers.append('genshi') # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations #base_config.renderers.append('chameleon_genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = zojstat.model base_config.DBSession = zojstat.model.DBSession #session_filter.on = True #i18n.run_template_filter = True
base_config.renderers.append('json') # Set the default renderer base_config.renderers.append('mako') base_config.renderers.append('kajiki') base_config[ 'templating.kajiki.strip_text'] = False # Change this in setup.py too for i18n to work. base_config.default_renderer = 'mako' # Configure Sessions, store data as JSON to avoid pickle security issues base_config['session.enabled'] = True base_config['session.data_serializer'] = 'json' # Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = telefonica.model base_config.DBSession = telefonica.model.DBSession # Configure the authentication backend base_config.auth_backend = 'sqlalchemy' # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "2a817308-b0ea-4ca7-bb42-00a20c941280" # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User from tg.configuration.auth import TGAuthMetadata # This tells to TurboGears how to retrieve the data for your user class ApplicationAuthMetadata(TGAuthMetadata): def __init__(self, sa_auth): self.sa_auth = sa_auth
from tg.configuration import AppConfig, Bunch import toscasample from toscasample import model from toscasample.lib import app_globals, helpers base_config = AppConfig() base_config.renderers = [] base_config.package = toscasample #Set the default renderer base_config.default_renderer = 'genshi' base_config.renderers.append('genshi') # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations #base_config.renderers.append('chameleon_genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = toscasample.model base_config.DBSession = toscasample.model.DBSession
# Enable json in expose base_config.renderers.append('json') # Set the default renderer base_config.renderers.append('kajiki') base_config[ 'templating.kajiki.strip_text'] = False # Change this in setup.py too for i18n to work. base_config.default_renderer = 'kajiki' # Configure Sessions, store data as JSON to avoid pickle security issues base_config['session.enabled'] = True base_config['session.data_serializer'] = 'json' # Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = tgsamplecontacts.model base_config.DBSession = tgsamplecontacts.model.DBSession # Configure the authentication backend base_config.auth_backend = 'sqlalchemy' # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "cffc5f6b-dad5-4205-b0e6-bd5da79f53b1" # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User from tg.configuration.auth import TGAuthMetadata # This tells to TurboGears how to retrieve the data for your user class ApplicationAuthMetadata(TGAuthMetadata): def __init__(self, sa_auth): self.sa_auth = sa_auth
base_config.package = lpm #Enable json in expose base_config.renderers.append('json') #Set the default renderer base_config.default_renderer = 'genshi' base_config.renderers.append('genshi') # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations #base_config.renderers.append('chameleon_genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = lpm.model base_config.DBSession = lpm.model.DBSession # Configure the authentication backend # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "hola" #"ChangeME" base_config.auth_backend = 'sqlalchemy' base_config.sa_auth.dbsession = model.DBSession # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.Usuario # what is the class you want to use to search for groups in the database base_config.sa_auth.group_class = model.Rol # what is the class you want to use to search for permissions in the database base_config.sa_auth.permission_class = model.Permiso
base_config['templating.kajiki.strip_text'] = False base_config.default_renderer = 'kajiki' # Admin configuration class AdminConfig(TGAdminConfig): allow_only = tg.predicates.has_permission('admin') # Configure Sessions, store data as JSON to avoid pickle security issues base_config['session.enabled'] = True base_config['session.data_serializer'] = 'json' # Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = central.model base_config.DBSession = central.model.DBSession # Configure the authentication backend base_config.auth_backend = 'sqlalchemy' # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "7e32df38-56ed-478b-9694-0e1c3b6972a2" # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User # This tells to TurboGears how to retrieve the data for your user class ApplicationAuthMetadata(TGAuthMetadata): def __init__(self, sa_auth): self.sa_auth = sa_auth def authenticate(self, environ, identity):
base_config = AppConfig() base_config.renderers = [] base_config.package = tg2app #Set the default renderer base_config.default_renderer = 'genshi' base_config.renderers.append('genshi') # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations #base_config.renderers.append('chameleon_genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = tg2app.model base_config.DBSession = tg2app.model.DBSession # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "ChangeME" # Configure the authentication backend base_config.auth_backend = 'sqlalchemy' base_config.sa_auth.dbsession = model.DBSession # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User # what is the class you want to use to search for groups in the database base_config.sa_auth.group_class = model.Group # what is the class you want to use to search for permissions in the database base_config.sa_auth.permission_class = model.Permission
# Enable json in expose base_config.renderers.append('json') # Set the default renderer base_config.renderers.append('kajiki') base_config[ 'templating.kajiki.strip_text'] = False # Change this in setup.py too for i18n to work. base_config.default_renderer = 'kajiki' # Configure Sessions, store data as JSON to avoid pickle security issues base_config['session.enabled'] = True base_config['session.data_serializer'] = 'json' # Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = weeehire.model base_config.DBSession = weeehire.model.DBSession # Configure the authentication backend base_config.auth_backend = 'sqlalchemy' # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "3620928b-e7f4-403d-acc9-d17c321e80a8" # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User from tg.configuration.auth import TGAuthMetadata # This tells to TurboGears how to retrieve the data for your user class ApplicationAuthMetadata(TGAuthMetadata): def __init__(self, sa_auth): self.sa_auth = sa_auth
base_config.renderers = [] base_config.package = testando #Enable json in expose base_config.renderers.append('json') #Set the default renderer base_config.default_renderer = 'genshi' base_config.renderers.append('genshi') # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations #base_config.renderers.append('chameleon_genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = testando.model base_config.DBSession = testando.model.DBSession # Configure the authentication backend # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "F*#%You!..YouChangeYourSelf!" base_config.auth_backend = 'sqlalchemy' base_config.sa_auth.dbsession = model.DBSession # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.Usuario base_config.sa_auth.translations.users = 'usuarios' base_config.sa_auth.translations.user_name = 'usuario_name' base_config.sa_auth.translations.validate_password = '******' # what is the class you want to use to search for groups in the database
base_config.package = saip #Enable json in expose base_config.renderers.append('json') #Set the default renderer base_config.default_renderer = 'genshi' base_config.renderers.append('genshi') # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations #base_config.renderers.append('chameleon_genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = saip.model base_config.DBSession = saip.model.DBSession # Configure the authentication backend # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "ChangeME" base_config.auth_backend = 'sqlalchemy' base_config.sa_auth.dbsession = model.DBSession # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.Usuario # what is the class you want to use to search for groups in the database base_config.sa_auth.group_class = model.Rol # what is the class you want to use to search for permissions in the database base_config.sa_auth.permission_class = model.Permiso
from paste.deploy.converters import asbool setting = asbool(global_conf.get('the_setting')) """ from tg.configuration import AppConfig import outages from outages import model from outages.lib import app_globals, helpers base_config = AppConfig() base_config.renderers = [] base_config.package = outages #Enable json in expose base_config.renderers.append('json') #Set the default renderer base_config.default_renderer = 'mako' base_config.renderers.append('mako') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = outages.model base_config.DBSession = outages.model.DBSession base_config.use_toscawidgets = False base_config.use_toscawidgets2 = True
base_config.renderers.append('json') # Enable genshi in expose to have a lingua franca # for extensions and pluggable apps. # You can remove this if you don't plan to use it. base_config.renderers.append('genshi') # Set the default renderer base_config.default_renderer = 'mako' base_config.renderers.append('mako') # Configure Sessions, store data as JSON to avoid pickle security issues base_config['session.enabled'] = True base_config['session.data_serializer'] = 'json' # Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = githandler.model base_config.DBSession = githandler.model.DBSession # Configure the authentication backend base_config.auth_backend = 'sqlalchemy' # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "18cf2684-c4c8-4566-8caa-80cae73fcb27" # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User from tg.configuration.auth import TGAuthMetadata # This tells to TurboGears how to retrieve the data for your user class ApplicationAuthMetadata(TGAuthMetadata): def __init__(self, sa_auth): self.sa_auth = sa_auth
base_config.package = pyjobsweb # Enable json in expose base_config.renderers.append('json') # Enable genshi in expose to have a lingua franca # for extensions and pluggable apps. # You can remove this if you don't plan to use it. base_config.renderers.append('genshi') # Set the default renderer base_config.default_renderer = 'mako' base_config.renderers.append('mako') # Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = pyjobsweb.model base_config.DBSession = pyjobsweb.model.DBSession # Configure the authentication backend base_config.auth_backend = 'sqlalchemy' # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "61e866fc-c1ef-41f1-90ef-46054f5ab28d" # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User from tg.configuration.auth import TGAuthMetadata # This tells to TurboGears how to retrieve the data for your user class ApplicationAuthMetadata(TGAuthMetadata): def __init__(self, sa_auth): self.sa_auth = sa_auth
:func:`paste.deploy.converters.asbool` function, as in:: from paste.deploy.converters import asbool setting = asbool(global_conf.get('the_setting')) """ from tg.configuration import AppConfig import ovirtserver from ovirtserver import model from ovirtserver.lib import app_globals, helpers base_config = AppConfig() base_config.renderers = [] base_config.package = ovirtserver #Set the default renderer base_config.default_renderer = 'genshi' base_config.renderers.append('genshi') # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations #base_config.renderers.append('chameleon_genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = ovirtserver.model base_config.DBSession = ovirtserver.model.DBSession
base_config = AppConfig() base_config.renderers = [] base_config.package = saip2011 #Set the default renderer base_config.default_renderer = 'genshi' base_config.renderers.append('genshi') # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations #base_config.renderers.append('chameleon_genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = saip2011.model base_config.DBSession = saip2011.model.DBSession # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "ChangeME" # Configure the authentication backend base_config.auth_backend = 'sqlalchemy' base_config.sa_auth.dbsession = model.DBSession # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User # what is the class you want to use to search for groups in the database base_config.sa_auth.group_class = model.Group # what is the class you want to use to search for permissions in the database base_config.sa_auth.permission_class = model.Permission
# Enable json in expose base_config.renderers.append('json') # Set the default renderer base_config.renderers.append('jinja') base_config.jinja_extensions = ['jinja2.ext.with_'] # base_config.renderers.append('kajiki') base_config.default_renderer = 'jinja' # Configure Sessions, store data as JSON to avoid pickle security issues base_config['session.enabled'] = True base_config['session.data_serializer'] = 'json' # Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = fortress.model base_config.DBSession = fortress.model.DBSession # Configure the authentication backend base_config.auth_backend = 'sqlalchemy' # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "996ac62d-b6ca-45cc-9982-2db41f2a33bd" # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User # This tells to TurboGears how to retrieve the data for your user class ApplicationAuthMetadata(TGAuthMetadata): def __init__(self, sa_auth): self.sa_auth = sa_auth def authenticate(self, environ, identity):
from tg.configuration import AppConfig, Bunch import ldapauth from ldapauth import model from ldapauth.lib import app_globals, helpers base_config = AppConfig() base_config.renderers = [] base_config.package = ldapauth #Set the default renderer base_config.default_renderer = 'genshi' base_config.renderers.append('genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = ldapauth.model base_config.DBSession = ldapauth.model.DBSession
base_config.renderers = [] base_config.package = mc27 #Enable json in expose base_config.renderers.append('json') #Set the default renderer base_config.default_renderer = 'genshi' base_config.renderers.append('genshi') # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations #base_config.renderers.append('chameleon_genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = mc27.model base_config.DBSession = mc27.model.DBSession # Configure the authentication backend # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "ChangeME" base_config.auth_backend = 'sqlalchemy' base_config.sa_auth.dbsession = model.DBSession # what is the class you want to use to search for users in the database #base_config.sa_auth.user_class = model.User base_config.sa_auth.user_class = model.MCUser # what is the class you want to use to search for groups in the database #base_config.sa_auth.group_class = model.Group base_config.sa_auth.group_class = model.MCGroup
base_config.package = skylines # Enable json in expose base_config.renderers.append("json") # Set the default renderer base_config.default_renderer = "genshi" base_config.renderers.append("genshi") # base_config.renderers.append('mako') # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations # base_config.renderers.append('chameleon_genshi') # Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = skylines.model base_config.DBSession = skylines.model.DBSession # Configure the authentication backend base_config.auth_backend = "sqlalchemy" base_config.sa_auth.dbsession = model.DBSession # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User # what is the class you want to use to search for groups in the database base_config.sa_auth.group_class = model.Group # what is the class you want to use to search for permissions in the database base_config.sa_auth.permission_class = model.Permission # override this if you would like to provide a different who plugin for
base_config.renderers = [] base_config.package = spam # Set the default renderer base_config.default_renderer = "mako" base_config.renderers.append("mako") base_config.renderers.append("json") # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations # base_config.renderers.append('chameleon_genshi') # Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = spam.model base_config.DBSession = spam.model.DBSession # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "ChangeME" # Configure the authentication backend base_config.auth_backend = "sqlalchemy" base_config.sa_auth.dbsession = model.DBSession # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User # what is the class you want to use to search for groups in the database base_config.sa_auth.group_class = model.Group # what is the class you want to use to search for permissions in the database base_config.sa_auth.permission_class = model.Permission
base_config.package = pycare #Enable json in expose base_config.renderers.append('json') #Set the default renderer base_config.default_renderer = 'genshi' base_config.renderers.append('genshi') # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations #base_config.renderers.append('chameleon_genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = pycare.model base_config.DBSession = pycare.model.DBSession # Configure the authentication backend # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "ChangeME" base_config.auth_backend = 'sqlalchemy' base_config.sa_auth.dbsession = model.DBSession # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User # what is the class you want to use to search for groups in the database base_config.sa_auth.group_class = model.Group # what is the class you want to use to search for permissions in the database base_config.sa_auth.permission_class = model.Permission
base_config = AppConfig() base_config.renderers = [] base_config.package = fanmili #Set the default renderer base_config.default_renderer = 'genshi' base_config.renderers.append('genshi') # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations #base_config.renderers.append('chameleon_genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = fanmili.model base_config.DBSession = fanmili.model.DBSession # Configure the authentication backend base_config.auth_backend = 'sqlalchemy' base_config.sa_auth.dbsession = model.DBSession # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User # what is the class you want to use to search for groups in the database base_config.sa_auth.group_class = model.Group # what is the class you want to use to search for permissions in the database base_config.sa_auth.permission_class = model.Permission # 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
Please note that **all the argument values are strings**. If you want to convert them into boolean, for example, you should use the :func:`paste.deploy.converters.asbool` function, as in:: from paste.deploy.converters import asbool setting = asbool(global_conf.get('the_setting')) """ from tg.configuration import AppConfig import tgredis from tgredis import model from tgredis.lib import app_globals, helpers base_config = AppConfig() base_config.renderers = [] base_config.package = tgredis #Enable json in expose base_config.renderers.append('json') #Set the default renderer base_config.default_renderer = 'mako' base_config.renderers.append('mako') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = tgredis.model base_config.DBSession = tgredis.model.DBSession
base_config = AppConfig() base_config.renderers = [] base_config.package = sgs #Set the default renderer base_config.default_renderer = 'genshi' base_config.renderers.append('genshi') # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations #base_config.renderers.append('chameleon_genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = sgs.model base_config.DBSession = sgs.model.DBSession # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "ChangeME" # Configure the authentication backend base_config.auth_backend = 'sqlalchemy' base_config.sa_auth.dbsession = model.DBSession # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User # what is the class you want to use to search for groups in the database base_config.sa_auth.group_class = model.Group # what is the class you want to use to search for permissions in the database base_config.sa_auth.permission_class = model.Permission
base_config.package = etl # Enable json in expose base_config.renderers.append('json') # Enable genshi in expose to have a lingua franca # for extensions and pluggable apps. # You can remove this if you don't plan to use it. base_config.renderers.append('kajiki') base_config.renderers.append('genshi') # Set the default renderer base_config.default_renderer = 'kajiki' # Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = etl.model base_config.DBSession = etl.model.DBSession # Configure the authentication backend base_config.auth_backend = 'sqlalchemy' # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "ced31a37-1d1c-4fe1-8de9-6c231bafc11a" # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User from tg.configuration.auth import TGAuthMetadata # This tells to TurboGears how to retrieve the data for your user class ApplicationAuthMetadata(TGAuthMetadata): def __init__(self, sa_auth): self.sa_auth = sa_auth
# Enable json in expose base_config.renderers.append('json') # Enable genshi in expose to have a lingua franca # for extensions and pluggable apps. # You can remove this if you don't plan to use it. base_config.renderers.append('genshi') # Set the default renderer base_config.default_renderer = 'genshi' # Configure the base Ming Setup base_config.use_sqlalchemy = False base_config['tm.enabled'] = False base_config.use_ming = True base_config.model = genfunc.model base_config.DBSession = genfunc.model.DBSession # Configure the authentication backend base_config.auth_backend = 'ming' # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "db50d94a-1248-4dba-b571-9de0fdc98af0" # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User from tg.configuration.auth import TGAuthMetadata # This tells to TurboGears how to retrieve the data for your user class ApplicationAuthMetadata(TGAuthMetadata): def __init__(self, sa_auth): self.sa_auth = sa_auth
# You can remove this if you don't plan to use it. base_config.renderers.append('genshi') # Set the default renderer base_config.default_renderer = 'kajiki' base_config.renderers.append('kajiki') # Configure Sessions, store data as JSON to avoid pickle security issues base_config['session.enabled'] = True base_config['session.data_serializer'] = 'json' # Configure the base Ming Setup base_config.use_sqlalchemy = False base_config['tm.enabled'] = False base_config.use_ming = True base_config.model = ksweb.model base_config.DBSession = ksweb.model.DBSession # Configure the authentication backend base_config.auth_backend = 'ming' # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "dbb29b2e-2633-486b-88a4-2f5d75ebdc6d" # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User from tg.configuration.auth import TGAuthMetadata # This tells to TurboGears how to retrieve the data for your user class ApplicationAuthMetadata(TGAuthMetadata): def __init__(self, sa_auth): self.sa_auth = sa_auth
base_config.package = turbotequila #Enable json in expose base_config.renderers.append('json') #Set the default renderer base_config.default_renderer = 'genshi' base_config.renderers.append('genshi') # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations #base_config.renderers.append('chameleon_genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = model base_config.DBSession = model.DBSession base_config.use_transaction_manager = True base_config.use_toscawidgets = True # HOOKS def on_startup(): import datetime print ' --- starting turbotequila application --- ' + str( datetime.datetime.now()) def on_shutdown(): print '--- stopping turbotequila application --- '
#Enable json in expose base_config.renderers.append('json') #Enable genshi in expose to have a lingua franca for extensions and pluggable apps #you can remove this if you don't plan to use it. base_config.renderers.append('genshi') #Set the default renderer base_config.default_renderer = 'genshi' # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations #base_config.renderers.append('chameleon_genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = licensing_portal.model base_config.DBSession = licensing_portal.model.DBSession # Configure the authentication backend # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "ChangeME" base_config.auth_backend = 'sqlalchemy' # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User from tg.configuration.auth import TGAuthMetadata #This tells to TurboGears how to retrieve the data for your user class ApplicationAuthMetadata(TGAuthMetadata):
base_config = AppConfig() base_config.renderers = [] base_config.package = wsginiu #Set the default renderer base_config.default_renderer = 'genshi' base_config.renderers.append('genshi') # if you want raw speed and have installed chameleon.genshi # you should try to use this renderer instead. # warning: for the moment chameleon does not handle i18n translations #base_config.renderers.append('chameleon_genshi') #Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = wsginiu.model base_config.DBSession = wsginiu.model.DBSession # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "ChangeME" # Configure the authentication backend base_config.auth_backend = 'sqlalchemy' base_config.sa_auth.dbsession = model.DBSession # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User # what is the class you want to use to search for groups in the database base_config.sa_auth.group_class = model.Group # what is the class you want to use to search for permissions in the database base_config.sa_auth.permission_class = model.Permission
# Enable json in expose base_config.renderers.append('json') # Set the default renderer base_config.renderers.append('kajiki') base_config[ 'templating.kajiki.strip_text'] = False # Change this in setup.py too for i18n to work. base_config.default_renderer = 'kajiki' # Configure Sessions, store data as JSON to avoid pickle security issues base_config['session.enabled'] = True base_config['session.data_serializer'] = 'json' # Configure the base SQLALchemy Setup base_config.use_sqlalchemy = True base_config.model = acmwebsite.model base_config.DBSession = acmwebsite.model.DBSession # Configure the authentication backend base_config.auth_backend = 'sqlalchemy' # YOU MUST CHANGE THIS VALUE IN PRODUCTION TO SECURE YOUR APP base_config.sa_auth.cookie_secret = "2a654f87-1cb4-43fb-834b-413c449a71a8" # what is the class you want to use to search for users in the database base_config.sa_auth.user_class = model.User from tg.configuration.auth import TGAuthMetadata # This tells to TurboGears how to retrieve the data for your user class ApplicationAuthMetadata(TGAuthMetadata): def __init__(self, sa_auth): self.sa_auth = sa_auth