Changeset 8a8251 in indico


Ignore:
Timestamp:
06/17/11 14:27:16 (2 years ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 4c7d4152dff271ba5df5a8606605969cab454080
Children:
18d500
Parents:
a7568a
git-author:
Adrian Moennich <jerome.ernst.monnich@…> (06/14/11 16:52:23)
git-committer:
Pedro Ferreira <jose.pedro.ferreira@…> (06/17/11 14:27:16)
Message:

[FIX] Do not try raising strings

  • it fails in recent python versions
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • bin/legacy/sendEmail2PA&Submitters.py

    rbdd862 r8a8251  
    2424to run the code. It was put just like a security reason. 
    2525""" 
    26 raise "delete this line to run the code" 
     26raise Exception("delete this line to run the code") 
    2727 
    2828import sys 
  • bin/legacy/sendEmail2SubmittersUsingTPL.py

    rbdd862 r8a8251  
    2424to run the code. It was put just like a security reason. 
    2525""" 
    26 raise "delete this line to run the code" 
     26raise Exception("delete this line to run the code") 
    2727 
    2828#import sys 
  • bin/legacy/setSubmissionPrivileges.py

    rbdd862 r8a8251  
    3131                assert (len(contrib.getSubmitterList())>=1) 
    3232            except AssertionError: 
    33                 raise "conf %s - contrib %s"%(conf.getId(),contrib.getId()) 
     33                raise Exception("conf %s - contrib %s"%(conf.getId(),contrib.getId())) 
    3434DBMgr.getInstance().endRequest() 
  • indico/MaKaC/common/Configuration.py

    r0c8d04 r8a8251  
    515515 
    516516        if self.getSanitizationLevel() not in range(4): 
    517             raise "Invalid SanitizationLevel value (%s). Valid values: 0, 1, 2, 3" % (self._configVars['SanitizationLevel']) 
     517            raise MaKaCError("Invalid SanitizationLevel value (%s). Valid values: 0, 1, 2, 3" % (self._configVars['SanitizationLevel'])) 
    518518 
    519519 
     
    576576           files are kept 
    577577        """ 
    578         raise "Deprecated Method" 
     578        raise NotImplementedError("Deprecated Method") 
    579579        # return raw_input("\n\nPlease enter the path to the directory that contains the database files") 
    580580 
     
    584584           database files are kept 
    585585        """ 
    586         raise "Deprecated Method" 
     586        raise NotImplementedError("Deprecated Method") 
    587587        # return raw_input("\n\nPlease enter the path to the directory that will contain the database backups [OPTIONAL]\n\n") 
    588588 
  • indico/MaKaC/export/oai2.py

    rd285dc r8a8251  
    592592        elif isinstance(obj, conference.SubContribution): 
    593593            return self.subContToXMLDC(obj, out=out) 
    594         raise "Unknown object type: %s id=%s"%(obj, obj.getId()) 
     594        raise Exception("Unknown object type: %s id=%s"%(obj, obj.getId())) 
    595595 
    596596    def subContToXMLDC(self, subCont, out=None): 
  • indico/MaKaC/plugins/EPayment/skipjack/webinterface/rh/__init__.py

    rc6b710 r8a8251  
    4343    return True 
    4444  except Exception,e: 
    45      raise "%s"%params 
     45     raise Exception(str(params)) 
  • indico/MaKaC/plugins/RoomBooking/CERN/initialize.py

    r336214 r8a8251  
    4343    """ 
    4444    !!! REMOVES DATA !!! 
    45      
     45 
    4646    Deletes all branches related to room booking, 
    4747    from both main and room booking databases. 
    4848    """ 
    4949    if not force: 
    50         raise 'nothing done' 
    51      
     50        raise Exception('nothing done') 
     51 
    5252    indicoRoot = MaKaC.common.DBMgr.getInstance().getDBConnection().root() 
    5353    root = DALManagerCERN().getRoot() 
    5454    minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance() 
    55      
     55 
    5656    # 1. INDICO ----------------------------------------- 
    5757 
     
    6161    if indicoRoot.get( 'DefaultRoomBookingLocation' ): 
    6262        del indicoRoot['DefaultRoomBookingLocation'] 
    63      
     63 
    6464    # 2. ROOM BOKING ------------------------------------ 
    6565 
     
    6868    if root.get( 'Reservations' ): 
    6969        del root['Reservations'] 
    70      
     70 
    7171    # Create indexes 
    7272    if root.get( 'RoomReservationsIndex' ): 
     
    9393    indicoRoot = MaKaC.common.DBMgr.getInstance().getDBConnection().root() 
    9494    root = DALManagerCERN().getRoot() 
    95      
     95 
    9696    # 1. Location ----------------------------------------------------------- 
    97      
     97 
    9898    initialLocation = Location( location, FactoryCERN ) 
    9999    if force or not indicoRoot.has_key( 'RoomBookingLocationList' ): 
     
    103103        indicoRoot['DefaultRoomBookingLocation'] = location 
    104104        print "Default location set to " + location 
    105      
     105 
    106106    # 2. Rooms & Bookings --------------------------------------------------- 
    107107 
     
    115115        root['Reservations'] = IOBTree() 
    116116        print "Reservations branch created" 
    117      
     117 
    118118    # Create indexes 
    119119    if force or not root.has_key( 'RoomReservationsIndex' ): 
     
    140140def main( **kwargs ): 
    141141    location = kwargs.get( 'location', 'Universe' ) 
    142      
     142 
    143143    from MaKaC.rb_factory import Factory 
    144144    from MaKaC.common.db import DBMgr 
  • indico/MaKaC/plugins/RoomBooking/default/initialize.py

    r336214 r8a8251  
    4343    """ 
    4444    !!! REMOVES DATA !!! 
    45      
     45 
    4646    Deletes all branches related to room booking, 
    4747    from both main and room booking databases. 
    4848    """ 
    4949    if not force: 
    50         raise 'nothing done' 
    51      
     50        raise Exception('nothing done') 
     51 
    5252    indicoRoot = MaKaC.common.DBMgr.getInstance().getDBConnection().root() 
    5353    root = DALManagerCERN().getRoot() 
    5454    minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance() 
    55      
     55 
    5656    # 1. INDICO ----------------------------------------- 
    5757 
     
    6161    if indicoRoot.get( 'DefaultRoomBookingLocation' ): 
    6262        del indicoRoot['DefaultRoomBookingLocation'] 
    63      
     63 
    6464    # 2. ROOM BOKING ------------------------------------ 
    6565 
     
    6868    if root.get( 'Reservations' ): 
    6969        del root['Reservations'] 
    70      
     70 
    7171    # Create indexes 
    7272    if root.get( 'RoomReservationsIndex' ): 
     
    9393    indicoRoot = MaKaC.common.DBMgr.getInstance().getDBConnection().root() 
    9494    root = DALManagerCERN().getRoot() 
    95      
     95 
    9696    # 1. Location ----------------------------------------------------------- 
    97      
     97 
    9898    initialLocation = Location( location, FactoryCERN ) 
    9999    if force or not indicoRoot.has_key( 'RoomBookingLocationList' ): 
     
    103103        indicoRoot['DefaultRoomBookingLocation'] = location 
    104104        print "Default location set to " + location 
    105      
     105 
    106106    # 2. Rooms & Bookings --------------------------------------------------- 
    107107 
     
    115115        root['Reservations'] = IOBTree() 
    116116        print "Reservations branch created" 
    117      
     117 
    118118    # Create indexes 
    119119    if force or not root.has_key( 'RoomReservationsIndex' ): 
     
    140140def main( **kwargs ): 
    141141    location = kwargs.get( 'location', 'Universe' ) 
    142      
     142 
    143143    from MaKaC.rb_factory import Factory 
    144144    from MaKaC.common.db import DBMgr 
  • indico/MaKaC/rb_customAttributesManager.py

    rbdd862 r8a8251  
    2525 
    2626class CustomAttributesManagerBase: 
    27     """  
     27    """ 
    2828    Generic manager for room attributes that are plugin-specific. 
    29      
     29 
    3030    It manages the list of rooms' possible attributes. 
    3131    The list does NOT include core attributes (like id, 
    32     room number etc.) This is only to manage plugin-specific  
     32    room number etc.) This is only to manage plugin-specific 
    3333    attributes, called _Custom_Attributes_. 
    3434 
    3535    All attributes are strings. 
    36      
    37     The list of possible equipment is defined either  
     36 
     37    The list of possible equipment is defined either 
    3838    programmatically in CustomAttributesManagerLOCATION 
    39     implementation or by the Room Booking admin  
    40     (if plugin permits).  
    41      
     39    implementation or by the Room Booking admin 
     40    (if plugin permits). 
     41 
    4242    This list is used mainly for generating user web interface. 
    4343    """ 
     
    4646    def supportsAttributeManagement( *args, **kwargs ): 
    4747        """ 
    48         Returns True if plugin supports adding and  
     48        Returns True if plugin supports adding and 
    4949        removing room attributes (modyfing 'room shema'). 
    5050        Otherwise returns False. 
    5151        """ 
    5252        return False 
    53      
     53 
    5454    @staticmethod 
    5555    def getAttributes( *args, **kwargs ): 
     
    6060    def setAttributes( customAttributeList, *args, **kwargs ): 
    6161        """ Sets the List of rooms' custom attributes. """ 
    62         raise 'This plugin does not support modyfing the list of room attributes' 
    63      
     62        raise NotImplementedError('This plugin does not support modyfing the list of room attributes') 
     63 
    6464    @staticmethod 
    6565    def insertAttribute( customAttribute, *args, **kwargs ): 
    6666        """ Adds new attribute to the list of custom attributes.""" 
    67         raise 'This plugin does not support modyfing the list of room attributes' 
    68      
     67        raise NotImplementedError('This plugin does not support modyfing the list of room attributes') 
     68 
    6969    @staticmethod 
    7070    def removeAttribute( customAttributeName, *args, **kwargs ): 
    7171        """ Deletes attribute from the list of custom attributes. """ 
    72         raise 'This plugin does not support modyfing the list of room attributes' 
    73      
     72        raise NotImplementedError('This plugin does not support modyfing the list of room attributes') 
     73 
    7474    @staticmethod 
    7575    def setRequired( customAttributeName, isRequired, *args, **kwargs ): 
    7676        """ Sets the 'required' attribute of the custom attribute. """ 
    77         raise 'This plugin does not support modyfing the list of room attributes' 
    78      
     77        raise NotImplementedError('This plugin does not support modyfing the list of room attributes') 
     78 
    7979    @staticmethod 
    8080    def setHidden( customAttributeName, isHidden, *args, **kwargs ): 
    8181        """ Sets the 'hidden' attribute of the custom attribute. """ 
    82         raise 'This plugin does not support modyfing the list of room attributes' 
    83      
     82        raise NotImplementedError('This plugin does not support modyfing the list of room attributes') 
     83 
    8484    @staticmethod 
    8585    def checkAttribute( at ): 
  • indico/MaKaC/rb_location.py

    ra7568a r8a8251  
    191191        _ensureZODBBranch() 
    192192        if not isinstance( location, Location ): 
    193             raise 'location attribute must be of Location class' 
     193            raise MaKaCError('location attribute must be of Location class') 
    194194        if Location.parse(location.friendlyName): 
    195195            # location with same name already exists 
     
    206206        _ensureZODBBranch() 
    207207        if not isinstance( locationName, str ): 
    208             raise 'locationName attribute must be string' 
     208            raise MaKaCError('locationName attribute must be string') 
    209209        root = MaKaC.common.DBMgr.getInstance().getDBConnection().root() 
    210210        locations = root[_ROOM_BOOKING_LOCATION_LIST] 
     
    347347        """ 
    348348        if not isinstance( location, Location ): 
    349             raise 'location attribute must be of Location class' 
     349            raise MaKaCError('location attribute must be of Location class') 
    350350        self.location = location 
    351351        self.id = id 
     
    369369            loc = loc.strip(); id = int( id.strip() ) 
    370370            self.location = Location.parse( loc ) 
    371             if not self.location: raise '' 
     371            if not self.location: 
     372                raise MaKaCError('invalid location') 
    372373            self.id = id 
    373374        except: 
     
    397398        """ 
    398399        if not isinstance( location, Location ): 
    399             raise 'location attribute must be of Location class' 
     400            raise MaKaCError('location attribute must be of Location class') 
    400401        self.location = location 
    401402        self.id = id 
     
    419420            id = int( id.strip() ) 
    420421            location = Location.parse( loc ) 
    421             if not location: raise 'Cannot parse location' 
     422            if not location: 
     423                raise MaKaCError('Cannot parse location') 
    422424            return RoomGUID( location, id ) 
    423425        except: 
  • indico/MaKaC/rb_reservation.py

    r45a4a3 r8a8251  
    2828from MaKaC.rb_location import ReservationGUID, Location, CrossLocationQueries 
    2929from MaKaC.accessControl import AccessWrapper 
     30from MaKaC.errors import MaKaCError 
    3031from MaKaC.user import AvatarHolder, Avatar 
    3132from MaKaC.common.Configuration import Config 
     
    586587 
    587588        if ( rooms == None and self.room == None ) or self.startDT == None or self.endDT == None: 
    588             raise 'room, startDT, endDT fields must not be None' 
     589            raise MaKaCError('room, startDT, endDT fields must not be None') 
    589590 
    590591        if rooms == None: 
     
    712713            return Period( retStartDT, retEndDT ) 
    713714 
    714         raise 'Unknown repeatability type.' 
     715        raise MaKaCError('Unknown repeatability type.') 
    715716 
    716717    def overlapsOn( self, startDT, endDT ): 
     
    787788            return False 
    788789 
    789         raise "Unknown repeatability type" 
     790        raise MaKaCError("Unknown repeatability type") 
    790791 
    791792    # Excluded days management ---------------------------------------------- 
     
    820821        for d in excludedDays: 
    821822            if not isinstance( d, date ): 
    822                 raise 'excludedDays must contain only objects of date type (NOT datetime)' 
     823                raise MaKaCError('excludedDays must contain only objects of date type (NOT datetime)') 
    823824 
    824825    def excludeDay( self, dayD ): 
     
    830831            return 'Not applicable to non-repeating reservations.' 
    831832        if not isinstance( dayD, date ): 
    832             raise 'dayD must be of date type (NOT datetime)' 
     833            raise MaKaCError('dayD must be of date type (NOT datetime)') 
    833834 
    834835    def includeDay( self, dayD ): 
     
    840841            return 'Not applicable to non-repeating reservations.' 
    841842        if not isinstance( dayD, date ): 
    842             raise 'dayD must be of date type (NOT datetime)' 
     843            raise MaKaCError('dayD must be of date type (NOT datetime)') 
    843844 
    844845    def dayIsExcluded( self, dayD ): 
     
    849850            return 'Not applicable to non-repeating reservations.' 
    850851        if not isinstance( dayD, date ): 
    851             raise 'dayD must be of date type (NOT datetime)' 
     852            raise MaKaCError('dayD must be of date type (NOT datetime)') 
    852853 
    853854 
     
    11451146            user = accessWrapper 
    11461147        else: 
    1147             raise 'canModify requires either AccessWrapper or Avatar object' 
     1148            raise MaKaCError('canModify requires either AccessWrapper or Avatar object') 
    11481149        if not user: 
    11491150            return False 
  • indico/MaKaC/rb_room.py

    rd8fdf0 r8a8251  
    2828from MaKaC.user import Avatar, AvatarHolder 
    2929from MaKaC.accessControl import AccessWrapper 
     30from MaKaC.errors import MaKaCError 
    3031from datetime import datetime, timedelta 
    3132 
     
    356357            self._equipment = eq 
    357358            return 
    358         raise 'Invalid equipment list' 
     359        raise MaKaCError('Invalid equipment list') 
    359360 
    360361    def getEquipment( self ): 
     
    381382    def isCloseToBuilding( self, buildingNr ): 
    382383        """ Returns true if room is close to the specified building """ 
    383         raise 'Not implemented' 
     384        raise NotImplementedError('Not implemented') 
    384385 
    385386    def belongsTo( self, user ): 
    386387        """ Returns true if current CrbsUser is responsible for this room """ 
    387         raise 'Not implemented' 
     388        raise NotImplementedError('Not implemented') 
    388389 
    389390    # "System" --------------------------------------------------------------- 
     
    562563            return accessWrapper.isAdmin() 
    563564 
    564         raise 'canModify requires either AccessWrapper or Avatar object' 
     565        raise MaKaCError('canModify requires either AccessWrapper or Avatar object') 
    565566 
    566567    def canDelete( self, user ): 
     
    597598    def setLocationName( self, locationName ): 
    598599        if self.__class__.__name__ == 'RoomBase': 
    599             raise 'This method is purely virtual. Call it only on derived objects.' 
     600            raise MaKaCError('This method is purely virtual. Call it only on derived objects.') 
    600601        return self.setLocationName( locationName ) # Subclass 
    601602 
  • indico/MaKaC/rb_tools.py

    r3fa943 r8a8251  
    155155    if len( args ) == 2: 
    156156        return __doesPeriodsOverlap( args[0].startDT, args[0].endDT, args[1].startDT, args[1].endDT ) 
    157     raise '2 or 4 arguments required: (period, period) or ( start1, end1, start2, end2 )' 
     157    raise ValueError('2 or 4 arguments required: (period, period) or ( start1, end1, start2, end2 )') 
    158158 
    159159def __doesPeriodsOverlap( startDT1, endDT1, startDT2, endDT2 ): 
     
    179179    if len( args ) == 2: 
    180180        return __overlap( args[0].startDT, args[0].endDT, args[1].startDT, args[1].endDT ) 
    181     raise '2 or 4 arguments required: (period, period) or ( start1, end1, start2, end2 )' 
     181    raise ValueError('2 or 4 arguments required: (period, period) or ( start1, end1, start2, end2 )') 
    182182 
    183183 
     
    231231        pass 
    232232    """ 
    233     if not isinstance( first, datetime ): raise 'pass datetime' #first = datetime( first.year, first.month, first.day ) 
    234     if not isinstance( last, datetime ): raise 'pass datetime'  #last = datetime(  last.year, last.month, last.day ) 
     233    if not isinstance( first, datetime ): raise TypeError('pass datetime') #first = datetime( first.year, first.month, first.day ) 
     234    if not isinstance( last, datetime ): raise TypeError('pass datetime')  #last = datetime(  last.year, last.month, last.day ) 
    235235    for day in range((last - first).days + 1): 
    236236        yield first + timedelta(day) 
     
    281281        return None 
    282282    if localNaiveDT.tzinfo != None: 
    283         raise 'This methods converts only _naive_ datetimes, assuming they are in local/DTS time. Naive datetimes does not contain information about timezone.' 
     283        raise ValueError('This methods converts only _naive_ datetimes, assuming they are in local/DTS time. Naive datetimes does not contain information about timezone.') 
    284284    return localNaiveDT + timedelta( 0, time.altzone ) 
    285285 
     
    290290    try: 
    291291        if utcNaiveDT.tzinfo != None: 
    292             raise 'This methods converts only _naive_ datetimes, assuming they are in UTC time. Naive datetimes does not contain information about timezone.' 
     292            raise ValueError('This methods converts only _naive_ datetimes, assuming they are in UTC time. Naive datetimes does not contain information about timezone.') 
    293293        return utcNaiveDT - timedelta( 0, time.altzone ) 
    294294    except AttributeError: 
  • indico/MaKaC/webinterface/pages/conf_calendar.py

    re0ef1f r8a8251  
    3535from MaKaC.common.utils import HolidaysHolder 
    3636import MaKaC.common.timezoneUtils as timezoneUtils 
     37from MaKaC.errors import MaKaCError 
    3738 
    3839 
     
    510511                            bgcolor="#ffcccc" 
    511512                    except Exception,e: 
    512                         raise "%s-%s-%s------%s-%s-%s\nself._date:%s\ndate2:%s"%(year,month,day,y,m,d, self._date,date2) 
     513                        raise MaKaCError("%s-%s-%s------%s-%s-%s\nself._date:%s\ndate2:%s"%(year,month,day,y,m,d, self._date,date2)) 
    513514 
    514515                    url.addParam("day", day) 
  • indico/MaKaC/webinterface/rh/ePaymentModif.py

    re06a20 r8a8251  
    2626from MaKaC.webinterface.rh.conferenceDisplay import RHConferenceBaseDisplay 
    2727#from MaKaC.registration import AccommodationType, SocialEventItem, RegistrationSession, GeneralSectionForm, GeneralField, FieldInputs, RadioItem, Status, StatusValue 
    28 from MaKaC.errors import FormValuesError 
     28from MaKaC.errors import FormValuesError, MaKaCError 
    2929from MaKaC.common import HelperMaKaCInfo 
    3030from MaKaC.i18n import _ 
     
    234234                rhmod = module.webinterface.rh 
    235235            except: 
    236                 raise "%s"%module 
     236                raise MaKaCError("%s"%module) 
    237237            requestTag = params.get("requestTag", "No requestTag") 
    238238            rh = rhmod.getRHByTag(rhmod, requestTag) 
  • indico/MaKaC/webinterface/rh/taskList.py

    rbdd862 r8a8251  
    4646class RHTaskList( RHCategDisplayBase ): 
    4747    _uh = urlHandlers.UHTaskList 
    48      
    49     def _process( self ):         
     48 
     49    def _process( self ): 
    5050        params = self._getRequestParams() 
    5151        order = params.get("order","1") 
     
    5858class RHTaskListAction( RHCategDisplayBase ): 
    5959    _uh = urlHandlers.UHTaskListAction 
    60      
    61     def _process( self ):         
    62         params = self._getRequestParams() 
    63          
     60 
     61    def _process( self ): 
     62        params = self._getRequestParams() 
     63 
    6464        if params.get("actionPerformed",None) is None : 
    6565            p = tasks.WPTaskList( self, self._target) 
     
    6969            url.addParam("clear","true") 
    7070            self._redirect(url) 
    71             return      
    72         if params["actionPerformed"] == _("Apply filter") :             
     71            return 
     72        if params["actionPerformed"] == _("Apply filter") : 
    7373            filter = params.get("filter","") 
    7474            p = tasks.WPTaskList( self, self._target, filter) 
     
    8282class RHTaskNew( RHTaskModifBase ): 
    8383    _uh = urlHandlers.UHTaskNew 
    84      
    85      
     84 
     85 
    8686    def _checkParams( self, params): 
    8787        RHTaskModifBase._checkParams(self,params) 
     
    9090            self._removePreservedParams() 
    9191            del params["clear"] 
    92      
    93     def _process( self ):         
     92 
     93    def _process( self ): 
    9494        preservedParams = self._getPreservedParams() 
    9595        params = self._getRequestParams() 
     
    9797        params["createdBy"] = self._getUser().getFullName() 
    9898        params["creatorId"] = self._getUser().getId() 
    99          
     99 
    100100        params = copy(params) 
    101          
     101 
    102102        params["responsibleOptions"] = self._getResponsibleOptions() 
    103103        params["responsibleDefined"] = self._getDefinedList("responsible",False) 
    104          
     104 
    105105        p = tasks.WPTaskNew( self, self._target, params) 
    106106        return p.display() 
     
    112112        return params 
    113113 
    114     def _getResponsibleOptions(self):  
    115         html = []         
     114    def _getResponsibleOptions(self): 
     115        html = [] 
    116116        for t in self._target.getTaskList() : 
    117117            index = 0 
     
    121121        return """ 
    122122                """.join(html) 
    123      
     123 
    124124    def _getDefinedList(self, typeName, submission): 
    125125        lis = self._websession.getVar("%sList"%typeName) 
    126126        if lis is None : 
    127127            return "" 
    128          
     128 
    129129        html = [] 
    130130        counter = 0 
     
    133133            if submission and person[1] : 
    134134                subm = _("""<td> _("submiter")</td>""") 
    135                  
     135 
    136136            text = """ 
    137137                <tr> 
     
    144144        return """ 
    145145            """.join(html) 
    146      
     146 
    147147    def _removeDefinedList(self, typeName): 
    148148        self._websession.setVar("%sList"%typeName,None) 
    149          
     149 
    150150    def _removePreservedParams(self): 
    151151        self._websession.setVar("preservedParams",None) 
    152      
    153     def _personInDefinedList(self, typeName, person):     
     152 
     153    def _personInDefinedList(self, typeName, person): 
    154154        lis = self._websession.getVar("%sList"%typeName) 
    155155        if lis is None : 
     
    159159                return True 
    160160        return False 
    161      
     161 
    162162#--------------------------------------------------------------- 
    163163 
    164164class RHTaskNewAdd( RHTaskModifBase ): 
    165165    _uh = urlHandlers.UHTaskNewAdd 
    166      
    167      
    168     def _process( self ):         
     166 
     167 
     168    def _process( self ): 
    169169        params = self._getRequestParams() 
    170170 
     
    175175            url.addParam("orgin","added") 
    176176            url.addParam("typeName","responsible") 
    177             self._redirect(url)    
     177            self._redirect(url) 
    178178            return 
    179179        if params.get("performedAction","") == "New responsible" : 
     
    191191        if params.get("performedAction","") == "Remove responsibles" : 
    192192            self._removePersons(params, "responsible") 
    193              
     193 
    194194            self._redirect(urlHandlers.UHTaskNew.getURL(self._target)) 
    195195            return 
    196196        if params.has_key("cancel") : 
    197197            self._removePreservedParams() 
    198             self._removeDefinedList("responsible")             
     198            self._removeDefinedList("responsible") 
    199199        if params.get("performedAction","") == _("ok") : 
    200200            task = self._target.newTask(self._getUser()) 
     
    205205            for responsible in responsibleList : 
    206206                task.addResponsible(responsible[0]) 
    207              
     207 
    208208            self._removePreservedParams() 
    209             self._removeDefinedList("responsible")             
    210              
     209            self._removeDefinedList("responsible") 
     210 
    211211        self._redirect(urlHandlers.UHTaskList.getURL(self._target)) 
    212212 
     
    215215        preservedParams = self._getRequestParams().copy() 
    216216        self._websession.setVar("preservedParams",preservedParams) 
    217      
     217 
    218218    def _removePersons(self, params, typeName): 
    219          
     219 
    220220        persons = self._normaliseListParam(params.get("%ss"%typeName,[])) 
    221221        definedList = self._getDefinedList(typeName) 
     
    227227            definedList.remove(person) 
    228228        self._setDefinedList(definedList,typeName) 
    229          
     229 
    230230    def _removePreservedParams(self): 
    231231        self._websession.setVar("preservedParams",None) 
    232      
     232 
    233233    def _removeDefinedList(self, typeName): 
    234         self._websession.setVar("%sList"%typeName,None)  
    235          
     234        self._websession.setVar("%sList"%typeName,None) 
     235 
    236236    def _getDefinedList(self, typeName): 
    237237        definedList = self._websession.getVar("%sList"%typeName) 
     
    239239            return [] 
    240240        return definedList 
    241          
     241 
    242242    def _setDefinedList(self, definedList, typeName): 
    243243        self._websession.setVar("%sList"%typeName,definedList) 
    244     
     244 
    245245#-------------------------------------------------------------------------- 
    246246 
     
    250250    def _checkParams( self, params): 
    251251        RHTaskModifBase._checkParams(self,params) 
    252          
    253     def _process( self ): 
    254         params = self._getRequestParams() 
    255          
     252 
     253    def _process( self ): 
     254        params = self._getRequestParams() 
     255 
    256256        params["newButtonAction"] = str(urlHandlers.UHTaskNewResponsibleNew.getURL()) 
    257257        addURL = urlHandlers.UHTaskNewPersonAdd.getURL() 
     
    261261        p = tasks.WPTaskNewResponsibleSelect( self, self._target) 
    262262        return p.display(**params) 
    263     
     263 
    264264#------------------------------------------------------------------------------------- 
    265265 
     
    272272        if self._typeName  is None : 
    273273            raise MaKaCError( _("Type name of the person to add is not set.")) 
    274          
     274 
    275275    def _process( self ): 
    276276        params = self._getRequestParams() 
    277277        self._errorList = [] 
    278          
     278 
    279279        #raise "%s"%params 
    280280        definedList = self._getDefinedList(self._typeName) 
    281281        if definedList is None : 
    282282            definedList = [] 
    283          
     283 
    284284        if params.get("orgin","") == "new" : 
    285285            #raise "new" 
    286286            if params.get("ok",None) is None : 
    287                 raise "not ok" 
     287                raise MaKaCError("not ok") 
    288288                self._redirect(urlHandlers.UHTaskNew.getURL(self._target)) 
    289289                return 
    290             else :                 
     290            else: 
    291291                person = ContributionParticipation() 
    292292                person.setFirstName(params["name"]) 
     
    297297                person.setPhone(params["phone"]) 
    298298                person.setTitle(params["title"]) 
    299                 person.setFax(params["fax"])                 
    300                 if not self._alreadyDefined(person, definedList) :                     
    301                     definedList.append([person,params.has_key("submissionControl")])     
     299                person.setFax(params["fax"]) 
     300                if not self._alreadyDefined(person, definedList) : 
     301                    definedList.append([person,params.has_key("submissionControl")]) 
    302302                else : 
    303303                    self._errorList.append( _("%s has been already defined as %s of this contribution")%(person.getFullName(),self._typeName)) 
    304          
     304 
    305305        elif params.get("orgin","") == "selected" : 
    306306            selectedList = self._normaliseListParam(self._getRequestParams().get("selectedPrincipals",[])) 
     
    311311                else : 
    312312                    ph = user.PrincipalHolder() 
    313                     selected = ph.getById(s)                             
     313                    selected = ph.getById(s) 
    314314                if isinstance(selected, user.Avatar) : 
    315315                    person = ContributionParticipation() 
     
    319319                    else : 
    320320                        self._errorList.append( _("%s has been already defined as %s of this contribution")%(person.getFullName(),self._typeName)) 
    321                          
    322                 elif isinstance(selected, user.Group) :  
     321 
     322                elif isinstance(selected, user.Group) : 
    323323                    for member in selected.getMemberList() : 
    324324                        person = ContributionParticipation() 
    325325                        person.setDataFromAvatar(member) 
    326326                        if not self._alreadyDefined(person, definedList) : 
    327                             definedList.append([person,params.has_key("submissionControl")])             
     327                            definedList.append([person,params.has_key("submissionControl")]) 
    328328                        else : 
    329329                            self._errorList.append( _("%s has been already defined as %s of this contribution")%(presenter.getFullName(),self._typeName)) 
    330                 else :  
    331                     person = ContributionParticipation()                                             
     330                else : 
     331                    person = ContributionParticipation() 
    332332                    person.setTitle(selected.getTitle()) 
    333333                    person.setFirstName(selected.getFirstName()) 
     
    342342                    else : 
    343343                        self._errorList.append( _("%s has been already defined as %s of this contribution")%(person.getFullName(),self._typeName)) 
    344                  
     344 
    345345        elif params.get("orgin","") == "added" : 
    346346            preservedParams = self._getPreservedParams() 
    347347            chosen = preservedParams.get("%sChosen"%self._typeName,None) 
    348             if chosen is None or chosen == "" :  
     348            if chosen is None or chosen == "" : 
    349349                self._redirect(urlHandlers.UHConfModScheduleNewContrib.getURL(self._target)) 
    350                 return             
     350                return 
    351351            index = chosen.find("-") 
    352352            taskId = chosen[0:index] 
     
    357357                self._redirect(urlHandlers.UHConfModScheduleNewContrib.getURL(self._target)) 
    358358                return 
    359             person = ContributionParticipation()                                             
     359            person = ContributionParticipation() 
    360360            person.setTitle(chosenPerson.getTitle()) 
    361361            person.setFirstName(chosenPerson.getFirstName()) 
     
    367367            person.setFax(chosenPerson.getFax()) 
    368368            if not self._alreadyDefined(person, definedList) : 
    369                 definedList.append([person,params.has_key("submissionControl")])     
     369                definedList.append([person,params.has_key("submissionControl")]) 
    370370            else : 
    371371                self._errorList.append( _("%s has been already defined as %s of this contribution")%(person.getFullName(),self._typeName)) 
     
    377377        self._preserveParams(preservedParams) 
    378378        self._websession.setVar("%sList"%self._typeName,definedList) 
    379          
     379 
    380380        self._redirect(urlHandlers.UHTaskNew.getURL(self._target)) 
    381381 
     
    386386            return [] 
    387387        return definedList 
    388          
     388 
    389389    def _alreadyDefined(self, person, definedList): 
    390390        if person is None : 
     
    403403            return {} 
    404404        return params 
    405      
     405 
    406406    def _preserveParams(self, params): 
    407407        self._websession.setVar("preservedParams",params) 
     
    417417    def _checkParams( self, params): 
    418418        RHTaskModifBase._checkParams(self,params) 
    419          
     419 
    420420    def _process( self ): 
    421421        p = tasks.WPTaskNewResponsibleNew( self, self._target) 
     
    427427class RHTaskDetails( RHCategDisplayBase ): 
    428428    _uh = urlHandlers.UHTaskDetails 
    429      
    430     def _process( self ):         
     429 
     430    def _process( self ): 
    431431        params = self._getRequestParams() 
    432432        if params.get("taskId",None) is None : 
     
    443443        elif user in task.getResponsibleList() or user.getEmail() in emails : 
    444444            params["editRights"] = "True" 
    445         else :              
     445        else : 
    446446            params["editRights"] = "False" 
    447          
     447 
    448448        p = tasks.WPTaskDetails( self, task, params) 
    449449        return p.display() 
    450450 
    451          
     451 
    452452class RHTaskDetailsAction( RHCategDisplayBase ): 
    453453    _uh = urlHandlers.UHTaskDetailsAction 
    454      
    455     def _process( self ):         
    456         params = self._getRequestParams() 
    457          
     454 
     455    def _process( self ): 
     456        params = self._getRequestParams() 
     457 
    458458        #raise "%s"%params 
    459459        if params.get("taskId",None) is None : 
     
    469469        if params.get("performedAction","") == _("Hide comments list") : 
    470470            del params["showComments"] 
    471          
     471 
    472472        if params.get("performedAction","") == _("Show status history") : 
    473473            params["showStatus"] = "true" 
    474474        if params.get("performedAction","") == _("Hide status history") : 
    475475            del params["showStatus"] 
    476          
     476 
    477477        if params.get("performedAction","") == _("Change status") : 
    478478            status = TaskStatus(params["changedStatus"],self._getUser()) 
    479479            task.changeStatus(status) 
    480480            params["showStatus"] = "true" 
    481          
     481 
    482482        if params.get("performedAction","") == "Add as responsible" : 
    483483            resId = params.get("responsibleChosen",None) 
     
    488488                responsible = self._target.getTask(taskId).getResponsibleList()[int(resId)] 
    489489                task.addResponsible(responsible) 
    490                  
     490 
    491491        if params.get("performedAction","") == "Remove responsibles" : 
    492492            toRemove = self._normaliseListParam(params.get("responsibles",[])) 
     
    498498                    task.removeResponsible(r) 
    499499        if params.get("performedAction","") == "New responsible" : 
    500             url = urlHandlers.UHTaskDetailsResponsibleSearch.getURL(task)   
     500            url = urlHandlers.UHTaskDetailsResponsibleSearch.getURL(task) 
    501501            url.addParam("taskId",params["taskId"]) 
    502502            self._redirect(url) 
    503503            return 
    504                      
     504 
    505505        if params.get("performedAction","") == "New comment" : 
    506506            url = urlHandlers.UHTaskCommentNew.getURL(task) 
     
    508508            self._redirect(url) 
    509509            return 
    510                      
    511          
     510 
     511 
    512512        p = tasks.WPTaskDetails( self, task, params) 
    513513        return p.display() 
     
    520520    def _checkParams( self, params): 
    521521        RHCategDisplayBase._checkParams(self,params) 
    522          
    523     def _process( self ): 
    524         params = self._getRequestParams() 
    525          
     522 
     523    def _process( self ): 
     524        params = self._getRequestParams() 
     525 
    526526        params["newButtonAction"] = str(urlHandlers.UHTaskDetailsResponsibleNew.getURL()) 
    527527        addURL = urlHandlers.UHTaskDetailsPersonAdd.getURL() 
     
    530530        #addURL.addParam("taskId",params["taskId"]) 
    531531        params["addURL"] = addURL 
    532          
     532 
    533533        p = tasks.WPTaskDetailsResponsibleSelect( self, self._target) 
    534534        return p.display(**params) 
    535     
     535 
    536536#------------------------------------------------------------------------------------- 
    537537 
     
    544544        if self._typeName  is None : 
    545545            raise MaKaCError( _("Type name of the person to add is not set.")) 
    546          
     546 
    547547    def _process( self ): 
    548548        params = self._getRequestParams() 
    549549        self._errorList = [] 
    550          
     550 
    551551        #raise "%s"%params 
    552552        taskId = params["taskId"] 
    553553 
    554554        taskObject = self._target.getTask(taskId) 
    555         if params.get("orgin","") == "new" :             
     555        if params.get("orgin","") == "new" : 
    556556            if params.get("ok",None) is None : 
    557                 raise "not ok" 
     557                raise MaKaCError("not ok") 
    558558                url = urlHandlers.UHTaskDetails.getURL(self._target) 
    559559                url.addParam("taskId",params["taskId"]) 
    560560                self._redirect(url) 
    561561                return 
    562             else :                 
     562            else : 
    563563                person = ContributionParticipation() 
    564564                person.setFirstName(params["name"]) 
     
    569569                person.setPhone(params["phone"]) 
    570570                person.setTitle(params["title"]) 
    571                 person.setFax(params["fax"])                 
    572                 if not self._alreadyDefined(person, taskObject.getResponsibleList()) :                     
     571                person.setFax(params["fax"]) 
     572                if not self._alreadyDefined(person, taskObject.getResponsibleList()) : 
    573573                    taskObject.addResponsible(person) 
    574574                else : 
    575575                    self._errorList.append("%s has been already defined as %s of this task"%(person.getFullName(),self._typeName)) 
    576          
     576 
    577577        elif params.get("orgin","") == "selected" : 
    578578            selectedList = self._normaliseListParam(self._getRequestParams().get("selectedPrincipals",[])) 
     
    583583                else : 
    584584                    ph = user.PrincipalHolder() 
    585                     selected = ph.getById(s)                             
     585                    selected = ph.getById(s) 
    586586                if isinstance(selected, user.Avatar) : 
    587587                    person = ContributionParticipation() 
    588588                    person.setDataFromAvatar(selected) 
    589                     if not self._alreadyDefined(person, taskObject.getResponsibleList()) :                     
     589                    if not self._alreadyDefined(person, taskObject.getResponsibleList()) : 
    590590                        taskObject.addResponsible(person) 
    591591                    else : 
    592592                        self._errorList.append("%s has been already defined as %s of this task"%(person.getFullName(),self._typeName)) 
    593                          
    594                 elif isinstance(selected, user.Group) :  
     593 
     594                elif isinstance(selected, user.Group) : 
    595595                    for member in selected.getMemberList() : 
    596596                        person = ContributionParticipation() 
    597597                        person.setDataFromAvatar(member) 
    598                         if not self._alreadyDefined(person, taskObject.getResponsibleList()) :                     
     598                        if not self._alreadyDefined(person, taskObject.getResponsibleList()) : 
    599599                            taskObject.addResponsible(person) 
    600600                        else : 
    601601                            self._errorList.append("%s has been already defined as %s of this task"%(person.getFullName(),self._typeName)) 
    602                          
    603                 else :  
    604                     person = ContributionParticipation()                                             
     602 
     603                else : 
     604                    person = ContributionParticipation() 
    605605                    person.setTitle(selected.getTitle()) 
    606606                    person.setFirstName(selected.getFirstName()) 
     
    611611                    person.setPhone(selected.getPhone()) 
    612612                    person.setFax(selected.getFax()) 
    613                     if not self._alreadyDefined(person, taskObject.getResponsibleList()) :                     
     613                    if not self._alreadyDefined(person, taskObject.getResponsibleList()) : 
    614614                        taskObject.addResponsible(person) 
    615615                    else : 
     
    620620                self._redirect(url) 
    621621                return 
    622          
     622 
    623623        url = urlHandlers.UHTaskDetails.getURL(self._target) 
    624624        url.addParam("taskId",params["taskId"]) 
     
    643643    def _checkParams( self, params): 
    644644        RHTaskModifBase._checkParams(self,params) 
    645          
     645 
    646646    def _process( self ): 
    647647        params = self._getRequestParams() 
    648648        p = tasks.WPTaskDetailsResponsibleNew( self, self._target, params) 
    649649        return p.display() 
    650          
    651          
     650 
     651 
    652652#-------------------------------------------------------------------------- 
    653653 
    654654class RHTaskCommentNew( RHTaskModifBase ): 
    655655    _uh = urlHandlers.UHTaskCommentNew 
    656      
    657     def _process( self ):         
     656 
     657    def _process( self ): 
    658658        params = self._getRequestParams() 
    659659        if params.get("taskId",None) is None : 
    660660            raise MaKaCError( _("Task id is not set - cannot add a comment")) 
    661              
     661 
    662662        params["commentedBy"] = self._getUser().getFullName() 
    663          
     663 
    664664        p = tasks.WPTaskCommentNew( self, self._target, params) 
    665665        return p.display() 
     
    668668class RHTaskCommentNewAction( RHTaskModifBase ): 
    669669    _uh = urlHandlers.UHTaskCommentNewAction 
    670      
    671     def _process( self ):         
     670 
     671    def _process( self ): 
    672672        params = self._getRequestParams() 
    673673        if params.get("taskId",None) is None : 
    674674            raise MaKaCError( _("Task id is not set - cannot add a comment")) 
    675                      
    676         task = self._target.getTask(params["taskId"])             
     675 
     676        task = self._target.getTask(params["taskId"]) 
    677677        if params.get("performedAction","") == "ok" : 
    678678            task.addComment(self._getUser(),params["commentText"]) 
    679          
     679 
    680680        url = urlHandlers.UHTaskDetails().getURL(task) 
    681681        url.addParam("showComments", "true") 
    682682        self._redirect(url) 
    683683 
    684          
     684 
Note: See TracChangeset for help on using the changeset viewer.