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

Replace 'has_key' by 'in'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py

    r9690 r9701  
    148148        # We have to log this if state is provided. If not,
    149149        # logging is done by the event handler handle_student_added
    150         if row.has_key('state'):
     150        if 'state' in row:
    151151            parent.logger.info('%s - Student record created' % obj.student_id)
    152152        history = IObjectHistory(obj)
     
    191191
    192192        # 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):
    195194            row.pop('student_id')
    196195
    197196        # Update password
    198         # XXX: Tale DELETION_MARKER into consideration
    199         if row.has_key('password'):
     197        # XXX: Take DELETION_MARKER into consideration
     198        if 'password' in row:
    200199            passwd = row.get('password', IGNORE_MARKER)
    201200            if passwd not in ('', IGNORE_MARKER):
     
    210209
    211210        # Update registration state
    212         if row.has_key('state'):
     211        if 'state' in row:
    213212            state = row.get('state', IGNORE_MARKER)
    214213            if state not in (IGNORE_MARKER, ''):
     
    221220            row.pop('state')
    222221
    223         if row.has_key('transition'):
     222        if 'transition' in row:
    224223            transition = row.get('transition', IGNORE_MARKER)
    225224            if transition not in (IGNORE_MARKER, ''):
     
    274273        errs, inv_errs, conv_dict =  converter.fromStringDict(
    275274            row, self.factory_name, mode=mode)
    276         if row.has_key('transition'):
     275        if 'transition' in row:
    277276            if row['transition'] not in IMPORTABLE_TRANSITIONS:
    278277                if row['transition'] not in (IGNORE_MARKER, ''):
    279278                    errs.append(('transition','not allowed'))
    280         if row.has_key('state'):
     279        if 'state' in row:
    281280            if row['state'] not in IMPORTABLE_STATES:
    282281                if row['state'] not in (IGNORE_MARKER, ''):
     
    438437            StudentStudyCourseProcessor, self).checkConversion(row, mode=mode)
    439438        # 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:
    442440            cert = conv_dict['certificate']
    443441            level = conv_dict['current_level']
Note: See TracChangeset for help on using the changeset viewer.