Changeset 2720 for WAeUP_SRP/base/skins


Ignore:
Timestamp:
20 Nov 2007, 21:49:53 (17 years ago)
Author:
Henrik Bettermann
Message:

catch 'no workflow provides ...' traceback

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/skins/waeup_student/deactivate_students.py

    r2601 r2720  
    4545        for student_id in ids:
    4646            student = getattr(students_folder,student_id,None)
     47            student_state = context.portal_workflow.getInfoFor(student,'review_state',None)
    4748            if student is not None:
    4849                for object in student.objectValues():
    4950                    if context.portal_workflow.getInfoFor(object,'review_state',None) in ('open','created'):
    5051                        context.portal_workflow.doActionFor(object,'close')
    51                 context.portal_workflow.doActionFor(student,'deactivate')
    52                 logger.info("%s deactivated student  %s" % (member,student_id))
     52                try:
     53                    context.portal_workflow.doActionFor(student,'deactivate')
     54                except:
     55                    logger.info("%s failed to deactivate student %s in state %s" % (member,student_id,student_state))
     56                    deleted_list.append(student_id + ' (failed)')
     57                    continue
     58                logger.info("%s deactivated student %s" % (member,student_id))
    5359                deleted_list.append(student_id)
    5460            else:
    5561                logger.info("Student object %s not found" % (student_id))
    5662                continue
    57         psm = "%s deactivated" % ' '.join(deleted_list)
     63        psm = "Deactivated: %s" % ' '.join(deleted_list)
    5864
    5965if student_ids:
Note: See TracChangeset for help on using the changeset viewer.