Changeset 1707 for WAeUP_SRP/trunk/skins
- Timestamp:
- 25 Apr 2007, 11:58:39 (18 years ago)
- Location:
- WAeUP_SRP/trunk/skins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_default/getSessionId.py
r1440 r1707 15 15 now = DateTime.DateTime() 16 16 if now.month() > 7: 17 return "%s" % now.year() 18 return "%s" % (now.year() - 1) 17 s = "%s" % now.year() 18 else: 19 s = "%s" % (now.year() - 1) 20 return s -
WAeUP_SRP/trunk/skins/waeup_utilities/setNewEntryMode.py
r1706 r1707 23 23 setheader = request.RESPONSE.setHeader 24 24 students = context.portal_url.getPortalObject().campus.students 25 import logging 26 logger = logging.getLogger('Skins.setNewEntryMode') 25 27 26 28 def rwrite(s): … … 30 32 brains = context.portal_catalog(portal_type = 'Student') 31 33 count = 0 34 commit_count = 0 32 35 #set_trace() 36 logger.info('setNewEntryMode start') 33 37 for brain in brains: 34 38 stud_obj = brain.getObject() 35 39 try: 36 40 app_doc = stud_obj.application.getContent() 37 try:38 sc_doc = stud_obj.study_course.getContent()39 except:40 sc_doc = None41 41 except: 42 42 continue 43 try: 44 sc_doc = stud_obj.study_course.getContent() 45 except: 46 sc_doc = None 43 47 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 46 59 if sc_doc: 47 60 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 48 70 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 49 76 s = "%d: %s %s -> %s" % (count,brain.getPath(),em,new_em) 50 77 rwrite(s) 51 78 rwrite('Done') 79 logger.info('setNewEntryMode finish') 52 80 53 81
Note: See TracChangeset for help on using the changeset viewer.