本文整理汇总了Python中MaKaC.rb_location.Location.getDefaultLocation方法的典型用法代码示例。如果您正苦于以下问题:Python Location.getDefaultLocation方法的具体用法?Python Location.getDefaultLocation怎么用?Python Location.getDefaultLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MaKaC.rb_location.Location
的用法示例。
在下文中一共展示了Location.getDefaultLocation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: removeEquipment
# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import getDefaultLocation [as 别名]
def removeEquipment( equipmentName, *args, **kwargs ):
from MaKaC.rb_location import Location
location = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
lst = EquipmentManager.getRoot()
lst[location].remove( equipmentName )
Factory.getDALManager().getRoot()[_EQUIPMENT_LIST] = lst
示例2: getNumberOfReservableRooms
# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import getDefaultLocation [as 别名]
def getNumberOfReservableRooms( *args, **kwargs ):
""" Documentation in base class. """
location = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
room = Factory.newRoom()
room.isReservable = True
room.isActive = True
return Room.countRooms( roomExample = room, location = location )
示例3: testReservationSpecificBlockingMethods
# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import getDefaultLocation [as 别名]
def testReservationSpecificBlockingMethods(self):
block = self._createTestBlocking()
candResv = Location.getDefaultLocation().factory.newReservation()
candResv.startDT = datetime.combine(block.startDate - timedelta(days=1), time())
candResv.endDT = datetime.combine(block.endDate + timedelta(days=1), time(23, 59))
candResv.repeatability = RepeatabilityEnum.daily
candResv.isConfirmed = None
candResv.room = self._room7
self.assertTrue(candResv.getBlockingConflictState() is None) # No blocking
self.assertEqual(candResv.getBlockedDates(), [])
br = self._blockRoom(block, self._room7, False)
block.update()
self.assertEqual(candResv.getBlockingConflictState(), 'pending') # Pending blocking
self.assertEqual(candResv.getBlockedDates(), [])
br.approve(sendNotification=False)
self.assertEqual(candResv.getBlockingConflictState(), 'active') # Active blocking
blockingDays = frozenset((date(2010, 12, 31), date(2011, 1, 1)))
self.assertEqual(frozenset(candResv.getBlockedDates()), blockingDays)
# Test with various users set. This basically tests if all people who are allowed to override can actually override
self.assertTrue(candResv.getBlockingConflictState(self._avatar1) is None) # room owner
self.assertEqual(candResv.getBlockedDates(self._avatar1), [])
self.assertTrue(candResv.getBlockingConflictState(self._avatar2) is None) # blocking owner
self.assertEqual(candResv.getBlockedDates(self._avatar2), [])
self.assertEqual(candResv.getBlockingConflictState(self._avatar3), 'active') # not permitted to override
self.assertEqual(frozenset(candResv.getBlockedDates(self._avatar3)), blockingDays)
self.assertTrue(candResv.getBlockingConflictState(self._avatar4) is None) # on blocking ACL
self.assertEqual(candResv.getBlockedDates(self._avatar4), [])
# Rejecting an existing blocking is not possible via the UI, but we can test it anyway
br.reject(sendNotification=False)
self.assertTrue(candResv.getBlockingConflictState() is None) # No blocking
self.assertEqual(candResv.getBlockedDates(), [])
示例4: setPossibleEquipment
# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import getDefaultLocation [as 别名]
def setPossibleEquipment( equipmentList, *args, **kwargs ):
from MaKaC.rb_location import Location
location = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
lst = EquipmentManager.getRoot()
lst[location] = equipmentList
Factory.getDALManager().getRoot()[_EQUIPMENT_LIST] = lst # Force update
示例5: getNumberOfActiveRooms
# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import getDefaultLocation [as 别名]
def getNumberOfActiveRooms( **kwargs ):
"""
FINAL (not intented to be overriden)
Returns number of rooms that are active (not logicaly deleted).
"""
name = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
location = Location.parse(name)
return location.factory.newRoom().getNumberOfActiveRooms(location=name)
示例6: getNumberOfReservableRooms
# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import getDefaultLocation [as 别名]
def getNumberOfReservableRooms( **kwargs ):
"""
FINAL (not intented to be overriden)
Returns number of rooms which can be reserved.
"""
name = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
location = Location.parse(name)
return location.factory.newRoom().getNumberOfReservableRooms(location=name)
示例7: getNumberOfRooms
# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import getDefaultLocation [as 别名]
def getNumberOfRooms( **kwargs ):
"""
FINAL (not intented to be overriden)
Returns total number of rooms in database.
"""
name = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
location = Location.parse(name)
return location.factory.newRoom().getNumberOfRooms(location=name)
示例8: insertEquipment
# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import getDefaultLocation [as 别名]
def insertEquipment( equipmentName, *args, **kwargs ):
from MaKaC.rb_location import Location
location = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
lst = EquipmentManager.getRoot()
if lst.get( location ) == None:
lst[location] = []
lst[location].append( equipmentName )
Factory.getDALManager().getRoot()[_EQUIPMENT_LIST] = lst
示例9: getPossibleEquipment
# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import getDefaultLocation [as 别名]
def getPossibleEquipment( *args, **kwargs ):
from MaKaC.rb_location import Location
location = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
lst = EquipmentManager.getRoot()
if lst.get( location ) == None:
lst[location] = []
Factory.getDALManager().getRoot()[_EQUIPMENT_LIST] = lst
return lst[location]
示例10: getAttributes
# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import getDefaultLocation [as 别名]
def getAttributes( *args, **kwargs ):
location = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
root = CustomAttributesManager.getRoot()
if not root.has_key( location ):
CustomAttributesManager.setAttributes( [], location = location )
return CustomAttributesManager.getRoot()[location]
示例11: removeAttribute
# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import getDefaultLocation [as 别名]
def removeAttribute( customAttributeName, *args, **kwargs ):
""" Deletes attribute from the list of custom attributes. """
location = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
attsList = CustomAttributesManager.getAttributes( location = location )
for at in attsList:
if at['name'] == customAttributeName:
attsList.remove( at )
break;
CustomAttributesManager.setAttributes( attsList, location = location )
示例12: setRequired
# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import getDefaultLocation [as 别名]
def setRequired( customAttributeName, isRequired, *args, **kwargs ):
""" Makes attribute required."""
location = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
attsList = CustomAttributesManager.getAttributes( location = location )
for at in attsList:
if at['name'] == customAttributeName:
at['required'] = isRequired
break;
CustomAttributesManager.setAttributes( attsList, location = location )
示例13: setHidden
# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import getDefaultLocation [as 别名]
def setHidden( customAttributeName, isHidden, *args, **kwargs ):
""" Makes attribute hidden."""
location = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
attsList = CustomAttributesManager.getAttributes( location = location )
for at in attsList:
if at['name'] == customAttributeName:
at['hidden'] = isHidden
break;
CustomAttributesManager.setAttributes( attsList, location = location )
示例14: setAttributes
# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import getDefaultLocation [as 别名]
def setAttributes( attsList, *args, **kwargs ):
location = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
for at in attsList:
errors = CustomAttributesManagerBase.checkAttribute( at )
if errors: raise str( errors )
dic = CustomAttributesManager.getRoot()
dic[location] = attsList
root = Factory.getDALManager().root
root[_CUSTOM_ATTRIBUTES_LIST] = dic
示例15: insertAttribute
# 需要导入模块: from MaKaC.rb_location import Location [as 别名]
# 或者: from MaKaC.rb_location.Location import getDefaultLocation [as 别名]
def insertAttribute( customAttribute, *args, **kwargs ):
""" Adds new attribute to the list of custom attributes."""
location = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
errors = []
errors = CustomAttributesManagerBase.checkAttribute( customAttribute )
if errors: raise str( errors )
attsList = CustomAttributesManager.getAttributes( location = location )
attsList.append( customAttribute )
CustomAttributesManager.setAttributes( attsList, location = location )