Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 8
0
 def __new__(cls, env, name):
     self = str.__new__(cls, name)
     self._env = weakproxy(env)
     self.format = Format(name)
     return self
Esempio n. 9
0
 def __init__(self, template, locals={}):
     self.__locals = locals
     self.__template = weakproxy(template)
Esempio n. 10
0
 def __init__(self, template, locals={}):
     self.__locals = locals
     self.__template = weakproxy(template)