Beispiel #1
0
 def test_weakproxy(self):
     # Immutable objects that can't be weakly referenced
     o = object()
     self.assertIs(weakproxy(o), o)
     # The rest objects
     class C(object):
         pass
     o = C()
     p = weakproxy(o)
     o.a = object()
     self.assertIs(p.a, o.a)
     del o
     with self.assertRaises(ReferenceError):
         p.a
Beispiel #2
0
 def test_weakproxy(self):
     # Immutable objects that can't be weakly referenced
     o = object()
     self.assertIs(weakproxy(o), o)
     # The rest objects
     class C(object):
         pass
     o = C()
     p = weakproxy(o)
     o.a = object()
     self.assertIs(p.a, o.a)
     del o
     with self.assertRaises(ReferenceError):
         p.a
Beispiel #3
0
 def __init__(self,
              title,
              link=None,
              endpoint=None,
              params=None,
              items=None,
              env=None,
              template_vars={},
              template=None,
              permissions={'*': 'rwxcd'},
              rel=None):
     self.parent = None
     self.title = title
     self.link = link
     self.endpoint = endpoint
     self.params = params or {}
     self.items = list(filter(None, items or []))
     self._env = env
     self.template = template or self.template
     self.template_vars = template_vars
     self.perms = {'wheel': 'rwxcd'}
     self.perms.update(permissions)
     for item in self.items:
         item.parent = weakproxy(self)
     self.rel = self.rel or rel
Beispiel #4
0
 def __init__(self, loner_name, title=None, items=None,
              template_vars={}, env=None, template=None):
     self.loner_name = loner_name
     if title is not None:
         self.title = title
     self.items = items or []
     self.template = template or self.template
     self.template_vars = template_vars
     self._env = env
     for item in self.items:
         item.parent = weakproxy(self)
Beispiel #5
0
 def __init__(self, stream_name, title=None, create=True,
              filters=None, items=None, template_vars={},
              env=None, template=None):
     self.stream_name = stream_name
     if title is not None:
         self.title = title
     self.create = create
     self.filters = filters or {}
     self.items = items or []
     self.template = template or self.template
     self.template_vars = template_vars
     self._env = env
     for item in self.items:
         item.parent = weakproxy(self)
Beispiel #6
0
 def __init__(self, title, link=None, endpoint=None, params=None,
              items=None, env=None, template_vars={}, template=None,
              permissions= {'*': 'rwxcd'}):
     self.parent = None
     self.title = title
     self.link = link
     self.endpoint = endpoint
     self.params = params or {}
     self.items = filter(None, items or [])
     self._env = env
     self.template = template or self.template
     self.template_vars = template_vars
     self.perms = {'wheel': 'rwxcd'}
     self.perms.update(permissions)
     for item in self.items:
         item.parent = weakproxy(self)
Beispiel #7
0
 def __init__(self,
              stream_name,
              title=None,
              create=True,
              filters=None,
              items=None,
              template_vars={},
              env=None,
              template=None):
     self.stream_name = stream_name
     if title is not None:
         self.title = title
     self.create = create
     self.filters = filters or {}
     self.items = items or []
     self.template = template or self.template
     self.template_vars = template_vars
     self._env = env
     for item in self.items:
         item.parent = weakproxy(self)
Beispiel #8
0
 def __new__(cls, env, name):
     self = str.__new__(cls, name)
     self._env = weakproxy(env)
     self.format = Format(name)
     return self
Beispiel #9
0
 def __init__(self, template, locals={}):
     self.__locals = locals
     self.__template = weakproxy(template)
Beispiel #10
0
 def __init__(self, template, locals={}):
     self.__locals = locals
     self.__template = weakproxy(template)