Esempio n. 1
0
def test_render_default():
    conf = AppConfig(minimal=True)
    conf.default_renderer = 'json'
    app = conf.make_wsgi_app()

    res = tg.render_template({'value': 'value'})
    assert 'value": "value' in res
Esempio n. 2
0
def test_render_default():
    conf = AppConfig(minimal=True)
    conf.default_renderer = 'json'
    app = conf.make_wsgi_app()

    res = tg.render_template({'value': 'value'})
    assert 'value": "value' in res
Esempio n. 3
0
 def setup(self):
     conf = AppConfig(minimal=True, root_controller=i18nRootController())
     conf['paths']['root'] = 'tests'
     conf['i18n_enabled'] = True
     conf['use_sessions'] = True
     conf['beaker.session.key'] = 'tg_test_session'
     conf['beaker.session.secret'] = 'this-is-some-secret'
     conf.renderers = ['json']
     conf.default_renderer = 'json'
     conf.package = _FakePackage()
     app = conf.make_wsgi_app()
     self.app = TestApp(app)
Esempio n. 4
0
 def setup(self):
     conf = AppConfig(minimal=True, root_controller=i18nRootController())
     conf['paths']['root'] = 'tests'
     conf['i18n_enabled'] = True
     conf['use_sessions'] = True
     conf['beaker.session.key'] = 'tg_test_session'
     conf['beaker.session.secret'] = 'this-is-some-secret'
     conf.renderers = ['json']
     conf.default_renderer = 'json'
     conf.package = _FakePackage()
     app = conf.make_wsgi_app()
     self.app = TestApp(app)
Esempio n. 5
0
    def test_tw2_renderers_preference(self):
        import tw2.core

        class RootController(TGController):
            @expose()
            def test(self, *args, **kwargs):
                rl = tw2.core.core.request_local()
                tw2conf = rl['middleware'].config
                return ','.join(tw2conf.preferred_rendering_engines)

        conf = AppConfig(minimal=True, root_controller=RootController())
        conf.prefer_toscawidgets2 = True
        conf.renderers = ['genshi']
        conf.default_renderer = 'genshi'

        app = conf.make_wsgi_app(full_stack=True)
        app = TestApp(app)

        resp = app.get('/test')
        assert 'genshi' in resp, resp
Esempio n. 6
0
    def test_tw2_unsupported(self):
        import tw2.core

        class RootController(TGController):
            @expose()
            def test(self, *args, **kwargs):
                rl = tw2.core.core.request_local()
                tw2conf = rl['middleware'].config
                return ','.join(tw2conf.preferred_rendering_engines)

        conf = AppConfig(minimal=True, root_controller=RootController())
        conf.prefer_toscawidgets2 = True
        conf.renderers = ['kajiki']
        conf.default_renderer = 'kajiki'

        try:
            app = conf.make_wsgi_app(full_stack=True)
            assert False
        except TGConfigError as e:
            assert 'None of the configured rendering engines is supported' in str(
                e)
Esempio n. 7
0
from tg.configuration import AppConfig

import turbotequila
from turbotequila import model
from turbotequila.lib import app_globals, helpers

base_config = AppConfig()
base_config.renderers = []

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

Esempio n. 8
0
    
    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
Esempio n. 9
0
# Set to a function to provide custom escaping.
base_config.dispatch_path_translator = True

base_config.prefer_toscawidgets2 = True

base_config.package = weeehire

# 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
Esempio n. 10
0
from tg.configuration import AppConfig

import spam
from spam import model
from spam.lib import app_globals, helpers

# from spam.lib.notifications import notify

base_config = AppConfig()
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"
Esempio n. 11
0
# Set to a function to provide custom escaping.
base_config.dispatch_path_translator = True

base_config.prefer_toscawidgets2 = True

base_config.package = fortress

# 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
Esempio n. 12
0
from tg.configuration import AppConfig

import skylines
from skylines import model
from skylines.lib import app_globals, helpers


base_config = AppConfig()
base_config.renderers = []

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
Esempio n. 13
0
# Set to a function to provide custom escaping.
base_config.dispatch_path_translator = True

base_config.prefer_toscawidgets2 = True

base_config.package = jeyzth42

# 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 = "jinja"
base_config.renderers.append("jinja")
base_config.jinja_extensions = ["jinja2.ext.with_"]
# Configure the base Ming Setup
base_config.use_sqlalchemy = False
base_config.use_transaction_manager = False

base_config.use_ming = True
base_config.model = jeyzth42.model
base_config.DBSession = jeyzth42.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 = "ee7240e9-ec48-4f41-b684-74ca205dea28"
# what is the class you want to use to search for users in the database
base_config.sa_auth.user_class = model.User
Esempio n. 14
0
base_config.dispatch_path_translator = True

base_config.prefer_toscawidgets2 = True

base_config.package = hollyrosa
base_config.custom_tw2_config['script_name'] = '/hollyrosa' # hollyrosa in production

# 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 = 'kajiki'
# Configure the base SQLALchemy Setup
base_config.use_sqlalchemy = False
base_config.model = None ## authtest.model
base_config.DBSession = None ## authtest.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 = "5e3d194a-4a6c-4969-9eda-9adfaae78bb4"
# what is the class you want to use to search for users in the database
base_config.sa_auth.user_class = None
base_config['flash.template'] = """<div class="notification is-$status $status" ><strong><p>$message</p></strong></div>"""

from tg.configuration.auth import TGAuthMetadata

Esempio n. 15
0
# Set to a function to provide custom escaping.
base_config.dispatch_path_translator = True

base_config.prefer_toscawidgets2 = True

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

Esempio n. 16
0
 
"""

from tg.configuration import AppConfig

import tghello
from tghello import model
from tghello.lib import app_globals, helpers 

base_config = AppConfig()
base_config.renderers = []
base_config.prefer_toscawidgets2 = True

base_config.package = tghello

#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 = 'jinja'
base_config.renderers.append('jinja')
base_config.jinja_extensions = ['jinja2.ext.with_']
#Configure the base Ming Setup
base_config.use_ming = True
base_config.use_sqlalchemy=False
base_config.use_transaction_manager=False
Esempio n. 17
0
 
"""

from tg.configuration import AppConfig

import wsginiu
from wsginiu import model
from wsginiu.lib import app_globals, helpers 

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'
Esempio n. 18
0
    
    from paste.deploy.converters import asbool
    setting = asbool(global_conf.get('the_setting'))
 
"""

from tg.configuration import AppConfig

import scriptspony
import scriptspony.model

base_config = AppConfig()
base_config.renderers = []

base_config.package = scriptspony

# Set the default renderer
base_config.default_renderer = "mako"
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 = scriptspony.model
base_config.DBSession = scriptspony.model.DBSession

base_config.use_toscawidgets = False