Beispiel #1
0
 def setUp(self):
     from pyramid.registry import Registry
     registry = Registry('testing')
     self.config = testing.setUp(registry=registry)
     self.config.begin()
     from zope.deprecation import __show__
     __show__.off()
Beispiel #2
0
 def setUp(self):
     from pyramid.registry import Registry
     registry = Registry('testing')
     self.config = testing.setUp(registry=registry)
     self.config.begin()
     from zope.deprecation import __show__
     __show__.off()
Beispiel #3
0
 def setUp(self):
     from pyramid.threadlocal import manager
     from pyramid.registry import Registry
     manager.clear()
     registry = Registry('testing')
     self.registry = registry
     manager.push({'registry': registry, 'request': None})
     from zope.deprecation import __show__
     __show__.off()
Beispiel #4
0
 def setUp(self):
     from pyramid.threadlocal import manager
     from pyramid.registry import Registry
     manager.clear()
     registry = Registry('testing')
     self.registry = registry
     manager.push({'registry':registry, 'request':None})
     from zope.deprecation import __show__
     __show__.off()
 def setUp(self):
     cleanUp()
     import os
     try:
         # avoid spew from chameleon logger?
         os.unlink(self._getTemplatePath('minimal.txt.py'))
     except:
         pass
     from zope.deprecation import __show__
     __show__.off()
Beispiel #6
0
 def test_backward_compat_delegates_to_mixin(self):
     from zope.deprecation import __show__
     try:
         __show__.off()
         request = _makeFakeRequest()
         from pyramid.security import authenticated_userid
         self.assertEqual(authenticated_userid(request),
                          'authenticated_userid')
     finally:
         __show__.on()
Beispiel #7
0
 def test_backward_compat_delegates_to_mixin(self):
     request = _makeFakeRequest()
     from zope.deprecation import __show__
     try:
         __show__.off()
         from pyramid.security import effective_principals
         self.assertEqual(effective_principals(request),
                          'effective_principals')
     finally:
         __show__.on()
Beispiel #8
0
 def test_backward_compat_delegates_to_mixin(self):
     request = _makeFakeRequest()
     from zope.deprecation import __show__
     try:
         __show__.off()
         from pyramid.security import effective_principals
         self.assertEqual(
             effective_principals(request),
             'effective_principals'
             )
     finally:
         __show__.on()
Beispiel #9
0
 def test_backward_compat_delegates_to_mixin(self):
     from zope.deprecation import __show__
     try:
         __show__.off()
         request = _makeFakeRequest()
         from pyramid.security import unauthenticated_userid
         self.assertEqual(
             unauthenticated_userid(request),
             'unauthenticated_userid',
             )
     finally:
         __show__.on()
Beispiel #10
0
    def test_delegates_to_mixin(self):
        from zope.deprecation import __show__
        try:
            __show__.off()
            mixin = self._makeOne()
            from pyramid.security import has_permission
            self.called_has_permission = False

            def mocked_has_permission(*args, **kw):
                self.called_has_permission = True

            mixin.has_permission = mocked_has_permission
            has_permission('view', object(), mixin)
            self.assertTrue(self.called_has_permission)
        finally:
            __show__.on()
Beispiel #11
0
    def test_delegates_to_mixin(self):
        from zope.deprecation import __show__
        try:
            __show__.off()
            mixin = self._makeOne()
            from pyramid.security import has_permission
            self.called_has_permission = False

            def mocked_has_permission(*args, **kw):
                self.called_has_permission = True

            mixin.has_permission = mocked_has_permission
            has_permission('view', object(), mixin)
            self.assertTrue(self.called_has_permission)
        finally:
            __show__.on()
Beispiel #12
0
 def setUp(self):
     from zope.deprecation import __show__
     __show__.off()
     testing.setUp()
     self.tempdir = None
     import sys
     import os
     import tempfile
     from pyramid.path import package_path
     from pyramid.tests import fixtureapp as package
     import shutil
     tempdir = tempfile.mkdtemp()
     modname = 'myfixture%s' % self.i
     self.i += 1
     self.packagepath = os.path.join(tempdir, modname)
     fixturedir = package_path(package)
     shutil.copytree(fixturedir, self.packagepath)
     sys.path.insert(0, tempdir)
     self.module = __import__(modname)
     self.tempdir = tempdir
Beispiel #13
0
 def setUp(self):
     from zope.deprecation import __show__
     __show__.off()
Beispiel #14
0
 def setUp(self):
     super(TestUnencryptedCookieSession, self).setUp()
     from zope.deprecation import __show__
     __show__.off()
 def setUp(self):
     from zope.deprecation import __show__
     __show__.off()
class IChameleonLookup(Interface):
    translate = Attribute('IChameleonTranslate object')
    debug = Attribute('The ``debug_templates`` setting for this application')
    auto_reload = Attribute('The ``reload_templates`` setting for this app')
    def __call__(self, info):
        """ Return an ITemplateRenderer based on IRendererInfo ``info`` """

class IChameleonTranslate(Interface):
    """ Internal interface representing a chameleon translate function """
    def __call__(msgid, domain=None, mapping=None, context=None,
                 target_language=None, default=None):
        """ Translate a mess of arguments to a Unicode object """

from zope.deprecation import __show__
__show__.off()
try:
    # For backwards compatibility, as long as ITemplateRenderer
    # exists, we will still implement that.
    from pyramid.interfaces import ITemplateRenderer
    class IChameleonTemplateRenderer(ITemplateRenderer):
        "Chameleon-specific template renderer"
except ImportError:
    from pyramid.interfaces import IRenderer
    class IChameleonTemplateRenderer(IRenderer):
        "Chameleon-specific template renderer"
        def implementation():
            """ Return the object that the underlying templating system
            uses to render the template; it is typically a callable that
            accepts arbitrary keyword arguments and returns a string or
            unicode object """
 def setUp(self):
     super(TestUnencryptedCookieSession, self).setUp()
     from zope.deprecation import __show__
     __show__.off()
Beispiel #18
0
 def setUp(self):
     from zope.deprecation import __show__
     __show__.off()
     self.config = cleanUp()
Beispiel #19
0
 def setUp(self):
     self.config = testing.setUp()
     from zope.deprecation import __show__
     __show__.off()
Beispiel #20
0
 def setUp(self):
     self.config = testing.setUp()
     from zope.deprecation import __show__
     __show__.off()
Beispiel #21
0
        """ Return an ITemplateRenderer based on IRendererInfo ``info`` """


class IChameleonTranslate(Interface):
    """ Internal interface representing a chameleon translate function """
    def __call__(msgid,
                 domain=None,
                 mapping=None,
                 context=None,
                 target_language=None,
                 default=None):
        """ Translate a mess of arguments to a Unicode object """


from zope.deprecation import __show__
__show__.off()
try:
    # For backwards compatibility, as long as ITemplateRenderer
    # exists, we will still implement that.
    from pyramid.interfaces import ITemplateRenderer

    class IChameleonTemplateRenderer(ITemplateRenderer):
        "Chameleon-specific template renderer"
except ImportError:
    from pyramid.interfaces import IRenderer

    class IChameleonTemplateRenderer(IRenderer):
        "Chameleon-specific template renderer"

        def implementation():
            """ Return the object that the underlying templating system