Changeset 8a8251 in indico
- Timestamp:
- 06/17/11 14:27:16 (2 years ago)
- 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)
- Files:
-
- 16 edited
-
bin/legacy/sendEmail2PA&Submitters.py (modified) (1 diff)
-
bin/legacy/sendEmail2SubmittersUsingTPL.py (modified) (1 diff)
-
bin/legacy/setSubmissionPrivileges.py (modified) (1 diff)
-
indico/MaKaC/common/Configuration.py (modified) (3 diffs)
-
indico/MaKaC/export/oai2.py (modified) (1 diff)
-
indico/MaKaC/plugins/EPayment/skipjack/webinterface/rh/__init__.py (modified) (1 diff)
-
indico/MaKaC/plugins/RoomBooking/CERN/initialize.py (modified) (7 diffs)
-
indico/MaKaC/plugins/RoomBooking/default/initialize.py (modified) (7 diffs)
-
indico/MaKaC/rb_customAttributesManager.py (modified) (3 diffs)
-
indico/MaKaC/rb_location.py (modified) (6 diffs)
-
indico/MaKaC/rb_reservation.py (modified) (9 diffs)
-
indico/MaKaC/rb_room.py (modified) (5 diffs)
-
indico/MaKaC/rb_tools.py (modified) (5 diffs)
-
indico/MaKaC/webinterface/pages/conf_calendar.py (modified) (2 diffs)
-
indico/MaKaC/webinterface/rh/ePaymentModif.py (modified) (2 diffs)
-
indico/MaKaC/webinterface/rh/taskList.py (modified) (45 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bin/legacy/sendEmail2PA&Submitters.py
rbdd862 r8a8251 24 24 to run the code. It was put just like a security reason. 25 25 """ 26 raise "delete this line to run the code"26 raise Exception("delete this line to run the code") 27 27 28 28 import sys -
bin/legacy/sendEmail2SubmittersUsingTPL.py
rbdd862 r8a8251 24 24 to run the code. It was put just like a security reason. 25 25 """ 26 raise "delete this line to run the code"26 raise Exception("delete this line to run the code") 27 27 28 28 #import sys -
bin/legacy/setSubmissionPrivileges.py
rbdd862 r8a8251 31 31 assert (len(contrib.getSubmitterList())>=1) 32 32 except AssertionError: 33 raise "conf %s - contrib %s"%(conf.getId(),contrib.getId())33 raise Exception("conf %s - contrib %s"%(conf.getId(),contrib.getId())) 34 34 DBMgr.getInstance().endRequest() -
indico/MaKaC/common/Configuration.py
r0c8d04 r8a8251 515 515 516 516 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'])) 518 518 519 519 … … 576 576 files are kept 577 577 """ 578 raise "Deprecated Method"578 raise NotImplementedError("Deprecated Method") 579 579 # return raw_input("\n\nPlease enter the path to the directory that contains the database files") 580 580 … … 584 584 database files are kept 585 585 """ 586 raise "Deprecated Method"586 raise NotImplementedError("Deprecated Method") 587 587 # return raw_input("\n\nPlease enter the path to the directory that will contain the database backups [OPTIONAL]\n\n") 588 588 -
indico/MaKaC/export/oai2.py
rd285dc r8a8251 592 592 elif isinstance(obj, conference.SubContribution): 593 593 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())) 595 595 596 596 def subContToXMLDC(self, subCont, out=None): -
indico/MaKaC/plugins/EPayment/skipjack/webinterface/rh/__init__.py
rc6b710 r8a8251 43 43 return True 44 44 except Exception,e: 45 raise "%s"%params45 raise Exception(str(params)) -
indico/MaKaC/plugins/RoomBooking/CERN/initialize.py
r336214 r8a8251 43 43 """ 44 44 !!! REMOVES DATA !!! 45 45 46 46 Deletes all branches related to room booking, 47 47 from both main and room booking databases. 48 48 """ 49 49 if not force: 50 raise 'nothing done'51 50 raise Exception('nothing done') 51 52 52 indicoRoot = MaKaC.common.DBMgr.getInstance().getDBConnection().root() 53 53 root = DALManagerCERN().getRoot() 54 54 minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance() 55 55 56 56 # 1. INDICO ----------------------------------------- 57 57 … … 61 61 if indicoRoot.get( 'DefaultRoomBookingLocation' ): 62 62 del indicoRoot['DefaultRoomBookingLocation'] 63 63 64 64 # 2. ROOM BOKING ------------------------------------ 65 65 … … 68 68 if root.get( 'Reservations' ): 69 69 del root['Reservations'] 70 70 71 71 # Create indexes 72 72 if root.get( 'RoomReservationsIndex' ): … … 93 93 indicoRoot = MaKaC.common.DBMgr.getInstance().getDBConnection().root() 94 94 root = DALManagerCERN().getRoot() 95 95 96 96 # 1. Location ----------------------------------------------------------- 97 97 98 98 initialLocation = Location( location, FactoryCERN ) 99 99 if force or not indicoRoot.has_key( 'RoomBookingLocationList' ): … … 103 103 indicoRoot['DefaultRoomBookingLocation'] = location 104 104 print "Default location set to " + location 105 105 106 106 # 2. Rooms & Bookings --------------------------------------------------- 107 107 … … 115 115 root['Reservations'] = IOBTree() 116 116 print "Reservations branch created" 117 117 118 118 # Create indexes 119 119 if force or not root.has_key( 'RoomReservationsIndex' ): … … 140 140 def main( **kwargs ): 141 141 location = kwargs.get( 'location', 'Universe' ) 142 142 143 143 from MaKaC.rb_factory import Factory 144 144 from MaKaC.common.db import DBMgr -
indico/MaKaC/plugins/RoomBooking/default/initialize.py
r336214 r8a8251 43 43 """ 44 44 !!! REMOVES DATA !!! 45 45 46 46 Deletes all branches related to room booking, 47 47 from both main and room booking databases. 48 48 """ 49 49 if not force: 50 raise 'nothing done'51 50 raise Exception('nothing done') 51 52 52 indicoRoot = MaKaC.common.DBMgr.getInstance().getDBConnection().root() 53 53 root = DALManagerCERN().getRoot() 54 54 minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance() 55 55 56 56 # 1. INDICO ----------------------------------------- 57 57 … … 61 61 if indicoRoot.get( 'DefaultRoomBookingLocation' ): 62 62 del indicoRoot['DefaultRoomBookingLocation'] 63 63 64 64 # 2. ROOM BOKING ------------------------------------ 65 65 … … 68 68 if root.get( 'Reservations' ): 69 69 del root['Reservations'] 70 70 71 71 # Create indexes 72 72 if root.get( 'RoomReservationsIndex' ): … … 93 93 indicoRoot = MaKaC.common.DBMgr.getInstance().getDBConnection().root() 94 94 root = DALManagerCERN().getRoot() 95 95 96 96 # 1. Location ----------------------------------------------------------- 97 97 98 98 initialLocation = Location( location, FactoryCERN ) 99 99 if force or not indicoRoot.has_key( 'RoomBookingLocationList' ): … … 103 103 indicoRoot['DefaultRoomBookingLocation'] = location 104 104 print "Default location set to " + location 105 105 106 106 # 2. Rooms & Bookings --------------------------------------------------- 107 107 … … 115 115 root['Reservations'] = IOBTree() 116 116 print "Reservations branch created" 117 117 118 118 # Create indexes 119 119 if force or not root.has_key( 'RoomReservationsIndex' ): … … 140 140 def main( **kwargs ): 141 141 location = kwargs.get( 'location', 'Universe' ) 142 142 143 143 from MaKaC.rb_factory import Factory 144 144 from MaKaC.common.db import DBMgr -
indico/MaKaC/rb_customAttributesManager.py
rbdd862 r8a8251 25 25 26 26 class CustomAttributesManagerBase: 27 """ 27 """ 28 28 Generic manager for room attributes that are plugin-specific. 29 29 30 30 It manages the list of rooms' possible attributes. 31 31 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 33 33 attributes, called _Custom_Attributes_. 34 34 35 35 All attributes are strings. 36 37 The list of possible equipment is defined either 36 37 The list of possible equipment is defined either 38 38 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 42 42 This list is used mainly for generating user web interface. 43 43 """ … … 46 46 def supportsAttributeManagement( *args, **kwargs ): 47 47 """ 48 Returns True if plugin supports adding and 48 Returns True if plugin supports adding and 49 49 removing room attributes (modyfing 'room shema'). 50 50 Otherwise returns False. 51 51 """ 52 52 return False 53 53 54 54 @staticmethod 55 55 def getAttributes( *args, **kwargs ): … … 60 60 def setAttributes( customAttributeList, *args, **kwargs ): 61 61 """ 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 64 64 @staticmethod 65 65 def insertAttribute( customAttribute, *args, **kwargs ): 66 66 """ 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 69 69 @staticmethod 70 70 def removeAttribute( customAttributeName, *args, **kwargs ): 71 71 """ 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 74 74 @staticmethod 75 75 def setRequired( customAttributeName, isRequired, *args, **kwargs ): 76 76 """ 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 79 79 @staticmethod 80 80 def setHidden( customAttributeName, isHidden, *args, **kwargs ): 81 81 """ 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 84 84 @staticmethod 85 85 def checkAttribute( at ): -
indico/MaKaC/rb_location.py
ra7568a r8a8251 191 191 _ensureZODBBranch() 192 192 if not isinstance( location, Location ): 193 raise 'location attribute must be of Location class'193 raise MaKaCError('location attribute must be of Location class') 194 194 if Location.parse(location.friendlyName): 195 195 # location with same name already exists … … 206 206 _ensureZODBBranch() 207 207 if not isinstance( locationName, str ): 208 raise 'locationName attribute must be string'208 raise MaKaCError('locationName attribute must be string') 209 209 root = MaKaC.common.DBMgr.getInstance().getDBConnection().root() 210 210 locations = root[_ROOM_BOOKING_LOCATION_LIST] … … 347 347 """ 348 348 if not isinstance( location, Location ): 349 raise 'location attribute must be of Location class'349 raise MaKaCError('location attribute must be of Location class') 350 350 self.location = location 351 351 self.id = id … … 369 369 loc = loc.strip(); id = int( id.strip() ) 370 370 self.location = Location.parse( loc ) 371 if not self.location: raise '' 371 if not self.location: 372 raise MaKaCError('invalid location') 372 373 self.id = id 373 374 except: … … 397 398 """ 398 399 if not isinstance( location, Location ): 399 raise 'location attribute must be of Location class'400 raise MaKaCError('location attribute must be of Location class') 400 401 self.location = location 401 402 self.id = id … … 419 420 id = int( id.strip() ) 420 421 location = Location.parse( loc ) 421 if not location: raise 'Cannot parse location' 422 if not location: 423 raise MaKaCError('Cannot parse location') 422 424 return RoomGUID( location, id ) 423 425 except: -
indico/MaKaC/rb_reservation.py
r45a4a3 r8a8251 28 28 from MaKaC.rb_location import ReservationGUID, Location, CrossLocationQueries 29 29 from MaKaC.accessControl import AccessWrapper 30 from MaKaC.errors import MaKaCError 30 31 from MaKaC.user import AvatarHolder, Avatar 31 32 from MaKaC.common.Configuration import Config … … 586 587 587 588 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') 589 590 590 591 if rooms == None: … … 712 713 return Period( retStartDT, retEndDT ) 713 714 714 raise 'Unknown repeatability type.'715 raise MaKaCError('Unknown repeatability type.') 715 716 716 717 def overlapsOn( self, startDT, endDT ): … … 787 788 return False 788 789 789 raise "Unknown repeatability type"790 raise MaKaCError("Unknown repeatability type") 790 791 791 792 # Excluded days management ---------------------------------------------- … … 820 821 for d in excludedDays: 821 822 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)') 823 824 824 825 def excludeDay( self, dayD ): … … 830 831 return 'Not applicable to non-repeating reservations.' 831 832 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)') 833 834 834 835 def includeDay( self, dayD ): … … 840 841 return 'Not applicable to non-repeating reservations.' 841 842 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)') 843 844 844 845 def dayIsExcluded( self, dayD ): … … 849 850 return 'Not applicable to non-repeating reservations.' 850 851 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)') 852 853 853 854 … … 1145 1146 user = accessWrapper 1146 1147 else: 1147 raise 'canModify requires either AccessWrapper or Avatar object'1148 raise MaKaCError('canModify requires either AccessWrapper or Avatar object') 1148 1149 if not user: 1149 1150 return False -
indico/MaKaC/rb_room.py
rd8fdf0 r8a8251 28 28 from MaKaC.user import Avatar, AvatarHolder 29 29 from MaKaC.accessControl import AccessWrapper 30 from MaKaC.errors import MaKaCError 30 31 from datetime import datetime, timedelta 31 32 … … 356 357 self._equipment = eq 357 358 return 358 raise 'Invalid equipment list'359 raise MaKaCError('Invalid equipment list') 359 360 360 361 def getEquipment( self ): … … 381 382 def isCloseToBuilding( self, buildingNr ): 382 383 """ Returns true if room is close to the specified building """ 383 raise 'Not implemented'384 raise NotImplementedError('Not implemented') 384 385 385 386 def belongsTo( self, user ): 386 387 """ Returns true if current CrbsUser is responsible for this room """ 387 raise 'Not implemented'388 raise NotImplementedError('Not implemented') 388 389 389 390 # "System" --------------------------------------------------------------- … … 562 563 return accessWrapper.isAdmin() 563 564 564 raise 'canModify requires either AccessWrapper or Avatar object'565 raise MaKaCError('canModify requires either AccessWrapper or Avatar object') 565 566 566 567 def canDelete( self, user ): … … 597 598 def setLocationName( self, locationName ): 598 599 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.') 600 601 return self.setLocationName( locationName ) # Subclass 601 602 -
indico/MaKaC/rb_tools.py
r3fa943 r8a8251 155 155 if len( args ) == 2: 156 156 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 )') 158 158 159 159 def __doesPeriodsOverlap( startDT1, endDT1, startDT2, endDT2 ): … … 179 179 if len( args ) == 2: 180 180 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 )') 182 182 183 183 … … 231 231 pass 232 232 """ 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 ) 235 235 for day in range((last - first).days + 1): 236 236 yield first + timedelta(day) … … 281 281 return None 282 282 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.') 284 284 return localNaiveDT + timedelta( 0, time.altzone ) 285 285 … … 290 290 try: 291 291 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.') 293 293 return utcNaiveDT - timedelta( 0, time.altzone ) 294 294 except AttributeError: -
indico/MaKaC/webinterface/pages/conf_calendar.py
re0ef1f r8a8251 35 35 from MaKaC.common.utils import HolidaysHolder 36 36 import MaKaC.common.timezoneUtils as timezoneUtils 37 from MaKaC.errors import MaKaCError 37 38 38 39 … … 510 511 bgcolor="#ffcccc" 511 512 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)) 513 514 514 515 url.addParam("day", day) -
indico/MaKaC/webinterface/rh/ePaymentModif.py
re06a20 r8a8251 26 26 from MaKaC.webinterface.rh.conferenceDisplay import RHConferenceBaseDisplay 27 27 #from MaKaC.registration import AccommodationType, SocialEventItem, RegistrationSession, GeneralSectionForm, GeneralField, FieldInputs, RadioItem, Status, StatusValue 28 from MaKaC.errors import FormValuesError 28 from MaKaC.errors import FormValuesError, MaKaCError 29 29 from MaKaC.common import HelperMaKaCInfo 30 30 from MaKaC.i18n import _ … … 234 234 rhmod = module.webinterface.rh 235 235 except: 236 raise "%s"%module236 raise MaKaCError("%s"%module) 237 237 requestTag = params.get("requestTag", "No requestTag") 238 238 rh = rhmod.getRHByTag(rhmod, requestTag) -
indico/MaKaC/webinterface/rh/taskList.py
rbdd862 r8a8251 46 46 class RHTaskList( RHCategDisplayBase ): 47 47 _uh = urlHandlers.UHTaskList 48 49 def _process( self ): 48 49 def _process( self ): 50 50 params = self._getRequestParams() 51 51 order = params.get("order","1") … … 58 58 class RHTaskListAction( RHCategDisplayBase ): 59 59 _uh = urlHandlers.UHTaskListAction 60 61 def _process( self ): 62 params = self._getRequestParams() 63 60 61 def _process( self ): 62 params = self._getRequestParams() 63 64 64 if params.get("actionPerformed",None) is None : 65 65 p = tasks.WPTaskList( self, self._target) … … 69 69 url.addParam("clear","true") 70 70 self._redirect(url) 71 return 72 if params["actionPerformed"] == _("Apply filter") : 71 return 72 if params["actionPerformed"] == _("Apply filter") : 73 73 filter = params.get("filter","") 74 74 p = tasks.WPTaskList( self, self._target, filter) … … 82 82 class RHTaskNew( RHTaskModifBase ): 83 83 _uh = urlHandlers.UHTaskNew 84 85 84 85 86 86 def _checkParams( self, params): 87 87 RHTaskModifBase._checkParams(self,params) … … 90 90 self._removePreservedParams() 91 91 del params["clear"] 92 93 def _process( self ): 92 93 def _process( self ): 94 94 preservedParams = self._getPreservedParams() 95 95 params = self._getRequestParams() … … 97 97 params["createdBy"] = self._getUser().getFullName() 98 98 params["creatorId"] = self._getUser().getId() 99 99 100 100 params = copy(params) 101 101 102 102 params["responsibleOptions"] = self._getResponsibleOptions() 103 103 params["responsibleDefined"] = self._getDefinedList("responsible",False) 104 104 105 105 p = tasks.WPTaskNew( self, self._target, params) 106 106 return p.display() … … 112 112 return params 113 113 114 def _getResponsibleOptions(self): 115 html = [] 114 def _getResponsibleOptions(self): 115 html = [] 116 116 for t in self._target.getTaskList() : 117 117 index = 0 … … 121 121 return """ 122 122 """.join(html) 123 123 124 124 def _getDefinedList(self, typeName, submission): 125 125 lis = self._websession.getVar("%sList"%typeName) 126 126 if lis is None : 127 127 return "" 128 128 129 129 html = [] 130 130 counter = 0 … … 133 133 if submission and person[1] : 134 134 subm = _("""<td> _("submiter")</td>""") 135 135 136 136 text = """ 137 137 <tr> … … 144 144 return """ 145 145 """.join(html) 146 146 147 147 def _removeDefinedList(self, typeName): 148 148 self._websession.setVar("%sList"%typeName,None) 149 149 150 150 def _removePreservedParams(self): 151 151 self._websession.setVar("preservedParams",None) 152 153 def _personInDefinedList(self, typeName, person): 152 153 def _personInDefinedList(self, typeName, person): 154 154 lis = self._websession.getVar("%sList"%typeName) 155 155 if lis is None : … … 159 159 return True 160 160 return False 161 161 162 162 #--------------------------------------------------------------- 163 163 164 164 class RHTaskNewAdd( RHTaskModifBase ): 165 165 _uh = urlHandlers.UHTaskNewAdd 166 167 168 def _process( self ): 166 167 168 def _process( self ): 169 169 params = self._getRequestParams() 170 170 … … 175 175 url.addParam("orgin","added") 176 176 url.addParam("typeName","responsible") 177 self._redirect(url) 177 self._redirect(url) 178 178 return 179 179 if params.get("performedAction","") == "New responsible" : … … 191 191 if params.get("performedAction","") == "Remove responsibles" : 192 192 self._removePersons(params, "responsible") 193 193 194 194 self._redirect(urlHandlers.UHTaskNew.getURL(self._target)) 195 195 return 196 196 if params.has_key("cancel") : 197 197 self._removePreservedParams() 198 self._removeDefinedList("responsible") 198 self._removeDefinedList("responsible") 199 199 if params.get("performedAction","") == _("ok") : 200 200 task = self._target.newTask(self._getUser()) … … 205 205 for responsible in responsibleList : 206 206 task.addResponsible(responsible[0]) 207 207 208 208 self._removePreservedParams() 209 self._removeDefinedList("responsible") 210 209 self._removeDefinedList("responsible") 210 211 211 self._redirect(urlHandlers.UHTaskList.getURL(self._target)) 212 212 … … 215 215 preservedParams = self._getRequestParams().copy() 216 216 self._websession.setVar("preservedParams",preservedParams) 217 217 218 218 def _removePersons(self, params, typeName): 219 219 220 220 persons = self._normaliseListParam(params.get("%ss"%typeName,[])) 221 221 definedList = self._getDefinedList(typeName) … … 227 227 definedList.remove(person) 228 228 self._setDefinedList(definedList,typeName) 229 229 230 230 def _removePreservedParams(self): 231 231 self._websession.setVar("preservedParams",None) 232 232 233 233 def _removeDefinedList(self, typeName): 234 self._websession.setVar("%sList"%typeName,None) 235 234 self._websession.setVar("%sList"%typeName,None) 235 236 236 def _getDefinedList(self, typeName): 237 237 definedList = self._websession.getVar("%sList"%typeName) … … 239 239 return [] 240 240 return definedList 241 241 242 242 def _setDefinedList(self, definedList, typeName): 243 243 self._websession.setVar("%sList"%typeName,definedList) 244 244 245 245 #-------------------------------------------------------------------------- 246 246 … … 250 250 def _checkParams( self, params): 251 251 RHTaskModifBase._checkParams(self,params) 252 253 def _process( self ): 254 params = self._getRequestParams() 255 252 253 def _process( self ): 254 params = self._getRequestParams() 255 256 256 params["newButtonAction"] = str(urlHandlers.UHTaskNewResponsibleNew.getURL()) 257 257 addURL = urlHandlers.UHTaskNewPersonAdd.getURL() … … 261 261 p = tasks.WPTaskNewResponsibleSelect( self, self._target) 262 262 return p.display(**params) 263 263 264 264 #------------------------------------------------------------------------------------- 265 265 … … 272 272 if self._typeName is None : 273 273 raise MaKaCError( _("Type name of the person to add is not set.")) 274 274 275 275 def _process( self ): 276 276 params = self._getRequestParams() 277 277 self._errorList = [] 278 278 279 279 #raise "%s"%params 280 280 definedList = self._getDefinedList(self._typeName) 281 281 if definedList is None : 282 282 definedList = [] 283 283 284 284 if params.get("orgin","") == "new" : 285 285 #raise "new" 286 286 if params.get("ok",None) is None : 287 raise "not ok"287 raise MaKaCError("not ok") 288 288 self._redirect(urlHandlers.UHTaskNew.getURL(self._target)) 289 289 return 290 else :290 else: 291 291 person = ContributionParticipation() 292 292 person.setFirstName(params["name"]) … … 297 297 person.setPhone(params["phone"]) 298 298 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")]) 302 302 else : 303 303 self._errorList.append( _("%s has been already defined as %s of this contribution")%(person.getFullName(),self._typeName)) 304 304 305 305 elif params.get("orgin","") == "selected" : 306 306 selectedList = self._normaliseListParam(self._getRequestParams().get("selectedPrincipals",[])) … … 311 311 else : 312 312 ph = user.PrincipalHolder() 313 selected = ph.getById(s) 313 selected = ph.getById(s) 314 314 if isinstance(selected, user.Avatar) : 315 315 person = ContributionParticipation() … … 319 319 else : 320 320 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) : 323 323 for member in selected.getMemberList() : 324 324 person = ContributionParticipation() 325 325 person.setDataFromAvatar(member) 326 326 if not self._alreadyDefined(person, definedList) : 327 definedList.append([person,params.has_key("submissionControl")]) 327 definedList.append([person,params.has_key("submissionControl")]) 328 328 else : 329 329 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() 332 332 person.setTitle(selected.getTitle()) 333 333 person.setFirstName(selected.getFirstName()) … … 342 342 else : 343 343 self._errorList.append( _("%s has been already defined as %s of this contribution")%(person.getFullName(),self._typeName)) 344 344 345 345 elif params.get("orgin","") == "added" : 346 346 preservedParams = self._getPreservedParams() 347 347 chosen = preservedParams.get("%sChosen"%self._typeName,None) 348 if chosen is None or chosen == "" : 348 if chosen is None or chosen == "" : 349 349 self._redirect(urlHandlers.UHConfModScheduleNewContrib.getURL(self._target)) 350 return 350 return 351 351 index = chosen.find("-") 352 352 taskId = chosen[0:index] … … 357 357 self._redirect(urlHandlers.UHConfModScheduleNewContrib.getURL(self._target)) 358 358 return 359 person = ContributionParticipation() 359 person = ContributionParticipation() 360 360 person.setTitle(chosenPerson.getTitle()) 361 361 person.setFirstName(chosenPerson.getFirstName()) … … 367 367 person.setFax(chosenPerson.getFax()) 368 368 if not self._alreadyDefined(person, definedList) : 369 definedList.append([person,params.has_key("submissionControl")]) 369 definedList.append([person,params.has_key("submissionControl")]) 370 370 else : 371 371 self._errorList.append( _("%s has been already defined as %s of this contribution")%(person.getFullName(),self._typeName)) … … 377 377 self._preserveParams(preservedParams) 378 378 self._websession.setVar("%sList"%self._typeName,definedList) 379 379 380 380 self._redirect(urlHandlers.UHTaskNew.getURL(self._target)) 381 381 … … 386 386 return [] 387 387 return definedList 388 388 389 389 def _alreadyDefined(self, person, definedList): 390 390 if person is None : … … 403 403 return {} 404 404 return params 405 405 406 406 def _preserveParams(self, params): 407 407 self._websession.setVar("preservedParams",params) … … 417 417 def _checkParams( self, params): 418 418 RHTaskModifBase._checkParams(self,params) 419 419 420 420 def _process( self ): 421 421 p = tasks.WPTaskNewResponsibleNew( self, self._target) … … 427 427 class RHTaskDetails( RHCategDisplayBase ): 428 428 _uh = urlHandlers.UHTaskDetails 429 430 def _process( self ): 429 430 def _process( self ): 431 431 params = self._getRequestParams() 432 432 if params.get("taskId",None) is None : … … 443 443 elif user in task.getResponsibleList() or user.getEmail() in emails : 444 444 params["editRights"] = "True" 445 else : 445 else : 446 446 params["editRights"] = "False" 447 447 448 448 p = tasks.WPTaskDetails( self, task, params) 449 449 return p.display() 450 450 451 451 452 452 class RHTaskDetailsAction( RHCategDisplayBase ): 453 453 _uh = urlHandlers.UHTaskDetailsAction 454 455 def _process( self ): 456 params = self._getRequestParams() 457 454 455 def _process( self ): 456 params = self._getRequestParams() 457 458 458 #raise "%s"%params 459 459 if params.get("taskId",None) is None : … … 469 469 if params.get("performedAction","") == _("Hide comments list") : 470 470 del params["showComments"] 471 471 472 472 if params.get("performedAction","") == _("Show status history") : 473 473 params["showStatus"] = "true" 474 474 if params.get("performedAction","") == _("Hide status history") : 475 475 del params["showStatus"] 476 476 477 477 if params.get("performedAction","") == _("Change status") : 478 478 status = TaskStatus(params["changedStatus"],self._getUser()) 479 479 task.changeStatus(status) 480 480 params["showStatus"] = "true" 481 481 482 482 if params.get("performedAction","") == "Add as responsible" : 483 483 resId = params.get("responsibleChosen",None) … … 488 488 responsible = self._target.getTask(taskId).getResponsibleList()[int(resId)] 489 489 task.addResponsible(responsible) 490 490 491 491 if params.get("performedAction","") == "Remove responsibles" : 492 492 toRemove = self._normaliseListParam(params.get("responsibles",[])) … … 498 498 task.removeResponsible(r) 499 499 if params.get("performedAction","") == "New responsible" : 500 url = urlHandlers.UHTaskDetailsResponsibleSearch.getURL(task) 500 url = urlHandlers.UHTaskDetailsResponsibleSearch.getURL(task) 501 501 url.addParam("taskId",params["taskId"]) 502 502 self._redirect(url) 503 503 return 504 504 505 505 if params.get("performedAction","") == "New comment" : 506 506 url = urlHandlers.UHTaskCommentNew.getURL(task) … … 508 508 self._redirect(url) 509 509 return 510 511 510 511 512 512 p = tasks.WPTaskDetails( self, task, params) 513 513 return p.display() … … 520 520 def _checkParams( self, params): 521 521 RHCategDisplayBase._checkParams(self,params) 522 523 def _process( self ): 524 params = self._getRequestParams() 525 522 523 def _process( self ): 524 params = self._getRequestParams() 525 526 526 params["newButtonAction"] = str(urlHandlers.UHTaskDetailsResponsibleNew.getURL()) 527 527 addURL = urlHandlers.UHTaskDetailsPersonAdd.getURL() … … 530 530 #addURL.addParam("taskId",params["taskId"]) 531 531 params["addURL"] = addURL 532 532 533 533 p = tasks.WPTaskDetailsResponsibleSelect( self, self._target) 534 534 return p.display(**params) 535 535 536 536 #------------------------------------------------------------------------------------- 537 537 … … 544 544 if self._typeName is None : 545 545 raise MaKaCError( _("Type name of the person to add is not set.")) 546 546 547 547 def _process( self ): 548 548 params = self._getRequestParams() 549 549 self._errorList = [] 550 550 551 551 #raise "%s"%params 552 552 taskId = params["taskId"] 553 553 554 554 taskObject = self._target.getTask(taskId) 555 if params.get("orgin","") == "new" : 555 if params.get("orgin","") == "new" : 556 556 if params.get("ok",None) is None : 557 raise "not ok"557 raise MaKaCError("not ok") 558 558 url = urlHandlers.UHTaskDetails.getURL(self._target) 559 559 url.addParam("taskId",params["taskId"]) 560 560 self._redirect(url) 561 561 return 562 else : 562 else : 563 563 person = ContributionParticipation() 564 564 person.setFirstName(params["name"]) … … 569 569 person.setPhone(params["phone"]) 570 570 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()) : 573 573 taskObject.addResponsible(person) 574 574 else : 575 575 self._errorList.append("%s has been already defined as %s of this task"%(person.getFullName(),self._typeName)) 576 576 577 577 elif params.get("orgin","") == "selected" : 578 578 selectedList = self._normaliseListParam(self._getRequestParams().get("selectedPrincipals",[])) … … 583 583 else : 584 584 ph = user.PrincipalHolder() 585 selected = ph.getById(s) 585 selected = ph.getById(s) 586 586 if isinstance(selected, user.Avatar) : 587 587 person = ContributionParticipation() 588 588 person.setDataFromAvatar(selected) 589 if not self._alreadyDefined(person, taskObject.getResponsibleList()) : 589 if not self._alreadyDefined(person, taskObject.getResponsibleList()) : 590 590 taskObject.addResponsible(person) 591 591 else : 592 592 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) : 595 595 for member in selected.getMemberList() : 596 596 person = ContributionParticipation() 597 597 person.setDataFromAvatar(member) 598 if not self._alreadyDefined(person, taskObject.getResponsibleList()) : 598 if not self._alreadyDefined(person, taskObject.getResponsibleList()) : 599 599 taskObject.addResponsible(person) 600 600 else : 601 601 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() 605 605 person.setTitle(selected.getTitle()) 606 606 person.setFirstName(selected.getFirstName()) … … 611 611 person.setPhone(selected.getPhone()) 612 612 person.setFax(selected.getFax()) 613 if not self._alreadyDefined(person, taskObject.getResponsibleList()) : 613 if not self._alreadyDefined(person, taskObject.getResponsibleList()) : 614 614 taskObject.addResponsible(person) 615 615 else : … … 620 620 self._redirect(url) 621 621 return 622 622 623 623 url = urlHandlers.UHTaskDetails.getURL(self._target) 624 624 url.addParam("taskId",params["taskId"]) … … 643 643 def _checkParams( self, params): 644 644 RHTaskModifBase._checkParams(self,params) 645 645 646 646 def _process( self ): 647 647 params = self._getRequestParams() 648 648 p = tasks.WPTaskDetailsResponsibleNew( self, self._target, params) 649 649 return p.display() 650 651 650 651 652 652 #-------------------------------------------------------------------------- 653 653 654 654 class RHTaskCommentNew( RHTaskModifBase ): 655 655 _uh = urlHandlers.UHTaskCommentNew 656 657 def _process( self ): 656 657 def _process( self ): 658 658 params = self._getRequestParams() 659 659 if params.get("taskId",None) is None : 660 660 raise MaKaCError( _("Task id is not set - cannot add a comment")) 661 661 662 662 params["commentedBy"] = self._getUser().getFullName() 663 663 664 664 p = tasks.WPTaskCommentNew( self, self._target, params) 665 665 return p.display() … … 668 668 class RHTaskCommentNewAction( RHTaskModifBase ): 669 669 _uh = urlHandlers.UHTaskCommentNewAction 670 671 def _process( self ): 670 671 def _process( self ): 672 672 params = self._getRequestParams() 673 673 if params.get("taskId",None) is None : 674 674 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"]) 677 677 if params.get("performedAction","") == "ok" : 678 678 task.addComment(self._getUser(),params["commentText"]) 679 679 680 680 url = urlHandlers.UHTaskDetails().getURL(task) 681 681 url.addParam("showComments", "true") 682 682 self._redirect(url) 683 683 684 684
Note: See TracChangeset
for help on using the changeset viewer.
