Changeset 2004


Ignore:
Timestamp:
10 Jul 2007, 04:50:22 (17 years ago)
Author:
Henrik Bettermann
Message:

logging improved

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_utilities/ti_306_resolve.py

    r2003 r2004  
    3939
    4040total = len(pins)
     41logger.info('started, %d PINs found' % total)
    4142
    4243for brain in pins:
     
    4950        sbrain = sbrains[0]
    5051    else:
    51         logger.info('%s, %s' % (brain.student,brain.pin))
     52        logger.info('%s %s' % (brain.pin,brain.student))
    5253        continue
    5354    try:
     
    5657        logger.info('%s, application does not exist' % (brain.student))
    5758        continue
    58     application.getContent().edit(mapping={'app_ac_pin ': brain.pin})
    59     logger.info('%s, %s replaced' % (brain.student,brain.pin))
     59    prefix,batch_no,number = brain.pin[:3],brain.pin[3:-10],brain.pin[-10:]
     60    app_doc = application.getContent()
     61    if app_doc.app_ac_pin.startswith('APP'):
     62        logger.info('%s, %s, %s already shows correct PIN %s (reason: check_admission failed the first time)' % (count, brain.student,sbrain.id,app_doc.app_ac_pin))
     63        continue
     64    app_doc.edit(mapping={'app_ac_pin' : '%s-%s-%s' % (prefix,batch_no,number)})
     65    logger.info('%s, %s, %s, %s-%s-%s replaced' % (count, brain.student,sbrain.id,prefix,batch_no,number))
    6066    count += 1
    6167    if count and not count % commit_after:
    6268        context.waeup_tool.doCommit()
    6369        logger.info("committed %d transactions" % commit_after)
    64         return
    6570logger.info('finished for %d of %d' % (count,total))
    6671return
Note: See TracChangeset for help on using the changeset viewer.