Ignore:
Timestamp:
20 Nov 2012, 11:16:38 (12 years ago)
Author:
Henrik Bettermann
Message:

Replace 'has_key' by 'in'

Location:
main/waeup.kofa/trunk/src/waeup/kofa/browser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r9610 r9701  
    123123def delSubobjects(view, redirect, tab=None, subcontainer=None):
    124124    form = view.request.form
    125     if form.has_key('val_id'):
     125    if 'val_id' in form:
    126126        child_id = form['val_id']
    127127    else:
     
    242242            # has been set.
    243243            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']:
    245245                student = grok.getSite()['students'][login]
    246246                password = self.request.form['form.password']
     
    841841    def delFiles(self, **data):
    842842        form = self.request.form
    843         if form.has_key('val_id'):
     843        if 'val_id' in form:
    844844            child_id = form['val_id']
    845845        else:
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_browser.py

    r9326 r9701  
    316316        # former_course attribute of the corresponding course is set.
    317317        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'])
    320320        self.browser.open(
    321321            'http://localhost/app/faculties/fac1/dep1/courses/COURSE1/manage')
    322322        self.browser.getControl(name="form.former_course").value = ['selected']
    323323        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'])
    326326        return
    327327
     
    330330        # the corresponding course is removed.
    331331        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'])
    334334        self.browser.open('http://localhost/app/faculties/fac1/dep1/manage')
    335335        ctrl = self.browser.getControl(name='val_id')
    336336        ctrl.getControl(value='COURSE1').selected = True
    337337        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
Note: See TracChangeset for help on using the changeset viewer.