def checkOldStyleRoot(self):
        # insert the pickle in place of the root
        s = MappingStorage()
        t = Transaction()
        s.tpc_begin(t)
        s.store('\000' * 8, None, pickle, '', t)
        s.tpc_vote(t)
        s.tpc_finish(t)

        db = ZODB.DB(s)
        # If the root can be loaded successfully, we should be okay.
        r = db.open().root()
        # But make sure it looks like a new mapping
        self.assert_(hasattr(r, 'data'))
        self.assert_(not hasattr(r, '_container'))
    def checkOldStyleRoot(self):
        # The Persistence module doesn't exist in Zope3's idea of what ZODB
        # is, but the global `pickle` references it explicitly.  So just
        # bail if Persistence isn't available.
        try:
            import Persistence
        except ImportError:
            return
        # insert the pickle in place of the root
        s = MappingStorage()
        t = Transaction()
        s.tpc_begin(t)
        s.store('\000' * 8, None, pickle, '', t)
        s.tpc_vote(t)
        s.tpc_finish(t)

        db = ZODB.DB(s)
        # If the root can be loaded successfully, we should be okay.
        r = db.open().root()
        # But make sure it looks like a new mapping
        self.assertTrue(hasattr(r, 'data'))
        self.assertTrue(not hasattr(r, '_container'))
Exemple #3
0
    def checkOldStyleRoot(self):
        # The Persistence module doesn't exist in Zope3's idea of what ZODB
        # is, but the global `pickle` references it explicitly.  So just
        # bail if Persistence isn't available.
        try:
            import Persistence
        except ImportError:
            return
        # insert the pickle in place of the root
        s = MappingStorage()
        t = Transaction()
        s.tpc_begin(t)
        s.store('\000' * 8, None, pickle, '', t)
        s.tpc_vote(t)
        s.tpc_finish(t)

        db = ZODB.DB(s)
        # If the root can be loaded successfully, we should be okay.
        r = db.open().root()
        # But make sure it looks like a new mapping
        self.assert_(hasattr(r, 'data'))
        self.assert_(not hasattr(r, '_container'))
 def tpc_begin(self, transaction):
     self.test_transaction = transaction
     return MappingStorage.tpc_begin(self, transaction)
Exemple #5
0
 def tpc_begin(self, transaction):
     self.test_transaction = transaction
     return MappingStorage.tpc_begin(self, transaction)