本文整理汇总了Python中transaction.Transaction.note方法的典型用法代码示例。如果您正苦于以下问题:Python Transaction.note方法的具体用法?Python Transaction.note怎么用?Python Transaction.note使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类transaction.Transaction
的用法示例。
在下文中一共展示了Transaction.note方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checkUndoInvalidation
# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import note [as 别名]
def checkUndoInvalidation(self):
oid = self._storage.new_oid()
revid = self._dostore(oid, data=MinPO(23))
revid = self._dostore(oid, revid=revid, data=MinPO(24))
revid = self._dostore(oid, revid=revid, data=MinPO(25))
info = self._storage.undoInfo()
if not info:
# Preserved this comment, but don't understand it:
# "Perhaps we have an old storage implementation that
# does do the negative nonsense."
info = self._storage.undoInfo(0, 20)
tid = info[0]['id']
# Now start an undo transaction
t = Transaction()
t.note('undo1')
oids = self._begin_undos_vote(t, tid)
# Make sure this doesn't load invalid data into the cache
self._storage.load(oid, '')
self._storage.tpc_finish(t)
assert len(oids) == 1
assert oids[0] == oid
data, revid = self._storage.load(oid, '')
obj = zodb_unpickle(data)
assert obj == MinPO(24)
示例2: undo
# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import note [as 别名]
def undo(self, tid, note=None):
t = Transaction()
if note is not None:
t.note(note)
oids = self._begin_undos_vote(t, tid)
self._storage.tpc_finish(t)
return oids
示例3: undo
# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import note [as 别名]
def undo(self, tid, note):
t = Transaction()
t.note(note)
self._storage.tpc_begin(t)
oids = self._storage.undo(tid, t)
self._storage.tpc_vote(t)
self._storage.tpc_finish(t)
return oids
示例4: checkCreationUndoneGetTid
# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import note [as 别名]
def checkCreationUndoneGetTid(self):
# create an object
oid = self._storage.new_oid()
self._dostore(oid, data=MinPO(23))
# undo its creation
info = self._storage.undoInfo()
tid = info[0]['id']
t = Transaction()
t.note('undo1')
self._begin_undos_vote(t, tid)
self._storage.tpc_finish(t)
# Check that calling getTid on an uncreated object raises a KeyError
# The current version of FileStorage fails this test
self.assertRaises(KeyError, self._storage.getTid, oid)