Changeset 9701 for main/waeup.kofa
- Timestamp:
- 20 Nov 2012, 11:16:38 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/batching.py
r9269 r9701 146 146 errs, inv_errs, conv_dict = converter.fromStringDict( 147 147 row, self.factory_name, mode=mode) 148 if row.has_key('transition') and row.has_key('state'):148 if 'transition' in row and 'state' in row: 149 149 if row['transition'] not in (IGNORE_MARKER, '') and \ 150 150 row['state'] not in (IGNORE_MARKER, ''): 151 151 errs.append(('workflow','not allowed')) 152 152 return errs, inv_errs, conv_dict 153 if row.has_key('transition'):153 if 'transition' in row: 154 154 if row['transition'] not in IMPORTABLE_TRANSITIONS: 155 155 if row['transition'] not in (IGNORE_MARKER, ''): 156 156 errs.append(('transition','not allowed')) 157 if row.has_key('state'):157 if 'state' in row: 158 158 if row['state'] not in IMPORTABLE_STATES: 159 159 if row['state'] not in (IGNORE_MARKER, ''): … … 188 188 # Update state 189 189 # Attention: When importing states the counters remain unchanged. 190 if row.has_key('state'):190 if 'state' in row: 191 191 state = row.get('state', IGNORE_MARKER) 192 192 if state not in (IGNORE_MARKER, ''): … … 198 198 row.pop('state') 199 199 # Trigger transition. Counters are properly changed. 200 if row.has_key('transition'):200 if 'transition' in row: 201 201 transition = row.get('transition', IGNORE_MARKER) 202 202 if transition not in (IGNORE_MARKER, ''): … … 209 209 # random_num string to avoid annoying automatic number transformation 210 210 # by Excel or Calc 211 if row.has_key('random_num'):211 if 'random_num' in row: 212 212 random_num = row.get('random_num', IGNORE_MARKER) 213 213 if random_num not in (IGNORE_MARKER, ''): -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/batching.py
r9250 r9701 226 226 items_changed = '' 227 227 # Remove application_number from row if empty 228 if row.has_key('application_number')and row['application_number'] in (228 if 'application_number' in row and row['application_number'] in ( 229 229 None, IGNORE_MARKER): 230 230 row.pop('application_number') … … 232 232 # Update applicant_id fom application_number and container code 233 233 # if application_number is given 234 if row.has_key('application_number'):234 if 'application_number' in row: 235 235 obj.applicant_id = u'%s_%s' % ( 236 236 row['container_code'], row['application_number']) … … 239 239 240 240 # Update password 241 if row.has_key('password'):241 if 'password' in row: 242 242 passwd = row.get('password', IGNORE_MARKER) 243 243 if passwd not in ('', IGNORE_MARKER): … … 252 252 253 253 # Update registration state 254 if row.has_key('state'):254 if 'state' in row: 255 255 state = row.get('state', IGNORE_MARKER) 256 256 if state not in (IGNORE_MARKER, ''): … … 306 306 if cert.application_category != parent.application_category: 307 307 errs.append(('course1', 'wrong application category')) 308 if row.has_key('state')and \308 if 'state' in row and \ 309 309 not row['state'] in IMPORTABLE_STATES: 310 310 if row['state'] not in (IGNORE_MARKER, ''): -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py
r9531 r9701 169 169 def delApplicantsContainers(self, **data): 170 170 form = self.request.form 171 if form.has_key('val_id'):171 if 'val_id' in form: 172 172 child_id = form['val_id'] 173 173 else: … … 417 417 def delApplicant(self, **data): 418 418 form = self.request.form 419 if form.has_key('val_id'):419 if 'val_id' in form: 420 420 child_id = form['val_id'] 421 421 else: … … 442 442 def createStudents(self, **data): 443 443 form = self.request.form 444 if form.has_key('val_id'):444 if 'val_id' in form: 445 445 child_id = form['val_id'] 446 446 else: … … 849 849 def delPaymentTickets(self, **data): 850 850 form = self.request.form 851 if form.has_key('val_id'):851 if 'val_id' in form: 852 852 child_id = form['val_id'] 853 853 else: -
main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py
r9610 r9701 123 123 def delSubobjects(view, redirect, tab=None, subcontainer=None): 124 124 form = view.request.form 125 if form.has_key('val_id'):125 if 'val_id' in form: 126 126 child_id = form['val_id'] 127 127 else: … … 242 242 # has been set. 243 243 login = self.request.form['form.login'] 244 if len(login) == 8 and grok.getSite()['students'].has_key(login):244 if len(login) == 8 and login in grok.getSite()['students']: 245 245 student = grok.getSite()['students'][login] 246 246 password = self.request.form['form.password'] … … 841 841 def delFiles(self, **data): 842 842 form = self.request.form 843 if form.has_key('val_id'):843 if 'val_id' in form: 844 844 child_id = form['val_id'] 845 845 else: -
main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_browser.py
r9326 r9701 316 316 # former_course attribute of the corresponding course is set. 317 317 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 318 self.assertTrue( self.app['faculties']['fac1']['dep1'].certificates[319 ' CERT1'].has_key('COURSE1_100'))318 self.assertTrue('COURSE1_100' in self.app[ 319 'faculties']['fac1']['dep1'].certificates['CERT1']) 320 320 self.browser.open( 321 321 'http://localhost/app/faculties/fac1/dep1/courses/COURSE1/manage') 322 322 self.browser.getControl(name="form.former_course").value = ['selected'] 323 323 self.browser.getControl("Save").click() 324 self.assertFalse( self.app['faculties']['fac1']['dep1'].certificates[325 ' CERT1'].has_key('COURSE1_100'))324 self.assertFalse('COURSE1_100' in self.app[ 325 'faculties']['fac1']['dep1'].certificates['CERT1']) 326 326 return 327 327 … … 330 330 # the corresponding course is removed. 331 331 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 332 self.assertTrue( self.app['faculties']['fac1']['dep1'].certificates[333 ' CERT1'].has_key('COURSE1_100'))332 self.assertTrue('COURSE1_100' in self.app[ 333 'faculties']['fac1']['dep1'].certificates['CERT1']) 334 334 self.browser.open('http://localhost/app/faculties/fac1/dep1/manage') 335 335 ctrl = self.browser.getControl(name='val_id') 336 336 ctrl.getControl(value='COURSE1').selected = True 337 337 self.browser.getControl("Remove selected", index=0).click() 338 self.assertFalse( self.app['faculties']['fac1']['dep1'].certificates[339 ' CERT1'].has_key('COURSE1_100'))340 return 338 self.assertFalse('COURSE1_100' in self.app[ 339 'faculties']['fac1']['dep1'].certificates['CERT1']) 340 return -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/browser.py
r9534 r9701 150 150 def delHostels(self, **data): 151 151 form = self.request.form 152 if form.has_key('val_id'):152 if 'val_id' in form: 153 153 deleted = [] 154 154 child_id = form['val_id'] … … 285 285 def switchReservations(self, **data): 286 286 form = self.request.form 287 if form.has_key('val_id'):287 if 'val_id' in form: 288 288 child_id = form['val_id'] 289 289 else: … … 315 315 def releaseBeds(self, **data): 316 316 form = self.request.form 317 if form.has_key('val_id'):317 if 'val_id' in form: 318 318 child_id = form['val_id'] 319 319 else: -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/hostel.py
r9448 r9701 119 119 bt = u'%s_%s_%s' % (self.special_handling,sex,bt) 120 120 uid = u'%s_%s_%d_%s' % (self.hostel_id,block,room_nr,bed) 121 if self.has_key(uid):121 if uid in self: 122 122 bed = self[uid] 123 123 # Renumber remaining beds -
main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py
r9690 r9701 148 148 # We have to log this if state is provided. If not, 149 149 # logging is done by the event handler handle_student_added 150 if row.has_key('state'):150 if 'state' in row: 151 151 parent.logger.info('%s - Student record created' % obj.student_id) 152 152 history = IObjectHistory(obj) … … 191 191 192 192 # Remove student_id from row if empty 193 if row.has_key('student_id') and row['student_id'] in ( 194 None, IGNORE_MARKER): 193 if 'student_id' in row and row['student_id'] in (None, IGNORE_MARKER): 195 194 row.pop('student_id') 196 195 197 196 # Update password 198 # XXX: Ta le DELETION_MARKER into consideration199 if row.has_key('password'):197 # XXX: Take DELETION_MARKER into consideration 198 if 'password' in row: 200 199 passwd = row.get('password', IGNORE_MARKER) 201 200 if passwd not in ('', IGNORE_MARKER): … … 210 209 211 210 # Update registration state 212 if row.has_key('state'):211 if 'state' in row: 213 212 state = row.get('state', IGNORE_MARKER) 214 213 if state not in (IGNORE_MARKER, ''): … … 221 220 row.pop('state') 222 221 223 if row.has_key('transition'):222 if 'transition' in row: 224 223 transition = row.get('transition', IGNORE_MARKER) 225 224 if transition not in (IGNORE_MARKER, ''): … … 274 273 errs, inv_errs, conv_dict = converter.fromStringDict( 275 274 row, self.factory_name, mode=mode) 276 if row.has_key('transition'):275 if 'transition' in row: 277 276 if row['transition'] not in IMPORTABLE_TRANSITIONS: 278 277 if row['transition'] not in (IGNORE_MARKER, ''): 279 278 errs.append(('transition','not allowed')) 280 if row.has_key('state'):279 if 'state' in row: 281 280 if row['state'] not in IMPORTABLE_STATES: 282 281 if row['state'] not in (IGNORE_MARKER, ''): … … 438 437 StudentStudyCourseProcessor, self).checkConversion(row, mode=mode) 439 438 # We have to check if current_level is in range of certificate. 440 if conv_dict.has_key('certificate') and \ 441 conv_dict.has_key('current_level'): 439 if 'certificate' in conv_dict and 'current_level' in conv_dict: 442 440 cert = conv_dict['certificate'] 443 441 level = conv_dict['current_level'] -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r9700 r9701 528 528 def save(self, **data): 529 529 form = self.request.form 530 if form.has_key('transition')and form['transition']:530 if 'transition' in form and form['transition']: 531 531 transition_id = form['transition'] 532 532 wf_info = IWorkflowInfo(self.context) … … 957 957 def delStudyLevels(self, **data): 958 958 form = self.request.form 959 if form.has_key('val_id'):959 if 'val_id' in form: 960 960 child_id = form['val_id'] 961 961 else: … … 1153 1153 def delCourseTicket(self, **data): 1154 1154 form = self.request.form 1155 if form.has_key('val_id'):1155 if 'val_id' in form: 1156 1156 child_id = form['val_id'] 1157 1157 else: … … 1353 1353 def delPaymentTicket(self, **data): 1354 1354 form = self.request.form 1355 if form.has_key('val_id'):1355 if 'val_id' in form: 1356 1356 child_id = form['val_id'] 1357 1357 else: … … 1406 1406 if 'maintenance' in p_category: 1407 1407 current_session = str(student['studycourse'].current_session) 1408 if not student['accommodation'].has_key(current_session):1408 if not current_session in student['accommodation']: 1409 1409 self.flash(_('You have not yet booked accommodation.')) 1410 1410 self.redirect(self.url(self.context)) … … 1559 1559 return 1560 1560 form = self.request.form 1561 if form.has_key('val_id'):1561 if 'val_id' in form: 1562 1562 child_id = form['val_id'] 1563 1563 else: … … 2216 2216 def _delCourseTicket(self, **data): 2217 2217 form = self.request.form 2218 if form.has_key('val_id'):2218 if 'val_id' in form: 2219 2219 child_id = form['val_id'] 2220 2220 else: -
main/waeup.kofa/trunk/src/waeup/kofa/university/batching.py
r9333 r9701 97 97 items_changed = '' 98 98 99 if row.has_key('local_roles')and row['local_roles'] not in (99 if 'local_roles' in row and row['local_roles'] not in ( 100 100 None, IGNORE_MARKER): 101 101 role_manager = IPrincipalRoleManager(obj) … … 133 133 errs, inv_errs, conv_dict = super( 134 134 FacultyProcessor, self).checkConversion(row, mode=mode) 135 if row.has_key('local_roles'):135 if 'local_roles' in row: 136 136 if row['local_roles'] in (None, DELETION_MARKER, IGNORE_MARKER): 137 137 return errs, inv_errs, conv_dict
Note: See TracChangeset for help on using the changeset viewer.