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


Python factory.Factory类代码示例

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


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

示例1: getRoomsByExample

    def getRoomsByExample():
        Test.dalManager.connect()

        # By ID
        room = RoomBase.getRooms(roomID=176)
        assert room.name == "4-1-021"

        # By other attributes
        roomEx = Factory.newRoom()
        roomEx.site = "prevessin"
        roomEx.comments = "res"
        rooms = RoomBase.getRooms(roomExample=roomEx)
        assert len(rooms) == 8  # 20

        roomEx = Factory.newRoom()
        roomEx.capacity = 20
        rooms = RoomBase.getRooms(roomExample=roomEx)
        assert len(rooms) == 26

        roomEx = Factory.newRoom()
        roomEx.isReservable = True
        roomEx.setEquipment(["Video projector", "Wireless"])
        rooms = RoomBase.getRooms(roomExample=roomEx)
        assert len(rooms) == 33

        Test.dalManager.disconnect()
开发者ID:jt1,项目名称:indico,代码行数:26,代码来源:room.py

示例2: getRoomsByExample

    def getRoomsByExample():
        Test.dalManager.connect()

        # By ID
        room = RoomBase.getRooms( roomID = 176 )
        assert( room.name == '4-1-021' )

        # By other attributes
        roomEx = Factory.newRoom()
        roomEx.site = 'prevessin'
        roomEx.comments = 'res'
        rooms = RoomBase.getRooms( roomExample = roomEx )
        assert( len( rooms ) == 8 ) # 20

        roomEx = Factory.newRoom()
        roomEx.capacity = 20
        rooms = RoomBase.getRooms( roomExample = roomEx )
        assert( len( rooms ) == 26 )

        roomEx = Factory.newRoom()
        roomEx.isReservable = True
        roomEx.setEquipment( [ 'Video projector', 'Wireless' ] )
        rooms = RoomBase.getRooms( roomExample = roomEx )
        assert( len( rooms ) == 33 )

        Test.dalManager.disconnect()
开发者ID:aninhalacerda,项目名称:indico,代码行数:26,代码来源:room.py

示例3: listResv4User

def listResv4User(user):
    dbi = DBMgr.getInstance()

    dbi.startRequest()
    Factory.getDALManager().connect()

    resvEx = ReservationBase()
    resvEx.createdBy = user

    allResv = CrossLocationQueries.getReservations( resvExample = resvEx)
    print "User %s has %s resevations created by him/her"%(user, len(allResv))

    Factory.getDALManager().disconnect()
    dbi.endRequest()
开发者ID:Ictp,项目名称:indico,代码行数:14,代码来源:changeCreatorToReservation.py

示例4: tmp

    def tmp():
        from MaKaC.rb_factory import Factory
        from MaKaC.rb_room import RoomBase
        from indico.core.db import DBMgr
        from BTrees.OOBTree import OOBTree

        DBMgr.getInstance().startRequest()
        Factory.getDALManager().connect()

        dayReservationsIndexBTree = OOBTree()
        raise str(dir(dayReservationsIndexBTree))

        Factory.getDALManager().disconnect()
        DBMgr.getInstance().endRequest()
开发者ID:arescope,项目名称:indico,代码行数:14,代码来源:reservation.py

示例5: getBlockedDay

 def getBlockedDay(self, day):
     blockings = Factory.newRoomBlocking().getByDate(day)
     for bl in blockings:
         rbl = bl.getBlockedRoom(self)
         if rbl and rbl.active is not False:
             return rbl
     return None
开发者ID:aninhalacerda,项目名称:indico,代码行数:7,代码来源:room.py

示例6: getReservations2

    def getReservations2():
        from MaKaC.rb_room import RoomBase

        Test.dalManager.connect()

        resvEx = Factory.newReservation()
        resvEx.startDT = datetime(2006, 12, 01, 10)
        resvEx.endDT = datetime(2006, 12, 14, 15)
        resvEx.repeatability = 0  # Daily

        # ReservationBase.getReservations( \
        #    roomExample = roomEx,
        #    resvExample = resvEx,
        #    available = True )

        resv = ReservationBase.getReservations(resvID=363818)
        print resv
        r = Reservation()
        r.room = resv.room
        r.startDT = datetime(2006, 10, 13, 8, 30)
        r.endDT = datetime(2006, 10, 13, 17, 30)
        col = r.getCollisions()
        print col

        Test.dalManager.disconnect()
开发者ID:arescope,项目名称:indico,代码行数:25,代码来源:reservation.py

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: getReservations

    def getReservations():
        from MaKaC.rb_room import RoomBase

        Test.dalManager.connect()

        roomEx = Factory.newRoom()
        roomEx.name = "TH AMPHITHEATRE"

        resvEx = Factory.newReservation()
        resvEx.startDT = datetime(2006, 12, 01, 10)
        resvEx.endDT = datetime(2006, 12, 14, 15)
        # resvEx.bookedForName = 'Jean-Jacques Blais'
        resvs = ReservationBase.getReservations(resvExample=resvEx, rooms=[roomEx])

        for resv in resvs:
            print "============================="
            print resv

        Test.dalManager.disconnect()
开发者ID:arescope,项目名称:indico,代码行数:19,代码来源:reservation.py

示例13: setAttributes

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

示例14: getAvailableRooms

    def getAvailableRooms():
        Test.dalManager.connect()

        from datetime import datetime

        roomEx = Factory.newRoom()
        roomEx.isActive = True
        roomEx.isReservable = True

        resvEx = Factory.newReservation()
        resvEx.startDT = datetime(2006, 12, 01, 10)
        resvEx.endDT = datetime(2006, 12, 14, 15)
        resvEx.repeatability = 0  # Daily

        rooms = RoomBase.getRooms(roomExample=roomEx, resvExample=resvEx, available=True)

        for room in rooms:
            print "\n=======================================\n"
            print room

        Test.dalManager.disconnect()
开发者ID:jt1,项目名称:indico,代码行数:21,代码来源:room.py

示例15: reservation

    def reservation(self, locList):

        Factory.getDALManager().connect()

        resvEx = ReservationBase()
        resvEx.startDT = self._fromDT
        resvEx.endDT = self._toDT

        locList = filter(lambda loc: Location.parse(loc) is not None, locList)

        if self._fromDT or self._toDT:
            daysParam = (day.date() for day in rrule.rrule(rrule.DAILY, dtstart=self._fromDT, until=self._toDT))
        else:
            # slow!
            daysParam = None

        for loc in sorted(locList):
            resvs = CrossLocationQueries.getReservations(location=loc, resvExample=resvEx, days=daysParam)
            for obj in self._process(resvs, filter=self._resvFilter):
                yield obj

        Factory.getDALManager().disconnect()
开发者ID:VishrutMehta,项目名称:indico,代码行数:22,代码来源:http_api.py


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