コード例 #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)
コード例 #2
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)
コード例 #3
0
ファイル: SimpleItem.py プロジェクト: vedantc98/Plone-test
 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
コード例 #4
0
ファイル: SimpleItem.py プロジェクト: CedricEdouardKassi/Zope
 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
コード例 #5
0
ファイル: tests.py プロジェクト: denishom12/decorator
 def __new__(cls, x, y):
     r = Base.__new__(cls)
     r.x, r.y = x, y
     return r
コード例 #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]
コード例 #7
0
ファイル: __init__.py プロジェクト: zopefoundation/Record
 def __new__(cls, data=None, parent=None):
     obj = Base.__new__(cls)
     obj.__setstate__(data)
     return obj
コード例 #8
0
 def __new__(cls, data=None, parent=None):
     obj = Base.__new__(cls)
     obj.__setstate__(data)
     return obj