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


Python Factory.newRoomBlocking方法代码示例

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


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

示例1: testIndexes

# 需要导入模块: from MaKaC.rb_factory import Factory [as 别名]
# 或者: from MaKaC.rb_factory.Factory import newRoomBlocking [as 别名]
 def testIndexes(self):
     block = self._createTestBlocking()
     block2 = Factory.newRoomBlocking()()
     block2.startDate = date(2011, 1, 1)
     block2.endDate = date(2011, 1, 10)
     block2.createdByUser = self._avatar3
     block2.message = 'Testing 2'
     self._blockRoom(block2, self._room1)
     block2.insert()
     # Test if all indexes work properly
     self.assertEqual(frozenset(RoomBlockingBase.getAll()), frozenset((block, block2)))
     self.assertTrue(RoomBlockingBase.getById(0) is None)
     self.assertEqual(RoomBlockingBase.getById(1), block)
     self.assertEqual(RoomBlockingBase.getById(2), block2)
     self.assertTrue(not RoomBlockingBase.getByOwner(self._dummy))
     self.assertTrue(not RoomBlockingBase.getByOwner(self._avatar1))
     self.assertEqual(frozenset(RoomBlockingBase.getByOwner(self._avatar2)), frozenset((block,)))
     self.assertEqual(frozenset(RoomBlockingBase.getByOwner(self._avatar3)), frozenset((block2,)))
     self.assertTrue(not RoomBlockingBase.getByRoom(self._room5))
     self.assertEqual(frozenset(RoomBlockingBase.getByRoom(self._room1)),
                      frozenset((block.getBlockedRoom(self._room1), block2.getBlockedRoom(self._room1))))
     self.assertEqual(frozenset(RoomBlockingBase.getByRoom(self._room2)),
                      frozenset((block.getBlockedRoom(self._room2),)))
     self.assertTrue(block2.getBlockedRoom(self._room2) is None)
     self.assertEqual(frozenset(RoomBlockingBase.getByDate(date(2010, 12, 31))), frozenset((block,)))
     self.assertEqual(frozenset(RoomBlockingBase.getByDate(date(2011, 1, 1))), frozenset((block, block2)))
     self.assertEqual(frozenset(RoomBlockingBase.getByDate(date(2011, 1, 2))), frozenset((block2,)))
     self.assertEqual(frozenset(RoomBlockingBase.getByDateSpan(date(2011, 1, 1), date(2011, 1, 2))),
                      frozenset((block, block2)))
     self.assertEqual(frozenset(RoomBlockingBase.getByDateSpan(date(2011, 1, 2), date(2011, 2, 1))),
                      frozenset((block2,)))
     self.assertTrue(not RoomBlockingBase.getByDateSpan(date(2011, 2, 1), date(2012, 1, 1)))
     # Remove a block
     block.remove()
     self.assertEqual(len(RoomBlockingBase.getAll()), 1)
     self.assertTrue(RoomBlockingBase.getById(block.id) is None)
     self.assertTrue(not RoomBlockingBase.getByOwner(self._avatar2))
     self.assertEqual(frozenset(RoomBlockingBase.getByRoom(self._room1)),
                      frozenset((block2.getBlockedRoom(self._room1),)))
     self.assertTrue(not RoomBlockingBase.getByRoom(self._room2))
     self.assertTrue(not RoomBlockingBase.getByDate(date(2010, 12, 31)))
     self.assertEqual(frozenset(RoomBlockingBase.getByDate(date(2011, 1, 1))), frozenset((block2,)))
     self.assertEqual(frozenset(RoomBlockingBase.getByDate(date(2011, 1, 2))), frozenset((block2,)))
     # Add a blocked room
     br = self._blockRoom(block2, self._room2)
     block2.addBlockedRoom(br)
     # When adding a blocked room, update() may be (and is) required for it to beindexed
     block2.update()
     self.assertEqual(frozenset(RoomBlockingBase.getByRoom(self._room2)),
                      frozenset((block2.getBlockedRoom(self._room2),)))
     self.assertEqual(frozenset(RoomBlockingBase.getByRoom(self._room1)),
                      frozenset((block2.getBlockedRoom(self._room1),)))
     block2.delBlockedRoom(block2.getBlockedRoom(self._room1))
     # Deletion has to update indexes immediately as the object will no longer be reachable from its parent block
     self.assertTrue(not RoomBlockingBase.getByRoom(self._room1))
     block2.update()
     self.assertTrue(not RoomBlockingBase.getByRoom(self._room1))
开发者ID:iason-andr,项目名称:indico,代码行数:59,代码来源:roomblocking_test.py

示例2: _createTestBlocking

# 需要导入模块: from MaKaC.rb_factory import Factory [as 别名]
# 或者: from MaKaC.rb_factory.Factory import newRoomBlocking [as 别名]
 def _createTestBlocking(self):
     block = Factory.newRoomBlocking()()
     block.startDate = date(2010, 12, 31)
     block.endDate = date(2011, 1, 1)
     block.createdByUser = self._avatar2
     block.addAllowed(self._avatar4)
     block.message = 'Testing'
     self._blockRoom(block, self._room1)
     self._blockRoom(block, self._room2)
     self._blockRoom(block, self._room3)
     self._blockRoom(block, self._room4)
     self._blockRoom(block, self._room6)
     block.insert()
     return block
开发者ID:iason-andr,项目名称:indico,代码行数:16,代码来源:roomblocking_test.py

示例3: getByDateSpan

# 需要导入模块: from MaKaC.rb_factory import Factory [as 别名]
# 或者: from MaKaC.rb_factory.Factory import newRoomBlocking [as 别名]
 def getByDateSpan(begin, end):
     return Factory.newRoomBlocking().getByDateSpan(begin, end)
开发者ID:VishrutMehta,项目名称:indico,代码行数:4,代码来源:rb_roomblocking.py

示例4: getByDate

# 需要导入模块: from MaKaC.rb_factory import Factory [as 别名]
# 或者: from MaKaC.rb_factory.Factory import newRoomBlocking [as 别名]
 def getByDate(date):
     return Factory.newRoomBlocking().getByDate(date)
开发者ID:VishrutMehta,项目名称:indico,代码行数:4,代码来源:rb_roomblocking.py

示例5: getByRoom

# 需要导入模块: from MaKaC.rb_factory import Factory [as 别名]
# 或者: from MaKaC.rb_factory.Factory import newRoomBlocking [as 别名]
 def getByRoom(room, active=-1):
     return Factory.newRoomBlocking().getByRoom(room, active)
开发者ID:VishrutMehta,项目名称:indico,代码行数:4,代码来源:rb_roomblocking.py

示例6: getByOwner

# 需要导入模块: from MaKaC.rb_factory import Factory [as 别名]
# 或者: from MaKaC.rb_factory.Factory import newRoomBlocking [as 别名]
 def getByOwner(owner):
     return Factory.newRoomBlocking().getByOwner(owner)
开发者ID:VishrutMehta,项目名称:indico,代码行数:4,代码来源:rb_roomblocking.py

示例7: getById

# 需要导入模块: from MaKaC.rb_factory import Factory [as 别名]
# 或者: from MaKaC.rb_factory.Factory import newRoomBlocking [as 别名]
 def getById(id):
     return Factory.newRoomBlocking().getById(id)
开发者ID:VishrutMehta,项目名称:indico,代码行数:4,代码来源:rb_roomblocking.py

示例8: getAll

# 需要导入模块: from MaKaC.rb_factory import Factory [as 别名]
# 或者: from MaKaC.rb_factory.Factory import newRoomBlocking [as 别名]
 def getAll():
     return Factory.newRoomBlocking().getAll()
开发者ID:VishrutMehta,项目名称:indico,代码行数:4,代码来源:rb_roomblocking.py

示例9: getTotalCount

# 需要导入模块: from MaKaC.rb_factory import Factory [as 别名]
# 或者: from MaKaC.rb_factory.Factory import newRoomBlocking [as 别名]
 def getTotalCount():
     return Factory.newRoomBlocking().getTotalCount()
开发者ID:VishrutMehta,项目名称:indico,代码行数:4,代码来源:rb_roomblocking.py


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