Changeset 1704 for WAeUP_SRP


Ignore:
Timestamp:
24 Apr 2007, 18:15:34 (18 years ago)
Author:
joachim
Message:

sets also current_mode in study_course

File:
1 edited

Legend:

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

    r1703 r1704  
    2828    response.write("%s<br />\r\n" % s)
    2929
    30 brains = context.portal_catalog(portal_type = 'StudentApplication')
     30brains = context.portal_catalog(portal_type = 'Student')
    3131count = 0
    3232#set_trace()
    3333for brain in brains:
    34     app_doc = brain.getObject().getContent()
     34    student_path = brain.getPath()
     35    sub_brains = context.portal_catalog(path = student_path)
     36    app_doc = None
     37    sc_doc = None
     38    for sb in sub_brains:
     39        if sb.getId == 'application':
     40            app_doc = sb.getObject().getContent()
     41        elif sb.getId == 'study_course':
     42            sc_doc = sb.getObject().getContent()
     43    if app_doc is None:
     44        continue
    3545    em = getattr(app_doc,'entry_mode',None)
    36     data = {'entry_mode': "%s_ft" % em.lower()}
    37     app_doc.edit(mapping=data)
     46    new_em = "%s_ft" % em.lower()
     47    app_doc.edit(mapping={'entry_mode': new_em})
     48    if sc_doc:
     49        sc_doc.edit(mapping={'current_mode': new_em})
    3850    count += 1
    39     s = "%d: %s %s -> %s" % (count,brain.getPath(),em,data['entry_mode'])
     51    s = "%d: %s %s -> %s" % (count,brain.getPath(),em,new_em)
    4052    rwrite(s)
    4153rwrite('Done')
Note: See TracChangeset for help on using the changeset viewer.