本文整理汇总了Python中pylons.url._push_object函数的典型用法代码示例。如果您正苦于以下问题:Python _push_object函数的具体用法?Python _push_object怎么用?Python _push_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_push_object函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, *args, **kwargs):
'''
initialize the test class
'''
wsgiapp = pylons.test.pylonsapp
self.app = webtest.TestApp(wsgiapp)
self.session = 'justatest'
url._push_object(URLGenerator(config['routes.map'], environ))
unittest2.TestCase.__init__(self, *args, **kwargs)
self.appconf = config
self.resolvers_params = {
'myDefRes': {
'name' : 'myDefRes',
'fileName' : '%(here)s/../data/testdata/def-passwd',
'type' : 'passwdresolver',
},
'myOtherRes' : {
'name' : 'myOtherRes',
'fileName' : '%(here)s/../data/testdata/myDom-passwd',
'type' : 'passwdresolver',
}
}
self.resolvers = {
'myOtherRes': 'useridresolver.PasswdIdResolver.IdResolver.myOtherRes',
'myDefRes': 'useridresolver.PasswdIdResolver.IdResolver.myDefRes',
}
示例2: __init__
def __init__(self, *args, **kwargs):
if pylons.test.pylonsapp:
wsgiapp = pylons.test.pylonsapp
else:
wsgiapp = loadapp('config:%s' % config['__file__'])
self.app = TestApp(wsgiapp)
url._push_object(URLGenerator(config['routes.map'], environ))
示例3: __init__
def __init__(self, *args, **kwargs):
wsgiapp = pylons.test.pylonsapp
config = wsgiapp.config
self.app = PatchedTestApp(wsgiapp)
app_globals._push_object(config['pylons.app_globals'])
url._push_object(URLGenerator(config['routes.map'], environ))
TestCase.__init__(self, *args, **kwargs)
示例4: create_request
def create_request(path, environ=None):
"""Helper used in test cases to quickly setup a request obj.
``path``
The path will become PATH_INFO
``environ``
Additional environment
Returns an instance of the `webob.Request` object.
"""
# setup the environ
if environ is None:
environ = {}
environ.update(default_environ)
# create a "blank" WebOb Request object
# using Pylon's Request which is a webob Request plus
# some compatibility methods
req = Request.blank(path, environ)
# setup a Registry
reg = environ.setdefault('paste.registry', Registry())
reg.prepare()
# setup pylons.request to point to our Registry
reg.register(pylons.request, req)
# setup tmpl context
tmpl_context._push_object(ContextObj())
url._push_object(URLGenerator(default_map, environ))
return req
示例5: __init__
def __init__(self, *args, **kwargs):
'''
initialize the test class
'''
TestCase.__init__(self, *args, **kwargs)
LOG.error("ConfigFile: %s " % config['__file__'])
conffile = config['__file__']
if pylons.test.pylonsapp:
wsgiapp = pylons.test.pylonsapp
else:
wsgiapp = loadapp('config: %s' % config['__file__'])
self.app = TestApp(wsgiapp)
conf = None
if conffile.startswith('/'):
conf = appconfig('config:%s' % config['__file__'], relative_to=None)
else:
raise Exception('dont know how to load the application relatively')
#conf = appconfig('config: %s' % config['__file__'], relative_to=rel)
load_environment(conf.global_conf, conf.local_conf)
self.appconf = conf
url._push_object(URLGenerator(config['routes.map'], environ))
self.isSelfTest = False
if env.has_key("privacyidea.selfTest"):
self.isSelfTest = True
self.license = 'CE'
return
示例6: __init__
def __init__(self, *args, **kwargs):
""" TestController init """
wsgiapp = pylons.test.pylonsapp
config = wsgiapp.config
self.app = TestApp(wsgiapp)
url._push_object(URLGenerator(config['routes.map'], environ))
TestCase.__init__(self, *args, **kwargs)
示例7: __init__
def __init__(self, *args, **kwargs):
wsgiapp = pylons.test.pylonsapp
config = wsgiapp.config
self.app = webtest.TestApp(wsgiapp)
url._push_object(URLGenerator(config['routes.map'], environ))
self.__setattrs__()
self.__setcreateparams__()
TestCase.__init__(self, *args, **kwargs)
示例8: __init__
def __init__(self, *args, **kwargs):
import sys
self.wsgiapp = pylons.test.pylonsapp
self.config = self.wsgiapp.config
self.app = fixture.TestApp(self.wsgiapp)
url._push_object(URLGenerator(self.config['routes.map'], environ))
TestRollback.__init__(self, *args, **kwargs)
示例9: __init__
def __init__(self, *args, **kwargs):
wsgiapp = pylons.test.pylonsapp
config = wsgiapp.config
self.app = OptionsTestApp(wsgiapp)
url._push_object(URLGenerator(config['routes.map'], environ))
TestCase.__init__(self, *args, **kwargs)
self.from_date = datetime(1990,1,1).isoformat() + "Z"
self.controllerName = None
示例10: __init__
def __init__(self, *args, **kwargs):
wsgiapp = pylons.test.pylonsapp
config = wsgiapp.application.config
self.config = config
self.app = TestApp(wsgiapp)
self.g = self.config['pylons.app_globals']
url._push_object(URLGenerator(config['routes.map'], environ))
TestCase.__init__(self, *args, **kwargs)
示例11: __init__
def __init__(self, *args, **kwargs):
wsgiapp = pylons.test.pylonsapp
config = wsgiapp.config
self.app = TestApp(wsgiapp)
url._push_object(URLGenerator(config['routes.map'], environ))
TestCase.__init__(self, *args, **kwargs)
self.pkey, self.cert = _generate_mock_cert()
示例12: __init__
def __init__(self, *args, **kwargs):
self.authz_file = os.path.dirname(__file__) + '/../../config/svn.access.test'
wsgiapp = pylons.test.pylonsapp
config = wsgiapp.config
self.app = TestApp(wsgiapp)
url._push_object(URLGenerator(config['routes.map'], environ))
TestCase.__init__(self, *args, **kwargs)
示例13: __init__
def __init__(self, *args, **kwargs):
wsgiapp = pylons.test.pylonsapp
config = wsgiapp.config
self.app = TestApp(wsgiapp)
url._push_object(URLGenerator(config['routes.map'], environ))
self.Session = Session
self.index_location = config['app_conf']['index_dir']
TestCase.__init__(self, *args, **kwargs)
示例14: __init__
def __init__(self, *args, **kwargs):
#~ if pylons.test.pylonsapp:
#~ wsgiapp = pylons.test.pylonsapp
#~ else:
#~ wsgiapp = loadapp('config:%s' % config['__file__'])
wsgiapp = pylons.test.pylonsapp
self.config = wsgiapp.config
self.app = TestApp(wsgiapp)
url._push_object(URLGenerator(self.config['routes.map'], environ))
TestCase.__init__(self, *args, **kwargs)
示例15: __init__
def __init__(self, *args, **kwargs):
wsgiapp = pylons.test.pylonsapp
config = wsgiapp.config
self.app = TestApp(wsgiapp)
url._push_object(URLGenerator(config['routes.map'], environ))
# should perhaps be in setup
pylons.app_globals._push_object(Globals(config))
# pylons.app_globals._pop_object() # should perhaps be in teardown
super(TestControllerBase, self).__init__(*args, **kwargs)