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


Python Connection.get_root()['A']方法代码示例

本文整理汇总了Python中durus.connection.Connection.get_root()['A']方法的典型用法代码示例。如果您正苦于以下问题:Python Connection.get_root()['A']方法的具体用法?Python Connection.get_root()['A']怎么用?Python Connection.get_root()['A']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在durus.connection.Connection的用法示例。


在下文中一共展示了Connection.get_root()['A']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _scenario

# 需要导入模块: from durus.connection import Connection [as 别名]
# 或者: from durus.connection.Connection import get_root()['A'] [as 别名]
 def _scenario(self):
     c1 = Connection(self._get_storage())
     c2 = Connection(self._get_storage())
     c1.get_root()['A'] = Persistent()
     c1.get_root()['B'] = Persistent()
     c1.get_root()['A'].a = 1
     c1.commit()
     c2.abort()
     c1.cache.recent_objects.discard(c1.get_root()['A'])
     # Imagine c1 has been running for a while, and
     # cache management, for example, has caused the
     # cache reference to be weak.
     return c1, c2
开发者ID:Schevo,项目名称:durus,代码行数:15,代码来源:utest_connection.py

示例2: check_fine_conflict

# 需要导入模块: from durus.connection import Connection [as 别名]
# 或者: from durus.connection.Connection import get_root()['A'] [as 别名]
 def check_fine_conflict(self):
     c1 = Connection(self._get_storage())
     c2 = Connection(self._get_storage())
     c1.get_root()['A'] = Persistent()
     c1.get_root()['A'].a = 1
     c1.get_root()['B'] = Persistent()
     c1.commit()
     c2.abort()
     # c1 has A loaded.
     assert not c1.get_root()['A']._p_is_ghost()
     c1.get_root()['B'].b = 1
     c2.get_root()['A'].a = 2
     c2.commit()
     # Even though A has been changed by c2,
     # c1 has not accessed an attribute of A since
     # the last c1.commit(), so we don't want a ConflictError.
     c1.commit()
     assert c1.get_root()['A']._p_is_ghost()
     c1.get_root()['A'].a # accessed!
     c1.get_root()['B'].b = 1
     c2.get_root()['A'].a = 2
     c2.commit()
     raises(WriteConflictError, c1.commit)
开发者ID:Schevo,项目名称:durus,代码行数:25,代码来源:utest_connection.py


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