本文整理汇总了Python中OFS.Folder.Folder.stowaway方法的典型用法代码示例。如果您正苦于以下问题:Python Folder.stowaway方法的具体用法?Python Folder.stowaway怎么用?Python Folder.stowaway使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OFS.Folder.Folder
的用法示例。
在下文中一共展示了Folder.stowaway方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_upo_state_after_deactivate
# 需要导入模块: from OFS.Folder import Folder [as 别名]
# 或者: from OFS.Folder.Folder import stowaway [as 别名]
def test_upo_state_after_deactivate(self):
# An unmanaged persistent object that gets deactivated
# and reactivated should have the most recent state.
self.db.setCacheSize(10) # Don't flush the objects at commit
conn = self.db.open()
try:
app = conn.root()['Application']
f = Folder()
f.id = 'Holidays'
f.stowaway = Folder()
f.stowaway.id = 'stowaway'
f.stowaway._prop = 'value1'
app._setObject(f.id, f, set_owner=0)
transaction.commit()
self.assertEqual(f._p_changed, 0)
self.assertEqual(f.stowaway._p_oid, 'unmanaged')
f.stowaway._prop = 'value2'
transaction.commit()
self.assertEqual(f._p_changed, 0)
del f.stowaway._p_changed
self.assertEqual(f.stowaway._p_changed, None)
self.assertEqual(f.stowaway._prop, 'value2')
finally:
conn.close()
示例2: test_deactivate_unmanaged_persistent
# 需要导入模块: from OFS.Folder import Folder [as 别名]
# 或者: from OFS.Folder.Folder import stowaway [as 别名]
def test_deactivate_unmanaged_persistent(self):
# Some Zope code deactivates unmanaged persistent objects.
# Verify that Ape can handle it.
conn = self.db.open()
try:
app = conn.root()['Application']
f = Folder()
f.id = 'Holidays'
f.stowaway = Folder()
f.stowaway.id = 'stowaway'
f.stowaway._prop = 'value1'
app._setObject(f.id, f, set_owner=0)
transaction.commit()
f.stowaway._p_deactivate()
self.assertEqual(f.stowaway._prop, 'value1')
# Check aborting changes to an unmanaged object.
f.stowaway._prop = 'value2'
self.assertEqual(f._p_changed, 1)
transaction.abort()
self.assertEqual(f.stowaway._prop, 'value1')
self.assertEqual(f._p_changed, 0)
finally:
conn.close()