Changeset 1707 for WAeUP_SRP/trunk/skins


Ignore:
Timestamp:
25 Apr 2007, 11:58:39 (18 years ago)
Author:
joachim
Message:

new import function for createStudents,
catalog fields added

Location:
WAeUP_SRP/trunk/skins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_default/getSessionId.py

    r1440 r1707  
    1515now = DateTime.DateTime()
    1616if now.month() > 7:
    17     return "%s" % now.year()
    18 return "%s" % (now.year() - 1)
     17    s = "%s" % now.year()
     18else:
     19    s = "%s" % (now.year() - 1)
     20return s
  • WAeUP_SRP/trunk/skins/waeup_utilities/setNewEntryMode.py

    r1706 r1707  
    2323setheader = request.RESPONSE.setHeader
    2424students = context.portal_url.getPortalObject().campus.students
     25import logging
     26logger = logging.getLogger('Skins.setNewEntryMode')
    2527
    2628def rwrite(s):
     
    3032brains = context.portal_catalog(portal_type = 'Student')
    3133count = 0
     34commit_count = 0
    3235#set_trace()
     36logger.info('setNewEntryMode start')
    3337for brain in brains:
    3438    stud_obj = brain.getObject()
    3539    try:     
    3640        app_doc = stud_obj.application.getContent()
    37         try:
    38             sc_doc = stud_obj.study_course.getContent()
    39         except:
    40             sc_doc = None
    4141    except:
    4242        continue
     43    try:
     44        sc_doc = stud_obj.study_course.getContent()
     45    except:
     46        sc_doc = None
    4347    em = getattr(app_doc,'entry_mode',None)
    44     new_em = "%s_ft" % em.lower()
    45     app_doc.edit(mapping={'entry_mode': new_em})
     48    if em in ('ume_ft','de_ft'):
     49        new_em = em
     50    else:
     51        new_em = "%s_ft" % em.lower()
     52    if em in ('ume_ft','UME'):
     53        el = "100"
     54    elif em in ('de_ft','DE'):
     55        el = "200"
     56    app_doc.edit(mapping={'entry_mode': new_em,
     57                          'entry_level': el})
     58    sid = brain.getId
    4659    if sc_doc:
    4760        sc_doc.edit(mapping={'current_mode': new_em})
     61        context.students_catalog.modifyRecord(id = sid,
     62                                              mode=new_em,
     63                                              entry_mode=new_em,
     64                                              entry_level=el)
     65    else:
     66        context.students_catalog.modifyRecord(id = sid,
     67                                              entry_mode=new_em,
     68                                              entry_level=el)
     69       
    4870    count += 1
     71    commit_count += 1
     72    if commit_count > 1000:
     73        context.waeup_tool.doCommit()
     74        logger.info('committing %d total %d' % (commit_count,count))
     75        commit_count = 0
    4976    s = "%d: %s %s -> %s" % (count,brain.getPath(),em,new_em)
    5077    rwrite(s)
    5178rwrite('Done')
     79logger.info('setNewEntryMode finish')
    5280
    5381
Note: See TracChangeset for help on using the changeset viewer.