Exemplo n.º 1
0
 def __getattribute__(self, name):
     if name == 'level':
         return Base.__getattribute__(self, name)
     _dict = Base.__getattribute__(self, '_dict')
     if _dict:
         try:
             return _dict[name]
         except KeyError:
             pass
     return Base.__getattribute__(self, name)
 def __getattribute__(self, name):
     if name == 'level':
         return Base.__getattribute__(self, name)
     _dict = Base.__getattribute__(self, '_dict')
     if _dict:
         try:
             return _dict[name]
         except KeyError:
             pass
     return Base.__getattribute__(self, name)
Exemplo n.º 3
0
 def __repr__(self):
     """Show the physical path of the object and its context if available.
     """
     try:
         path = '/'.join(self.getPhysicalPath())
     except:
         return Base.__repr__(self)
     context_path = None
     context = aq_parent(self)
     container = aq_parent(aq_inner(self))
     if aq_base(context) is not aq_base(container):
         try:
             context_path = '/'.join(context.getPhysicalPath())
         except:
             context_path = None
     res = '<%s' % self.__class__.__name__
     res += ' at %s' % path
     if context_path:
         res += ' used for %s' % context_path
     res += '>'
     return res
Exemplo n.º 4
0
 def __repr__(self):
     """Show the physical path of the object and its context if available.
     """
     try:
         path = '/'.join(self.getPhysicalPath())
     except:
         return Base.__repr__(self)
     context_path = None
     context = aq_parent(self)
     container = aq_parent(aq_inner(self))
     if aq_base(context) is not aq_base(container):
         try:
             context_path = '/'.join(context.getPhysicalPath())
         except:
             context_path = None
     res = '<%s' % self.__class__.__name__
     res += ' at %s' % path
     if context_path:
         res += ' used for %s' % context_path
     res += '>'
     return res
Exemplo n.º 5
0
 def __new__(cls, x, y):
     r = Base.__new__(cls)
     r.x, r.y = x, y
     return r
Exemplo n.º 6
0
from unittest import TestSuite
from unittest import makeSuite

from six import StringIO

from ExtensionClass import Base
from Shared.DC.ZRDB import RDB
from Shared.DC.ZRDB.Results import Results


class Brain(Base):
    def __init__(self, *args):
        pass


Parent = Base()


class TestResults(TestCase):
    def test_results(self):
        r = Results(([{
            'name': 'foo',
            'type': 'integer'
        }, {
            'name': 'bar',
            'type': 'integer'
        }], ((1, 2), (3, 4))),
                    brains=Brain,
                    parent=Parent)
        self.assertEqual(len(r), 2)
        row = r[0]
Exemplo n.º 7
0
 def __new__(cls, data=None, parent=None):
     obj = Base.__new__(cls)
     obj.__setstate__(data)
     return obj
Exemplo n.º 8
0
 def __new__(cls, data=None, parent=None):
     obj = Base.__new__(cls)
     obj.__setstate__(data)
     return obj