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


Python rb_location.Location类代码示例

本文整理汇总了Python中MaKaC.rb_location.Location的典型用法代码示例。如果您正苦于以下问题:Python Location类的具体用法?Python Location怎么用?Python Location使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getNumberOfReservableRooms

 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)
开发者ID:vstitches,项目名称:indico,代码行数:8,代码来源:rb_room.py

示例2: getNumberOfRooms

 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)
开发者ID:vstitches,项目名称:indico,代码行数:8,代码来源:rb_room.py

示例3: getNumberOfActiveRooms

 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)
开发者ID:vstitches,项目名称:indico,代码行数:8,代码来源:rb_room.py

示例4: testReservationSpecificBlockingMethods

    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(), [])
开发者ID:iason-andr,项目名称:indico,代码行数:32,代码来源:roomblocking_test.py

示例5: removeEquipment

    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
开发者ID:aninhalacerda,项目名称:indico,代码行数:7,代码来源:equipmentManager.py

示例6: setPossibleEquipment

 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
开发者ID:aninhalacerda,项目名称:indico,代码行数:7,代码来源:equipmentManager.py

示例7: getNumberOfReservableRooms

 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 )
开发者ID:aninhalacerda,项目名称:indico,代码行数:7,代码来源:room.py

示例8: _getAnswer

    def _getAnswer(self):

        res = []
        minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance()
        if minfo.getRoomBookingModuleActive():
            if Location.parse(self._location):
                for room in CrossLocationQueries.getRooms(location=self._location, allFast=True):
                        res.append((room.name, room.getFullName()))
        return res
开发者ID:ferhatelmas,项目名称:indico,代码行数:9,代码来源:roomBooking.py

示例9: insertEquipment

    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
开发者ID:aninhalacerda,项目名称:indico,代码行数:9,代码来源:equipmentManager.py

示例10: getPossibleEquipment

    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]
开发者ID:aninhalacerda,项目名称:indico,代码行数:9,代码来源:equipmentManager.py

示例11: getTotalSurfaceAndCapacity

 def getTotalSurfaceAndCapacity( **kwargs ):
     """
     FINAL (not intented to be overriden)
     Returns (total_surface, total_capacity) of all Active rooms.
     """
     name = kwargs.get( 'location', Location.getDefaultLocation().friendlyName )
     location = Location.parse(name)
     roomEx = location.factory.newRoom()
     roomEx.isActive = True
     roomEx.isReservable = True
     rooms = CrossLocationQueries.getRooms( roomExample = roomEx, location = name )
     totalSurface, totalCapacity = 0, 0
     for r in rooms:
         if r.surfaceArea:
             totalSurface += r.surfaceArea
         if r.capacity:
             totalCapacity += r.capacity
     return ( totalSurface, totalCapacity )
开发者ID:vstitches,项目名称:indico,代码行数:18,代码来源:rb_room.py

示例12: getAttributes

 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]
开发者ID:davidmorrison,项目名称:indico,代码行数:9,代码来源:customAttributesManager.py

示例13: _getAnswer

    def _getAnswer( self ):

        res = []

        if Location.parse( self._location ):
            for room in CrossLocationQueries.getRooms( location = self._location ):
                res.append((room.name, room.getFullName()))

        return res
开发者ID:aninhalacerda,项目名称:indico,代码行数:9,代码来源:roomBooking.py

示例14: approve

    def approve(self, sendNotification=True):
        """
        Approve the room blocking and reject colloding bookings
        """
        self.active = True
        # If the blocking has not been saved yet, don't reject anything - will be done later in block.insert()
        if self.block.id is None:
            return
        # Create a fake reservation candidate to find bookings colliding with the blocking
        candResv = Location.parse(self.room.locationName).factory.newReservation()
        candResv.room = self.room
        candResv.startDT = datetime.datetime.combine(self.block.startDate, datetime.time())
        candResv.endDT = datetime.datetime.combine(self.block.endDate, datetime.time(23, 59))
        candResv.repeatability = RepeatabilityEnum.daily
        candResv.isConfirmed = None
        collisions = candResv.getCollisions()
        rejectionReason = "Conflict with blocking %s: %s" % (self.block.id, self.block.message)
        emailsToBeSent = []
        for coll in collisions:
            collResv = coll.withReservation
            if collResv.isRejected:
                continue
            elif self.block.canOverride(collResv.createdByUser(), self.room):
                continue
            elif collResv.repeatability is None or (
                collResv.startDT.date() >= self.block.startDate and collResv.endDT.date() <= self.block.endDate
            ):
                collResv.rejectionReason = rejectionReason
                collResv.reject()  # Just sets isRejected = True
                collResv.update()
                emails = collResv.notifyAboutRejection()
                emailsToBeSent += emails

                # Add entry to the booking history
                info = []
                info.append("Booking rejected")
                info.append("Reason: '%s'" % collResv.rejectionReason)
                histEntry = ResvHistoryEntry(self.block.createdByUser, info, emails)
                collResv.getResvHistory().addHistoryEntry(histEntry)
            else:  # repeatable -> only reject the specific days
                rejectDate = coll.startDT.date()
                collResv.excludeDay(rejectDate, unindex=True)
                collResv.update()
                emails = collResv.notifyAboutRejection(date=rejectDate, reason=rejectionReason)
                emailsToBeSent += emails

                # Add entry to the booking history
                info = []
                info.append("Booking occurence of the %s rejected" % rejectDate.strftime("%d %b %Y"))
                info.append("Reason: '%s'" % rejectionReason)
                histEntry = ResvHistoryEntry(self.block.createdByUser, info, emails)
                collResv.getResvHistory().addHistoryEntry(histEntry)
        if sendNotification:
            emailsToBeSent += RoomBlockingNotification.blockingRequestProcessed(self)
        for email in emailsToBeSent:
            GenericMailer.send(GenericNotification(email))
开发者ID:bubbas,项目名称:indico,代码行数:56,代码来源:roomblocking.py

示例15: removeAttribute

 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 )
开发者ID:davidmorrison,项目名称:indico,代码行数:10,代码来源:customAttributesManager.py


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