Changeset d44cf5 in indico


Ignore:
Timestamp:
09/11/09 14:49:18 (4 years ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, new-improved-taskdaemon, new-webex, prov-dual-interface, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 0da0c1403bae8e51d8229f460181c71b9e6dda72
Children:
e64ab6
Parents:
6228d9
Message:

[FIXED] Unhandled exception

File:
1 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/plugins/Collaboration/CERNMCU/pages.py

    rfd0c10 rd44cf5  
    3333 
    3434class WNewBookingForm(WCSPageTemplateBase): 
    35          
     35 
    3636    def getVars(self): 
    3737        vars = WCSPageTemplateBase.getVars( self ) 
    38          
     38 
    3939        vars["EventTitle"] = self._conf.getTitle() 
    4040        vars["EventDescription"] = unescape_html(strip_ml_tags( self._conf.getDescription())).strip() 
     
    4343        vars["MinStartDate"] = formatDateTime(self._conf.getAdjustedStartDate()) 
    4444        vars["MaxEndDate"] = formatDateTime(self._conf.getAdjustedEndDate()) 
    45          
     45 
    4646        return vars 
    4747 
    4848class WMain (WJSBase): 
    49      
     49 
    5050    def getVars(self): 
    5151        vars = WJSBase.getVars( self ) 
    52      
     52 
    5353        vars["MinStartDate"] = formatDateTime(self._conf.getAdjustedStartDate()) 
    5454        vars["MaxEndDate"] = formatDateTime(self._conf.getAdjustedEndDate()) 
    55          
     55 
    5656        location = self._conf.getLocation() 
    5757        room = self._conf.getRoom() 
     
    6464            else: 
    6565                vars["InitialRoomInstitution"] = "" 
    66              
     66 
    6767            # TODO: get IP of room from a plugin option instead of querying RB DB every time 
    6868            try: 
     
    7272                    CrossLocationDB.connect() 
    7373                    Logger.get("CERNMCU").info("Connection successful") 
    74                      
     74 
    7575                    attName = getCERNMCUOptionValueByName("H323_IP_att_name") 
    76                      
     76 
    7777                    returnedRooms = CrossLocationQueries.getRooms( location = location.getName(), roomName = room.getName() ) 
     78 
    7879                    if isinstance(returnedRooms, list): 
    79                         returnedRoom = returnedRooms[0] 
     80                        if len(returnedRooms) == 0: 
     81                            returnedRoom = None 
     82                        else: 
     83                            returnedRoom = returnedRooms[0] 
    8084                    else: 
    8185                        returnedRoom = returnedRooms 
    82                     if attName in returnedRoom.customAtts: 
     86 
     87                    if (returnedRoom != None) and \ 
     88                           (attName in returnedRoom.customAtts): 
     89 
    8390                        initialRoomIp = returnedRoom.customAtts[attName] 
    8491                        if (initialRoomIp.strip() == ""): 
    8592                            vars["IPRetrievalResult"] = 1 
    8693                        elif not validIP(initialRoomIp): 
    87                             vars["IPRetrievalResult"] = 2                     
     94                            vars["IPRetrievalResult"] = 2 
    8895                        else: 
    8996                            vars["IPRetrievalResult"] = 0 
    90                          
     97 
    9198                    else: 
    9299                        initialRoomIp = "IP not defined for this room." 
     
    96103                    vars["IPRetrievalResult"] = 3 
    97104                    Logger.get("CERNMCU").info("Tried to retrieve a room's H323 IP, but Room Booking module was not active.") 
    98                          
     105 
    99106            except MaKaCError, e: 
    100107                initialRoomIp = "IP not found." 
    101108                vars["IPRetrievalResult"] = 4 
    102109                Logger.get("CERNMCU").warning("Problem when retrieving a room's H.323 IP: " + e.getMsg()) 
    103                      
    104              
     110 
     111 
    105112            vars["InitialRoomIP"] = initialRoomIp 
    106              
     113 
    107114        else: 
    108115            vars["IncludeInitialRoom"] = False 
     
    111118            vars["InitialRoomInstitution"] = "" 
    112119            vars["InitialRoomIP"] = "" 
    113          
     120 
    114121        vars["CERNGatekeeperPrefix"] = getCERNMCUOptionValueByName("CERNGatekeeperPrefix") 
    115122        vars["GDSPrefix"] = getCERNMCUOptionValueByName("GDSPrefix") 
    116123        vars["MCU_IP"] = getCERNMCUOptionValueByName("MCU_IP") 
    117124        vars["Phone_number"] = getCERNMCUOptionValueByName("Phone_number") 
    118      
    119         return vars 
    120      
     125 
     126        return vars 
     127 
    121128class WIndexing(WJSBase): 
    122129    pass 
    123      
     130 
    124131class WExtra (WJSBase): 
    125132    def getVars(self): 
    126133        vars = WJSBase.getVars( self ) 
    127          
     134 
    128135        roomsWithH323IP = [] 
    129          
     136 
    130137        if self._conf: 
    131             location = self._conf.getLocation()  
    132              
     138            location = self._conf.getLocation() 
     139 
    133140            if location: 
    134              
     141 
    135142                # TODO: get list of room from a plugin option instead of querying the RB DB everytime 
    136143                try: 
     
    140147                        CrossLocationDB.connect() 
    141148                        Logger.get("CERNMCU").info("Connection successful") 
    142                          
     149 
    143150                        attName = getCERNMCUOptionValueByName("H323_IP_att_name") 
    144                          
    145                          
     151 
     152 
    146153                        returnedRooms = CrossLocationQueries.getRooms( location = location.getName(), 
    147154                                                                       customAtts = [{"name":attName, "allowEmpty":False, 
     
    149156                        if not isinstance(returnedRooms, list): 
    150157                            returnedRooms = [returnedRooms] 
    151          
     158 
    152159                        for room in returnedRooms: 
    153160                            roomsWithH323IP.append(RoomWithH323(location.getName(), room._getName(), room.customAtts[attName])) 
    154                              
     161 
    155162                except MaKaCError, e: 
    156163                    Logger.get("CERNMCU").warning("Problem when retrieving the list of all rooms with a H323 IP: " + e.getMsg()) 
    157          
     164 
    158165        vars["RoomsWithH323IP"] = roomsWithH323IP 
    159166        return vars 
    160      
     167 
    161168class WStyle (WCSCSSBase): 
    162169    pass 
    163170 
    164171class WInformationDisplay(WCSPageTemplateBase): 
    165      
     172 
    166173    def __init__(self, booking, displayTz): 
    167174        WCSPageTemplateBase.__init__(self, booking.getConference(), 'CERNMCU', None) 
    168175        self._booking = booking 
    169176        self._displayTz = displayTz 
    170      
     177 
    171178    def getVars(self): 
    172179        vars = WCSPageTemplateBase.getVars( self ) 
    173          
     180 
    174181        vars["Booking"] = self._booking 
    175          
     182 
    176183        vars["CERNGatekeeperPrefix"] = getCERNMCUOptionValueByName("CERNGatekeeperPrefix") 
    177184        vars["GDSPrefix"] = getCERNMCUOptionValueByName("GDSPrefix") 
    178185        vars["MCU_IP"] = getCERNMCUOptionValueByName("MCU_IP") 
    179186        vars["Phone_number"] = getCERNMCUOptionValueByName("Phone_number") 
    180          
     187 
    181188        return vars 
    182189 
    183190 
    184191class XMLGenerator(object): 
    185      
     192 
    186193    @classmethod 
    187194    def getDisplayName(cls): 
    188195        return "MCU" 
    189              
     196 
    190197    @classmethod 
    191198    def getCustomBookingXML(cls, booking, displayTz, out): 
    192                          
     199 
    193200        out.openTag("information") 
    194          
     201 
    195202        if booking.getHasPin(): 
    196203            out.openTag("section") 
     
    198205            out.writeTag("line", _('This conference is protected by a PIN')) 
    199206            out.closeTag("section") 
    200          
     207 
    201208        out.openTag("section") 
    202209        out.writeTag("title", _('Description:')) 
    203210        out.writeTag("line", booking._bookingParams["description"]) 
    204211        out.closeTag("section") 
    205          
     212 
    206213        out.openTag("section") 
    207214        out.writeTag("title", _('Participants:')) 
     
    212219            out.writeTag("line", _("No participants yet")) 
    213220        out.closeTag("section") 
    214          
     221 
    215222        bookingIdInMCU = str(booking._bookingParams["id"]) 
    216223        out.openTag("section") 
     
    241248        ])) 
    242249        out.closeTag("section") 
    243          
     250 
    244251        out.closeTag("information") 
    245          
     252 
Note: See TracChangeset for help on using the changeset viewer.