当前位置: 首页>>代码示例>>Python>>正文


Python Folder.stowaway方法代码示例

本文整理汇总了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()
开发者ID:goschtl,项目名称:zope,代码行数:28,代码来源:zope2testbase.py

示例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()
开发者ID:goschtl,项目名称:zope,代码行数:26,代码来源:zope2testbase.py


注:本文中的OFS.Folder.Folder.stowaway方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。