Changeset dab490 in indico


Ignore:
Timestamp:
02/08/10 20:39:17 (3 years ago)
Author:
Jose Benito <jose.benito.gonzalez@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, new-webex, prov-dual-interface, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, b8c30da8ebdbdcbd675a873997cc3e95f567de49, 4287315ec967a3da168d83963c14001db8487d53
Children:
073081, 420560, f3d0f4
Parents:
046026
git-author:
Jose Benito <jose.benito.gonzalez@…> (02/08/10 20:33:54)
git-committer:
Jose Benito <jose.benito.gonzalez@…> (02/08/10 20:39:17)
Message:

[FIX] Optimizing cancel/reject bookings

Location:
indico/MaKaC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/plugins/RoomBooking/default/reservation.py

    r9033fd rdab490  
    3232 
    3333from datetime import datetime 
     34from MaKaC.common.logger import Logger 
    3435 
    3536# Branch name in ZODB root 
     
    4041 
    4142class Reservation( Persistent, ReservationBase ): 
    42     """  
    43     ZODB specific implementation.  
    44      
     43    """ 
     44    ZODB specific implementation. 
     45 
    4546    For documentation of methods see base class. 
    4647    """ 
    47      
     48 
    4849    __dalManager = Factory.getDALManager() 
    4950 
     
    5253        self._excludedDays = [] 
    5354        self.useVC = [] 
    54      
     55 
    5556    def getUseVC( self ): 
    5657        try: 
     
    7576    def getDayReservationsIndexRoot( ): 
    7677        return Reservation.__dalManager.getRoot(_DAY_RESERVATIONS_INDEX) 
    77      
     78 
    7879    def insert( self ): 
    7980        """ Documentation in base class. """ 
     
    9091        # Add self to the BTree 
    9192        resvBTree[self.id] = self 
    92          
     93 
    9394        # Update room => room reservations index 
    9495        roomReservationsIndexBTree = Reservation.getRoomReservationsIndexRoot() 
     
    108109        resvs.append( self ) 
    109110        userReservationsIndexBTree[self.createdBy] = resvs 
    110          
     111 
    111112        # Update day => reservations index 
    112113        self._addToDayReservationsIndex() 
    113      
     114 
    114115    def update( self, udpateReservationIndex=True ): 
    115116        """ Documentation in base class. """ 
     
    120121            self._p_changed = True 
    121122 
    122         # Warning:  
     123        # Warning: 
    123124        # createdBy, once assigned to rerservation, CAN NOT be changed later (index!) 
    124125        # room, once assigned to reservation, CAN NOT be changed later (index!) 
    125          
    126          
     126 
     127 
    127128    def remove( self ): 
    128129        """ Documentation in base class. """ 
    129130        resvBTree = Reservation.getReservationsRoot() 
    130131        del resvBTree[self.id] 
    131          
     132 
    132133        # Update room => room reservations index 
    133134        roomReservationsIndexBTree = Reservation.getRoomReservationsIndexRoot() 
     
    140141        resvs = userReservationsIndexBTree[self.createdBy] # must exist 
    141142        resvs.remove( self ) 
    142         userReservationsIndexBTree[self.createdBy] = resvs  
     143        userReservationsIndexBTree[self.createdBy] = resvs 
    143144 
    144145        # Update day => reservations index 
     
    147148    def _addToDayReservationsIndex( self ): 
    148149        dayReservationsIndexBTree = Reservation.getDayReservationsIndexRoot() 
    149          
     150 
    150151        for period in self.splitToPeriods(): 
    151152            day = period.startDT.date() 
     
    160161        dayReservationsIndexBTree = Reservation.getDayReservationsIndexRoot() 
    161162 
    162         # Search for self in the whole index  
     163        # Search for self in the whole index 
    163164        # (the key may have changed) 
    164165        days = [] 
     
    166167            if self in resvs: 
    167168                days.append( day ) 
    168          
     169 
    169170        for day in days: 
    170171            resvs = dayReservationsIndexBTree[day] 
    171172            resvs.remove( self ) 
    172173            dayReservationsIndexBTree[day] = resvs 
    173      
     174 
    174175 
    175176    @staticmethod 
     
    185186        location = kwargs.get( 'location' ) 
    186187        days = kwargs.get( 'days' ) 
    187          
     188 
    188189        ret_lst = [] 
    189190        counter = 0 
    190191        root = Factory.getDALManager().root 
    191          
     192 
    192193        if resvID != None: 
    193194            return root[_RESERVATIONS].get( resvID ) 
    194          
     195 
    195196        resvCandidates = None 
    196197 
     
    206207                    resvCandidates += roomResvs 
    207208            alreadyRoomFiltered = True 
    208          
     209 
    209210        if resvCandidates == None and resvEx != None and resvEx.createdBy != None: 
    210211            resvCandidates = Reservation.getUserReservationsIndexRoot().get( resvEx.createdBy ) 
     
    228229                        new.append( resv ) 
    229230                resvCandidates = new 
    230      
     231 
    231232        if resvCandidates == None: 
    232233            resvCandidates = Reservation.getReservationsRoot().itervalues() 
    233234 
    234235        for resvCandidate in resvCandidates: 
    235             # Apply all conditions  
     236            # Apply all conditions 
    236237 
    237238            if archival != None: 
    238239                if resvCandidate.isArchival != archival: 
    239240                    continue 
    240              
     241 
    241242            if location != None: 
    242243                # If location is specified, use only rooms from this location 
     
    247248                if resvCandidate.isHeavy != heavy: 
    248249                    continue 
    249                  
     250 
    250251            # Does the reservation overlap on the specified period? 
    251252            if resvEx != None: 
     
    257258                    if resvCandidate.room not in rooms: 
    258259                        continue 
    259                  
     260 
    260261                if resvEx.createdDT != None: 
    261262                    if resvEx.createdDT != resvCandidate.createdDT: 
    262263                        continue 
    263                  
     264 
    264265                if resvEx.bookedForName != None: 
    265                     if resvCandidate.bookedForName == None:  
     266                    if resvCandidate.bookedForName == None: 
    266267                        continue 
    267268                    if not containsExactly_OR_containsAny( resvEx.bookedForName, resvCandidate.bookedForName ): 
    268269                        continue 
    269      
     270 
    270271                if resvEx.reason != None: 
    271                     if resvCandidate.reason == None:  
     272                    if resvCandidate.reason == None: 
    272273                        continue 
    273274                    if not containsExactly_OR_containsAny( resvEx.reason, resvCandidate.reason ): 
     
    315316                    if not resvCandidate.needsAVCSupport == resvEx.needsAVCSupport: 
    316317                        continue 
    317                  
     318 
    318319            # META-PROGRAMMING STYLE OF CHECKING ATTRIBUTES EQUALITY 
    319320            # ABANDONED DUE TO PERFORMANCE PROBLEMS 
     
    322323            #    continue 
    323324 
    324              
     325 
    325326            # All conditions are met: add reservation to the results 
    326327            counter += 1 
    327328            if not countOnly: 
    328329                ret_lst.append( resvCandidate ) 
    329              
     330 
    330331        #print "Found " + str( counter ) + " reservations." 
    331332        if not countOnly: return ret_lst 
     
    346347        lst.sort() 
    347348        return lst 
    348      
     349 
    349350    def setExcludedDays( self, excludedDays ): 
    350351        ReservationBase.setExcludedDays( self, excludedDays ) 
    351352        self._excludedDays = excludedDays 
    352      
    353     def excludeDay( self, dayD ): 
     353 
     354    def excludeDay( self, dayD, unindex = False ): 
    354355        """ 
    355356        Inserts dayD into list of excluded days. 
     
    357358        """ 
    358359        ReservationBase.excludeDay( self, dayD ) 
    359         lst = self._excludedDays  
     360        lst = self._excludedDays 
    360361        if not dayD in lst: 
    361362            lst.append( dayD ) 
    362363        self._excludedDays = lst  # Force update 
    363364 
     365        if unindex: 
     366            dayReservationsIndexBTree = Reservation.getDayReservationsIndexRoot() 
     367            if dayReservationsIndexBTree.has_key(dayD): 
     368                try: 
     369                    resvs = dayReservationsIndexBTree[dayD] 
     370                    resvs.remove( self ) 
     371                    dayReservationsIndexBTree[dayD] = resvs 
     372                except ValueError, e: 
     373                    Logger.get('RoomBooking').debug("excludeDay: Unindexing a day (%s) which is not indexed"%dayD) 
     374 
    364375    def includeDay( self, dayD ): 
    365376        """ 
     
    368379        """ 
    369380        ReservationBase.includeDay( self, dayD ) 
    370         lst = self._excludedDays  
     381        lst = self._excludedDays 
    371382        lst.remove( dayD ) 
    372383        self._excludedDays = lst  # Force update 
    373          
     384 
     385        # Re-indexing that day 
     386        dayReservationsIndexBTree = Reservation.getDayReservationsIndexRoot() 
     387        resvs = dayReservationsIndexBTree.get(dayD) 
     388        if resvs is None: 
     389            resvs = [] 
     390            dayReservationsIndexBTree.insert( dayD, resvs ) 
     391        resvs.append( self ) 
     392        dayReservationsIndexBTree[dayD] = resvs 
     393 
    374394    def dayIsExcluded( self, dayD ): 
    375395        ReservationBase.dayIsExcluded( self, dayD ) 
    376396        return dayD in self.getExcludedDays() 
    377397 
    378     # Statistical  
     398    # Statistical 
    379399 
    380400    @staticmethod 
     
    385405        location = kwargs.get( 'location', Location.getDefaultLocation().friendlyName ) 
    386406        return Reservation.countReservations( location = location ) 
    387          
     407 
    388408    @staticmethod 
    389409    def getNumberOfLiveReservations( *args, **kwargs ): 
     
    405425 
    406426    # ==== Private =================================================== 
    407      
     427 
    408428    @classmethod 
    409429    def __attrSpecialEqual( cls, attrName, attrValExample, attrValCandidate ): 
     
    426446                    if word in attrValCandidate.lower(): 
    427447                        return True 
    428              
     448 
    429449        return None 
    430450 
     
    439459 
    440460class Test( object ): 
    441      
     461 
    442462    dalManager = Factory.getDALManager() 
    443463 
     
    445465    def getReservations(): 
    446466        from MaKaC.rb_room import RoomBase 
    447          
     467 
    448468        Test.dalManager.connect() 
    449469 
    450470        roomEx = Factory.newRoom() 
    451471        roomEx.name = 'TH AMPHITHEATRE' 
    452          
     472 
    453473        resvEx = Factory.newReservation() 
    454474        resvEx.startDT = datetime( 2006, 12, 01, 10 ) 
     
    460480            print "=============================" 
    461481            print resv 
    462          
     482 
    463483        Test.dalManager.disconnect() 
    464484 
     
    466486    def getReservations2(): 
    467487        from MaKaC.rb_room import RoomBase 
    468          
     488 
    469489        Test.dalManager.connect() 
    470          
     490 
    471491        resvEx = Factory.newReservation() 
    472492        resvEx.startDT = datetime( 2006, 12, 01, 10 ) 
    473493        resvEx.endDT = datetime( 2006, 12, 14, 15 ) 
    474494        resvEx.repeatability = 0 # Daily 
    475          
     495 
    476496        #ReservationBase.getReservations( \ 
    477         #    roomExample = roomEx,  
     497        #    roomExample = roomEx, 
    478498        #    resvExample = resvEx, 
    479499        #    available = True ) 
     
    502522        dayReservationsIndexBTree = OOBTree() 
    503523        raise str( dir( dayReservationsIndexBTree ) ) 
    504          
     524 
    505525        Factory.getDALManager().disconnect() 
    506526        DBMgr.getInstance().endRequest() 
     
    525545#            if c % 100 == 0: 
    526546#                print c 
    527          
     547 
    528548        CrossLocationDB.commit() 
    529549        CrossLocationDB.disconnect() 
     
    547567        print "There are " + str( len( allResvs ) ) + " resvs and pre-resvs to index..." 
    548568        c = 0 
    549          
     569 
    550570        root[_ROOM_RESERVATIONS_INDEX] = OOBTree() 
    551571        print "Room => Reservations Index branch created" 
    552          
     572 
    553573        for resv in allResvs: 
    554574            roomReservationsIndexBTree = root[_ROOM_RESERVATIONS_INDEX] 
     
    562582            if c % 100 == 0: 
    563583                print c 
    564          
     584 
    565585        CrossLocationDB.commit() 
    566586        CrossLocationDB.disconnect() 
     
    581601        for r in rooms: 
    582602            print r 
    583              
     603 
    584604        CrossLocationDB.commit() 
    585605        CrossLocationDB.disconnect() 
  • indico/MaKaC/webinterface/rh/roomBooking.py

    r0c8aad rdab490  
    5555    All room booking related hanlders are derived from this class. 
    5656    This gives them: 
    57     - several general use methods  
     57    - several general use methods 
    5858    - login-protection 
    5959    - auto connecting/disconnecting from room booking db 
     
    6969        session.setVar( "deletionFailed", None ) 
    7070        session.setVar( "formMode", None ) 
    71          
     71 
    7272        session.setVar( "candDataInSession", None ) 
    7373        session.setVar( "candDataInParams", None ) 
     
    7777        session.setVar( "errors", None ) 
    7878        session.setVar( "thereAreConflicts", None ) 
    79          
     79 
    8080        session.setVar( "roomID", None ) 
    8181        session.setVar( "roomLocation", None ) 
    8282        session.setVar( "resvID", None ) 
    83   
     83 
    8484    def _checkParamsRepeatingPeriod( self, params ): 
    8585        """ 
    8686        Extracts startDT, endDT and repeatability 
    8787        from the form, if present. 
    88          
    89         Assigns these values to self, or Nones if values  
    90         are not present.  
     88 
     89        Assigns these values to self, or Nones if values 
     90        are not present. 
    9191        """ 
    9292        sDay = params.get( "sDay" ) 
     
    121121        if eTime and len( eTime.strip() ) > 0: 
    122122            eTime = eTime.strip() 
    123          
     123 
    124124        # process sTime and eTime 
    125125        if sTime and eTime: 
     
    137137            else: 
    138138                repeatability = int( repeatability.strip() ) 
    139          
     139 
    140140        self._startDT = None 
    141141        self._endDT = None 
     
    158158            self._startDT = datetime.today().replace(hour=0,minute=0,second=0) 
    159159            self._endDT = self._startDT.replace(hour=23,minute=59,second=59) 
    160     # Room  
    161      
     160    # Room 
     161 
    162162    def _saveRoomCandidateToSession( self, c ): 
    163163        session = self._websession     # Just an alias 
     
    171171        session.setVar( "floor", c.floor ) 
    172172        session.setVar( "roomNr", c.roomNr ) 
    173          
     173 
    174174        session.setVar( "isActive", c.isActive ) 
    175175        session.setVar( "isReservable", c.isReservable ) 
     
    220220    def _loadRoomCandidateFromDefaults( self, candRoom ): 
    221221        candRoom.isActive = True 
    222          
     222 
    223223        candRoom.building = None 
    224224        candRoom.floor = '' 
    225225        candRoom.roomNr = '' 
    226          
     226 
    227227        candRoom.capacity = 20 
    228228        candRoom.site = '' 
     
    232232        candRoom.photoId = None 
    233233        candRoom.externalId = None 
    234          
     234 
    235235        candRoom.telephone = ''      # str 
    236236        candRoom.surfaceArea = None 
     
    241241    def _loadRoomCandidateFromSession( self, candRoom ): 
    242242        session = self._websession # Just an alias 
    243          
     243 
    244244        candRoom.name = session.getVar( "name" ) 
    245245        candRoom.site = session.getVar( "site" ) 
     
    247247        candRoom.floor = session.getVar( "floor" ) 
    248248        candRoom.roomNr = session.getVar( "roomNr" ) 
    249          
     249 
    250250        candRoom.isActive = bool( session.getVar( "isActive" ) ) 
    251251        candRoom.isReservable = bool( session.getVar( "isReservable" ) ) 
    252252        candRoom.resvsNeedConfirmation = bool( session.getVar( "resvsNeedConfirmation" ) ) 
    253          
     253 
    254254        candRoom.responsibleId = session.getVar( "responsibleId" ) 
    255255        candRoom.whereIsKey = session.getVar( "whereIsKey" ) 
     
    276276        candRoom.floor = params.get( "floor" ) 
    277277        candRoom.roomNr = params.get( "roomNr" ) 
    278          
     278 
    279279        candRoom.isActive = bool( params.get( "isActive" ) ) # Safe 
    280280        candRoom.isReservable = bool( params.get( "isReservable" ) ) # Safe 
    281281        candRoom.resvsNeedConfirmation = bool( params.get( "resvsNeedConfirmation" ) ) # Safe 
    282          
     282 
    283283        candRoom.responsibleId = params.get( "responsibleId" ) 
    284284        if candRoom.responsibleId == "None": 
     
    286286        candRoom.whereIsKey = params.get( "whereIsKey" ) 
    287287        candRoom.telephone = params.get( "telephone" ) 
    288          
     288 
    289289        candRoom.capacity = intd( params.get( "capacity" ) ) 
    290290        candRoom.division = params.get( "division" ) 
     
    301301        candRoom.setEquipment( eqList ) 
    302302        candRoom.setAvailableVC(vcList) 
    303          
     303 
    304304        for k, v in params.iteritems(): 
    305305            if k.startswith( "cattr_" ): 
     
    324324        session.setVar( "usesAVC", c.usesAVC ) 
    325325        session.setVar( "needsAVCSupport", c.needsAVCSupport ) 
    326          
     326 
    327327        if hasattr(self, '_skipConflicting'): 
    328328            if self._skipConflicting: 
     
    331331                skip = 'off' 
    332332            session.setVar( "skipConflicting", skip ) 
    333          
     333 
    334334        if hasattr(c, "useVC"): 
    335335            session.setVar( "useVC",  c.useVC) 
     
    352352                    self._thereAreConflicts = True 
    353353                    errors.append( "There are conflicts with other bookings" ) 
    354          
     354 
    355355        return errors 
    356356 
     
    389389        if useVC is not None: 
    390390            candResv.useVC = useVC 
    391          
     391 
    392392        return candResv 
    393393 
     
    495495class RHRoomBookingWelcome( RHRoomBookingBase ): 
    496496    _uh = urlHandlers.UHRoomBookingWelcome 
    497      
     497 
    498498    def _process( self ): 
    499499        #if self._getUser().isResponsibleForRooms(): 
     
    519519    def _setGeneralDefaultsInSession( self ): 
    520520        now = datetime.now() 
    521          
     521 
    522522        # if it's saturday or sunday, postpone for monday as a default 
    523523        if now.weekday() in [5,6]: 
    524524            now = now + timedelta( 7 - now.weekday() ) 
    525              
     525 
    526526        websession = self._websession 
    527527        websession.setVar( "defaultStartDT", datetime( now.year, now.month, now.day, 8, 30 ) ) 
    528528        websession.setVar( "defaultEndDT", datetime( now.year, now.month, now.day, 17, 30 ) ) 
    529          
     529 
    530530    def _checkParams( self, params ): 
    531531        self._cleanDefaultsFromSession() 
     
    540540        self._rooms.sort() 
    541541        self._equipment = CrossLocationQueries.getPossibleEquipment() 
    542      
     542 
    543543    def _process( self ): 
    544544        self._businessLogic() 
     
    551551        self._rooms = CrossLocationQueries.getRooms( allFast = True ) 
    552552        self._rooms.sort() 
    553      
     553 
    554554    def _process( self ): 
    555555        self._businessLogic() 
     
    558558 
    559559class RHRoomBookingSearch4Users( RHRoomBookingBase ): 
    560      
     560 
    561561    def _checkParams( self, params ): 
    562          
     562 
    563563        roomID = params.get( "roomID" ) 
    564564        roomLocation = params.get( "roomLocation" ) 
     
    578578        self._websession.setVar( "showErrors", False ) 
    579579        self._websession.setVar( "candDataInSession", True ) 
    580      
     580 
    581581        if params.has_key( 'largePhotoPath' ): del params['largePhotoPath'] 
    582582        if params.has_key( 'smallPhotoPath' ): del params['smallPhotoPath'] 
     
    593593 
    594594class RHRoomBookingRoomList( RHRoomBookingBase ): 
    595      
     595 
    596596    def _checkParams( self, params ): 
    597597 
     
    607607            for c in s: 
    608608                if c != ',': self._freeSearch += c 
    609          
     609 
    610610        self._capacity = None 
    611611        if params.get("capacity") and len( params["capacity"].strip() ) > 0: 
    612612            self._capacity = int( params["capacity"].strip() ) 
    613          
     613 
    614614        self._availability = "Don't care" 
    615615        if params.get("availability") and len( params["availability"].strip() ) > 0: 
     
    621621        self._includePrebookings = False 
    622622        if params.get( 'includePrebookings' ) == "on": self._includePrebookings = True 
    623          
     623 
    624624        # The end of "avail/don't care" 
    625          
     625 
    626626        # Equipment 
    627627        self._equipment = [] 
     
    629629            if k[0:4] == "equ_" and v == "on": 
    630630                self._equipment.append( k[4:100] ) 
    631                  
     631 
    632632        # Special 
    633633        self._isReservable = self._ownedBy = self._isAutoConfirmed = None 
    634634        self._isActive = True 
    635          
     635 
    636636        if params.get( 'isReservable' ) == "on": self._isReservable = True 
    637637        if params.get( 'isAutoConfirmed' ) == "on": self._isAutoConfirmed = True 
     
    647647            self._title = "My rooms" 
    648648            self._ownedBy = self._getUser() 
    649          
     649 
    650650        r = RoomBase() 
    651651        r.capacity = self._capacity 
     
    671671            if self._includePrebookings: 
    672672                p.isConfirmed = None   # because it defaults to True 
    673              
     673 
    674674            # Set default values for later booking form 
    675675            self._websession.setVar( "defaultStartDT", p.startDT ) 
     
    681681            rooms = CrossLocationQueries.getRooms( \ 
    682682                location = self._roomLocation, 
    683                 freeText = self._freeSearch,  
    684                 ownedBy = self._ownedBy,  
    685                 roomExample = r,  
    686                 resvExample = p,  
     683                freeText = self._freeSearch, 
     684                ownedBy = self._ownedBy, 
     685                roomExample = r, 
     686                resvExample = p, 
    687687                available = available ) 
    688688            # Special care for capacity (20% => greater than) 
    689689            if len ( rooms ) == 0: 
    690690                rooms = CrossLocationQueries.getRooms( \ 
    691                     location = self._roomLocation,  
    692                     freeText = self._freeSearch,  
    693                     ownedBy = self._ownedBy,  
    694                     roomExample = r,  
    695                     resvExample = p,  
     691                    location = self._roomLocation, 
     692                    freeText = self._freeSearch, 
     693                    ownedBy = self._ownedBy, 
     694                    roomExample = r, 
     695                    resvExample = p, 
    696696                    available = available, 
    697697                    minCapacity = True ) 
     
    700700 
    701701        self._rooms = rooms 
    702      
     702 
    703703    def _process( self ): 
    704704        self._businessLogic() 
     
    712712        self._allRooms = False 
    713713        roomGUIDs = params.get( "roomGUID" ) 
    714         if isinstance( roomGUIDs, str ):  
     714        if isinstance( roomGUIDs, str ): 
    715715            if roomGUIDs == "allRooms": 
    716716                self._allRooms = True 
     
    720720        if isinstance( roomGUIDs, list )  and  roomGUIDs != ['']: 
    721721            self._roomGUIDs = roomGUIDs 
    722              
     722 
    723723        resvEx = ReservationBase() 
    724724        self._checkParamsRepeatingPeriod( params ) 
     
    732732            resvEx.reason = reason.strip() 
    733733        self._title = "Bookings" 
    734          
    735         onlyPrebookings = params.get( "onlyPrebookings" )         
     734 
     735        onlyPrebookings = params.get( "onlyPrebookings" ) 
    736736        self._onlyPrebookings = False 
    737          
    738         onlyBookings = params.get( "onlyBookings" )         
     737 
     738        onlyBookings = params.get( "onlyBookings" ) 
    739739        self._onlyBookings = False 
    740          
     740 
    741741        if onlyPrebookings and len( onlyPrebookings.strip() ) > 0: 
    742742            if onlyPrebookings == 'on': 
     
    746746        elif onlyBookings and len( onlyBookings.strip() ) > 0: 
    747747            if onlyBookings == 'on': 
    748                 resvEx.isConfirmed = True             
     748                resvEx.isConfirmed = True 
    749749                self._onlyBookings = True 
    750750        else: 
    751751            # find pre-bookings as well 
    752752            resvEx.isConfirmed = None 
    753              
     753 
    754754        self._onlyMy = False 
    755755        onlyMy = params.get( "onlyMy" ) 
     
    768768        else: 
    769769            self._rooms = None 
    770          
     770 
    771771        self._search = False 
    772772        search = params.get( "search" ) 
     
    775775                self._search = True 
    776776                self._title = "Search " + self._title 
    777          
     777 
    778778        self._order = params.get( "order", "" ) 
    779          
     779 
    780780        isArchival = params.get( "isArchival" ) 
    781781        if isArchival and len( isArchival.strip() ) > 0: 
     
    783783        else: 
    784784            self._isArchival = None 
    785          
     785 
    786786        self._autoCriteria = False 
    787787        if params.get( "autoCriteria" ) == "True" or not resvEx.startDT: 
    788788            now = datetime.now() 
    789789            after = now + timedelta( 30 ) # 1 month later 
    790              
     790 
    791791            resvEx.startDT = datetime( now.year, now.month, now.day, 0, 0, 0 ) 
    792792            resvEx.endDT = datetime( after.year, after.month, after.day, 23, 59, 00 ) 
     
    805805            resvEx.isCancelled = False 
    806806 
    807          
     807 
    808808        needsAVCSupport = params.get( "needsAVCSupport" ) 
    809809        if needsAVCSupport and len( needsAVCSupport.strip() ) > 0: 
     
    837837    def _process( self ): 
    838838        # The following can't be done in checkParams since it must be after checkProtection 
    839         if self._onlyMy:  
     839        if self._onlyMy: 
    840840            self._resvEx.createdBy = str( self._getUser().id ) 
    841841        if self._ofMyRooms: 
     
    854854            else: 
    855855                self._rooms = rooms 
    856          
     856 
    857857        # Init 
    858858        resvEx = self._resvEx 
     
    876876            self._resvs = CrossLocationQueries.getReservations( resvExample = resvEx, rooms = self._rooms, archival = self._isArchival, heavy = self._isHeavy, days = days ) 
    877877 
    878          
     878 
    879879        p = roomBooking_wp.WPRoomBookingBookingList( self ) 
    880880        return p.display() 
     
    883883# 3. Details of ... 
    884884 
    885 class RHRoomBookingRoomDetails( RHRoomBookingBase ):  
    886      
     885class RHRoomBookingRoomDetails( RHRoomBookingBase ): 
     886 
    887887    def _checkParams( self, params ): 
    888888        locator = locators.WebLocator() 
    889889        locator.setRoom( params ) 
    890890        self._room = self._target = locator.getObject() 
    891          
     891 
    892892        session = self._websession 
    893893        self._afterActionSucceeded = session.getVar( "actionSucceeded" ) 
    894894        self._afterDeletionFailed = session.getVar( "deletionFailed" ) 
    895895        self._formMode = session.getVar( "formMode" ) 
    896          
     896 
    897897        self._searchingStartDT = self._searchingEndDT = None 
    898898        if not params.get( 'calendarMonths' ): 
    899899            self._searchingStartDT = session.getVar( "defaultStartDT" ) 
    900900            self._searchingEndDT = session.getVar( "defaultEndDT" ) 
    901          
     901 
    902902        self._clearSessionState() 
    903903 
     
    910910        return p.display() 
    911911 
    912 class RHRoomBookingRoomStats( RHRoomBookingBase ):  
    913      
     912class RHRoomBookingRoomStats( RHRoomBookingBase ): 
     913 
    914914    def _checkParams( self, params ): 
    915915        locator = locators.WebLocator() 
    916916        locator.setRoom( params ) 
    917917        self._period = params.get("period","pastmonth") 
    918         self._room = self._target = locator.getObject()     
     918        self._room = self._target = locator.getObject() 
    919919 
    920920    def _businessLogic( self ): 
     
    923923        self._kpiReservableRooms = RoomBase.getNumberOfReservableRooms() 
    924924        self._kpiReservableCapacity, self._kpiReservableSurface = RoomBase.getTotalSurfaceAndCapacity() 
    925         # Bookings     
     925        # Bookings 
    926926        st = ReservationBase.getRoomReservationStats(self._room) 
    927927        self._booking_stats = st 
     
    933933        return p.display() 
    934934 
    935 class RHRoomBookingBookingDetails( RHRoomBookingBase ):  
     935class RHRoomBookingBookingDetails( RHRoomBookingBase ): 
    936936 
    937937    def _checkParams( self, params ): 
    938          
     938 
    939939        locator = locators.WebLocator() 
    940940        locator.setRoomBooking( params ) 
     
    959959 
    960960class RHRoomBookingBookingForm( RHRoomBookingBase ): 
    961      
     961 
    962962    def _checkParams( self, params ): 
    963963        session = self._websession  # Just an alias 
    964964        self._thereAreConflicts = session.getVar( 'thereAreConflicts' ) 
    965965        self._skipConflicting = False 
    966          
     966 
    967967        # DATA FROM? 
    968968        self._dataFrom = CandidateDataFrom.DEFAULTS 
     
    10061006            else: 
    10071007                candResv = self._loadResvCandidateFromDefaults( params ) 
    1008          
     1008 
    10091009        if self._formMode == FormMode.MODIF: 
    10101010            import copy 
     
    10141014            if self._dataFrom == CandidateDataFrom.SESSION: 
    10151015                self._loadResvCandidateFromSession( candResv, params ) 
    1016              
     1016 
    10171017        self._errors = session.getVar( "errors" ) 
    10181018        self._candResv = candResv 
    1019          
     1019 
    10201020        self._clearSessionState() 
    10211021 
     
    10501050    Performs open a new booking form with the data of an already existing booking. 
    10511051    """ 
    1052      
     1052 
    10531053    def _checkParams( self, params ): 
    10541054        session = self._websession  # Just an alias 
     
    10581058 
    10591059        self._formMode = FormMode.NEW 
    1060          
     1060 
    10611061        # Reservation ID 
    10621062        resvID = int(params.get( "resvID" )) 
     
    10791079    When succeeded redirects to booking details, otherwise returns to booking form. 
    10801080    """ 
    1081      
     1081 
    10821082    def _checkParams( self, params ): 
    1083          
     1083 
    10841084        resvID = params.get( "resvID" ) 
    10851085        roomLocation = params.get( "roomLocation" ) 
     
    10901090        # prebookings that conflict with other prebookings are 
    10911091        # silently added 
    1092          
     1092 
    10931093        self._forceAddition = params.get("forceAddition","False") 
    10941094        if self._forceAddition == 'True': 
     
    11031103            _candResv = CrossLocationQueries.getReservations( resvID = resvID, location = roomLocation ) 
    11041104            self._orig_candResv = _candResv 
    1105              
     1105 
    11061106            import copy 
    11071107            candResv = copy.copy(_candResv) 
    1108              
     1108 
    11091109            if self._forceAddition: 
    11101110                # booking data comes from session if confirmation was required 
     
    11121112            else: 
    11131113                self._loadResvCandidateFromParams( candResv, params ) 
    1114                  
     1114 
    11151115            self._resvID = resvID 
    1116              
     1116 
    11171117        else: 
    11181118            self._formMode = FormMode.NEW 
     
    11221122            candResv.isRejected = False 
    11231123            candResv.isCancelled = False 
    1124          
     1124 
    11251125            if self._forceAddition: 
    11261126                # booking data comes from session if confirmation was required 
     
    11281128            else: 
    11291129                self._loadResvCandidateFromParams( candResv, params ) 
    1130                  
     1130 
    11311131            self._resvID = None 
    1132              
    1133          
    1134         self._candResv = candResv                  
    1135          
     1132 
     1133 
     1134        self._candResv = candResv 
     1135 
    11361136        self._params = params 
    11371137        self._clearSessionState() 
    1138      
    1139      
     1138 
     1139 
    11401140    def _checkProtection( self ): 
    11411141        RHRoomBookingBase._checkProtection(self) 
     
    11431143        if not self._candResv.room.isActive and not self._getUser().isAdmin(): 
    11441144            raise MaKaCError( "You are not authorized to book this room." ) 
    1145          
     1145 
    11461146        if self._formMode == FormMode.MODIF: 
    11471147            if not self._candResv.canModify( self.getAW() ): 
     
    11491149 
    11501150    def _businessLogic( self ): 
    1151          
     1151 
    11521152        candResv = self._candResv 
    11531153        self._emailsToBeSent = [] 
    11541154        self._confirmAdditionFirst = False; 
    1155                  
     1155 
    11561156        # Set confirmation status 
    11571157        candResv.isConfirmed = True 
     
    11601160            candResv.isConfirmed = False 
    11611161 
    1162          
    1163         errors = self._getErrorsOfResvCandidate( candResv )         
    1164         session = self._websession         
    1165          
     1162 
     1163        errors = self._getErrorsOfResvCandidate( candResv ) 
     1164        session = self._websession 
     1165 
    11661166        if not errors and self._answer != 'No': 
    1167          
    1168             # If we're dealing with an unapproved pre-booking             
    1169             if not candResv.isConfirmed and not self._forceAddition:                 
    1170                  
     1167 
     1168            # If we're dealing with an unapproved pre-booking 
     1169            if not candResv.isConfirmed and not self._forceAddition: 
     1170 
    11711171                candResv.isConfirmed = None; 
    11721172                # find pre-booking collisions 
    11731173                self._collisions = candResv.getCollisions(sansID = candResv.id) 
    1174                  
     1174 
    11751175                candResv.isConfirmed = False 
    1176                  
     1176 
    11771177                # are there any collisions? 
    11781178                if len( self._collisions ) > 0: 
     
    11801180                    self._saveResvCandidateToSession( candResv ) 
    11811181                    # ask for confirmation about the pre-booking 
    1182                     self._confirmAdditionFirst = True                     
    1183                          
     1182                    self._confirmAdditionFirst = True 
     1183 
    11841184 
    11851185            # approved pre-booking or booking 
    11861186            if not self._confirmAdditionFirst: 
    1187                                              
     1187 
    11881188                # Form is OK and (no conflicts or skip conflicts) 
    11891189                if self._formMode == FormMode.NEW: 
     
    12001200                        self._loadResvCandidateFromSession( self._orig_candResv, self._params ) 
    12011201                    else: 
    1202                         self._loadResvCandidateFromParams( self._orig_candResv, self._params )                     
     1202                        self._loadResvCandidateFromParams( self._orig_candResv, self._params ) 
    12031203                    self._orig_candResv.update() 
    12041204                    self._emailsToBeSent += self._orig_candResv.notifyAboutUpdate() 
     
    12061206                    session.setVar( "description", 'Please review details below.' ) 
    12071207                session.setVar( "actionSucceeded", True ) 
    1208                              
    1209                                  
    1210         else:             
     1208 
     1209 
     1210        else: 
    12111211            session.setVar( "candDataInSession", True ) 
    12121212            session.setVar( "errors", errors ) 
    1213              
     1213 
    12141214            if self._answer == 'No': 
    1215                 session.setVar( "actionSucceeded", True )                 
     1215                session.setVar( "actionSucceeded", True ) 
    12161216            else: 
    12171217                session.setVar( "actionSucceeded", False ) 
    12181218                session.setVar( "showErrors", True ) 
    12191219                session.setVar( "thereAreConflicts", self._thereAreConflicts ) 
    1220              
     1220 
    12211221            self._saveResvCandidateToSession( candResv ) 
    12221222 
    12231223        # Form is not properly filled OR there are conflicts 
    1224         self._errors = errors         
    1225      
    1226     def _process( self ):  
     1224        self._errors = errors 
     1225 
     1226    def _process( self ): 
    12271227 
    12281228        self._businessLogic() 
    1229              
     1229 
    12301230        if self._errors or self._answer == 'No': 
    1231             url = urlHandlers.UHRoomBookingBookingForm.getURL( self._candResv.room, resvID=self._resvID )             
     1231            url = urlHandlers.UHRoomBookingBookingForm.getURL( self._candResv.room, resvID=self._resvID ) 
    12321232        elif self._confirmAdditionFirst: 
    12331233            p = roomBooking_wp.WPRoomBookingConfirmBooking( self ) 
     
    12351235        else: 
    12361236            url = urlHandlers.UHRoomBookingBookingDetails.getURL( self._candResv ) 
    1237              
     1237 
    12381238        self._redirect( url ) 
    12391239 
     
    12431243    Form for creating NEW and MODIFICATION of an existing room. 
    12441244    """ 
    1245      
     1245 
    12461246    def _checkParams( self, params ): 
    12471247        session = self._websession  # Just an alias 
     
    12751275        if self._showErrors: 
    12761276            self._errors = self._websession.getVar( "errors" ) 
    1277          
     1277 
    12781278        # CREATE CANDIDATE OBJECT 
    12791279        candRoom = None 
     
    12911291            else: 
    12921292                self._loadRoomCandidateFromDefaults( candRoom ) 
    1293          
     1293 
    12941294        if self._formMode == FormMode.MODIF: 
    12951295            candRoom = CrossLocationQueries.getRooms( roomID = roomID, location = roomLocation ) 
    1296              
     1296 
    12971297            if self._dataFrom == CandidateDataFrom.PARAMS: 
    12981298                self._loadRoomCandidateFromParams( candRoom, params ) 
    12991299            if self._dataFrom == CandidateDataFrom.SESSION: 
    13001300                self._loadRoomCandidateFromSession( candRoom ) 
    1301              
     1301 
    13021302        self._errors = session.getVar( "errors" ) 
    13031303 
     
    14101410 
    14111411class RHRoomBookingDeleteBooking( RHRoomBookingAdminBase ): 
    1412      
     1412 
    14131413    def _checkParams( self , params ): 
    14141414        resvID = int( params.get( "resvID" ) ) 
     
    14161416        self._resv = CrossLocationQueries.getReservations( resvID = resvID, location = roomLocation ) 
    14171417        self._target = self._resv 
    1418          
     1418 
    14191419    def _process( self ): 
    14201420        # Booking deletion is always possible - just delete 
     
    14261426 
    14271427class RHRoomBookingCancelBooking( RHRoomBookingBase ): 
    1428      
     1428 
    14291429    def _checkParams( self , params ): 
    14301430        resvID = int( params.get( "resvID" ) ) 
     
    14321432        self._resv = CrossLocationQueries.getReservations( resvID = resvID, location = roomLocation ) 
    14331433        self._target = self._resv 
    1434      
     1434 
    14351435    def _checkProtection( self ): 
    14361436        RHRoomBookingBase._checkProtection(self) 
     
    14411441            ( not self._getUser().isAdmin() ): 
    14421442                raise MaKaCError( "You are not authorized to take this action." ) 
    1443      
     1443 
    14441444    def _process( self ): 
    14451445        # Booking deletion is always possible - just delete 
    14461446        self._emailsToBeSent = [] 
    14471447        self._resv.cancel()    # Just sets isCancel = True 
    1448         self._resv.update() 
     1448        self._resv.update(udpateReservationIndex=False) 
    14491449        self._emailsToBeSent += self._resv.notifyAboutCancellation() 
    1450          
     1450 
    14511451        self._websession.setVar( 'actionSucceeded', True ) 
    14521452        self._websession.setVar( 'title', "Booking has been cancelled." ) 
     
    14571457 
    14581458class RHRoomBookingCancelBookingOccurrence( RHRoomBookingBase ): 
    1459      
     1459 
    14601460    def _checkParams( self , params ): 
    14611461        resvID = int( params.get( "resvID" ) ) 
    14621462        roomLocation = params.get( "roomLocation" ) 
    14631463        date = params.get( "date" ) 
    1464          
     1464 
    14651465        self._resv = CrossLocationQueries.getReservations( resvID = resvID, location = roomLocation ) 
    14661466        self._date = parse_date( date ) 
     
    14741474        if self._resv.createdBy != user.getId() and (not user.isAdmin()): 
    14751475                raise MaKaCError( "You are not authorized to take this action." ) 
    1476      
     1476 
    14771477    def _process( self ): 
    14781478        self._emailsToBeSent = [] 
    1479         self._resv.excludeDay( self._date ) 
    1480         self._resv.update() 
     1479        self._resv.excludeDay( self._date, unindex=True ) 
     1480        self._resv.update(udpateReservationIndex=False) 
    14811481        self._emailsToBeSent += self._resv.notifyAboutCancellation( date = self._date ) 
    1482          
     1482 
    14831483        self._websession.setVar( 'actionSucceeded', True ) 
    14841484        self._websession.setVar( 'title', "Selected occurrence has been cancelled." ) 
     
    14891489 
    14901490class RHRoomBookingRejectBooking( RHRoomBookingBase ): 
    1491      
     1491 
    14921492    def _checkParams( self , params ): 
    14931493        resvID = int( params.get( "resvID" ) ) 
    14941494        roomLocation = params.get( "roomLocation" ) 
    14951495        reason = params.get( "reason" ) 
    1496          
     1496 
    14971497        self._resv = CrossLocationQueries.getReservations( resvID = resvID, location = roomLocation ) 
    14981498        self._resv.rejectionReason = reason 
     
    15071507            ( not self._getUser().isAdmin() ): 
    15081508                raise MaKaCError( "You are not authorized to take this action." ) 
    1509      
     1509 
    15101510    def _process( self ): 
    15111511        self._emailsToBeSent = [] 
    15121512        self._resv.reject()    # Just sets isRejected = True 
    1513         self._resv.update() 
     1513        self._resv.update(udpateReservationIndex=False) 
    15141514        self._emailsToBeSent += self._resv.notifyAboutRejection() 
    1515          
     1515 
    15161516        self._websession.setVar( 'actionSucceeded', True ) 
    15171517        self._websession.setVar( 'title', "Booking has been rejected." ) 
     
    15221522 
    15231523class RHRoomBookingRejectALlConflicting( RHRoomBookingBase ): 
    1524      
     1524 
    15251525#    def _checkParams( self , params ): 
    15261526#        pass 
     
    15341534            ( not self._getUser().isAdmin() ): 
    15351535                raise MaKaCError( "You are not authorized to take this action." ) 
    1536      
     1536 
    15371537    def _process( self ): 
    15381538        userRooms = self._getUser().getRooms() 
     
    15431543        resvEx.isRejected = False 
    15441544        resvEx.isCancelled = False 
    1545          
     1545 
    15461546        resvs = CrossLocationQueries.getReservations( resvExample = resvEx, rooms = userRooms ) 
    15471547 
     
    15651565 
    15661566class RHRoomBookingAcceptBooking( RHRoomBookingBase ): 
    1567      
     1567 
    15681568    def _checkParams( self , params ): 
    15691569        resvID = int( params.get( "resvID" ) ) 
     
    15791579            ( not self._getUser().isAdmin() ): 
    15801580                raise MaKaCError( "You are not authorized to take this action." ) 
    1581      
     1581 
    15821582    def _process( self ): 
    15831583        self._emailsToBeSent = [] 
     
    15881588            self._resv.update(False) 
    15891589            self._emailsToBeSent += self._resv.notifyAboutConfirmation() 
    1590              
     1590 
    15911591            session.setVar( 'actionSucceeded', True ) 
    15921592            session.setVar( 'title', "Booking has been accepted." ) 
     
    16041604            session.setVar( 'title', "PRE-Booking conflicts with other (confirmed) bookings." ) 
    16051605            session.setVar( 'description', "" ) 
    1606              
     1606 
    16071607            self._formMode = FormMode.MODIF 
    16081608            self._saveResvCandidateToSession( self._resv ) 
     
    16191619        session.setVar( 'title', None ) 
    16201620        session.setVar( 'description', None ) 
    1621      
     1621 
    16221622    def _process( self ): 
    16231623        return roomBooking_wp.WPRoomBookingStatement( self ).display() 
    16241624 
    16251625class RHRoomBookingAdmin( RHRoomBookingAdminBase ): 
    1626      
     1626 
    16271627    def _process( self ): 
    16281628        return admins.WPRoomBookingAdmin( self ).display() 
    16291629 
    16301630class RHRoomBookingAdminLocation( RHRoomBookingAdminBase ): 
    1631      
     1631 
    16321632    def _checkParams( self, params ): 
    16331633        self._withKPI = False 
     
    16431643        else: 
    16441644            self._actionSucceeded = False 
    1645      
    1646     def _process( self ): 
    1647          
     1645 
     1646    def _process( self ): 
     1647 
    16481648        if self._withKPI: 
    16491649            self._kpiAverageOccupation = RoomBase.getAverageOccupation(location=self._location.friendlyName) 
     
    16521652            self._kpiReservableRooms = RoomBase.getNumberOfReservableRooms(location=self._location.friendlyName) 
    16531653            self._kpiReservableCapacity, self._kpiReservableSurface = RoomBase.getTotalSurfaceAndCapacity(location=self._location.friendlyName) 
    1654              
     1654 
    16551655            # Bookings 
    1656              
     1656 
    16571657            st = ReservationBase.getReservationStats(location=self._location.friendlyName) 
    16581658            self._booking_stats = st 
    16591659            self._totalBookings = st['liveValid'] + st['liveCancelled'] + st['liveRejected'] + st['archivalValid'] + st['archivalCancelled'] + st['archivalRejected'] 
    1660          
     1660 
    16611661        return admins.WPRoomBookingAdminLocation( self, self._location, actionSucceeded = self._actionSucceeded ).display() 
    16621662 
     
    16661666    def _checkParams( self , params ): 
    16671667        self._defaultLocation = params["defaultLocation"] 
    1668      
     1668 
    16691669    def _process( self ): 
    16701670        Location.setDefaultLocation( self._defaultLocation ) 
     
    16841684        if self._pluginClass == None: 
    16851685            raise MaKaCError( "%s: Cannot find requested plugin" % name ) 
    1686      
     1686 
    16871687    def _process( self ): 
    16881688        if self._locationName: 
     
    16971697    def _checkParams( self , params ): 
    16981698        self._locationName = params["removeLocationName"] 
    1699      
    1700     def _process( self ): 
    1701          
     1699 
     1700    def _process( self ): 
     1701 
    17021702        if self._locationName: 
    17031703            Location.removeLocation( self._locationName ) 
     
    17131713        if str(self._location) == "None": 
    17141714            raise MaKaCError( "%s: Unknown Location" % name ) 
    1715          
     1715 
    17161716    def _process( self ): 
    17171717        if self._eq: 
     
    17281728        if str(self._location) == "None": 
    17291729            raise MaKaCError( "%s: Unknown Location" % name ) 
    1730      
     1730 
    17311731    def _process( self ): 
    17321732        self._location.factory.getEquipmentManager().removeEquipment( self._eq, location=self._location.friendlyName ) 
     
    17411741        if str(self._location) == "None": 
    17421742            raise MaKaCError( "%s: Unknown Location" % name ) 
    1743          
     1743 
    17441744        self._newAttr = None 
    17451745        if params.get( "newCustomAttributeName" ): 
    17461746            attrName = params["newCustomAttributeName"].strip() 
    1747             if attrName:  
     1747            if attrName: 
    17481748                attrIsReq = False 
    17491749                if params.get( "newCustomAttributeIsRequired" ) == "on": 
     
    17571757                    'required': attrIsReq, 
    17581758                    'hidden': attrIsHidden } 
    1759          
     1759 
    17601760        # Set "required" for _all_ custom attributes 
    17611761        manager = self._location.factory.getCustomAttributesManager() 
     
    17741774            manager.setRequired( ca['name'], required, location=self._location.friendlyName ) 
    17751775            manager.setHidden( ca['name'], hidden, location=self._location.friendlyName ) 
    1776      
     1776 
    17771777    def _process( self ): 
    17781778        if self._newAttr: 
     
    17891789        if str(self._location) == "None": 
    17901790            raise MaKaCError( "%s: Unknown Location" % name ) 
    1791      
     1791 
    17921792    def _process( self ): 
    17931793        self._location.factory.getCustomAttributesManager().removeAttribute( self._attr, location=self._location.friendlyName ) 
     
    18161816 
    18171817class RHRoomBookingGetDateWarning( RHRoomBookingBase ): 
    1818      
     1818 
    18191819    def _checkParams( self, params ): 
    18201820        try: 
     
    18221822        except: 
    18231823            pass 
    1824      
     1824 
    18251825    def addRandom( self, s ): 
    18261826        return s 
    18271827        #import random 
    18281828        #return str( int( random.random() * 1000 ) ) + " | " + s 
    1829      
     1829 
    18301830    def _process( self ): 
    18311831        if not self._startDT or not self._endDT: 
    18321832            return self.addRandom( " " ) 
    1833          
     1833 
    18341834        if  HolidaysHolder.isWorkingDay( self._startDT ) and \ 
    18351835            HolidaysHolder.isWorkingDay( self._endDT ): 
    18361836            return self.addRandom( " " ) 
    1837          
     1837 
    18381838        if isWeekend( self._startDT ) or isWeekend( self._endDT ): 
    18391839            return self.addRandom( "Warning: weekend chosen" ) 
    1840              
     1840 
    18411841        return self.addRandom( "Warning: holidays chosen" ) 
    18421842 
    18431843 
    18441844class RHRoomBookingGetRoomSelectList( RHRoomBookingBase ): 
    1845      
     1845 
    18461846    def _checkParams( self, params ): 
    18471847        self.location = params.get( 'locationName' ) 
    18481848        self.forSubEvents = params.get( 'forSubEvents' ) == 'True' 
    1849      
    1850     def _process( self ): 
    1851          
     1849 
     1850    def _process( self ): 
     1851 
    18521852        self._roomList = [] 
    18531853        if self.location: 
    18541854            self._roomList = CrossLocationQueries.getRooms( location = self.location ) 
    18551855        self._locationRoom = "" 
    1856          
     1856 
    18571857        from MaKaC.webinterface import wcomponents 
    18581858        if self.forSubEvents: 
     
    18601860        else: 
    18611861            p = wcomponents.WRoomBookingRoomSelectList( self ) 
    1862          
     1862 
    18631863        return p.getHTML( self.getRequestParams() ) 
    1864          
     1864 
    18651865        #return "<div style='background-color: red;'>&nbsp;&nbsp;&nbsp;&nbsp;</div>" 
    18661866 
    18671867class RHRoomBookingRejectBookingOccurrence( RHRoomBookingBase ): 
    1868      
     1868 
    18691869    def _checkParams( self , params ): 
    18701870        resvID = int( params.get( "resvID" ) ) 
     
    18721872        reason = params.get( "reason" ) 
    18731873        date = params.get( "date" ) 
    1874          
     1874 
    18751875        self._resv = CrossLocationQueries.getReservations( resvID = resvID, location = roomLocation ) 
    18761876        self._rejectionReason = reason 
     
    18861886            ( not self._getUser().isAdmin() ): 
    18871887                raise MaKaCError( "You are not authorized to take this action." ) 
    1888      
     1888 
    18891889    def _process( self ): 
    18901890        self._emailsToBeSent = [] 
    1891         self._resv.excludeDay( self._date ) 
    1892         self._resv.update() 
     1891        self._resv.excludeDay( self._date, unindex=True ) 
     1892        self._resv.update(udpateReservationIndex=False) 
    18931893        self._emailsToBeSent += self._resv.notifyAboutRejection( date = self._date, reason = self._rejectionReason ) 
    1894          
     1894 
    18951895        self._websession.setVar( 'actionSucceeded', True ) 
    18961896        self._websession.setVar( 'title', "Selected occurrence of this booking has been rejected." ) 
Note: See TracChangeset for help on using the changeset viewer.