Changeset 2265
- Timestamp:
- 20 Sep 2007, 19:20:04 (17 years ago)
- Location:
- WAeUP_SRP
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/WAeUPTool.py
r2264 r2265 990 990 ###) 991 991 992 security.declareProtected(ModifyPortalContent,'mass_create_course') ###( 993 def mass_create_course(self,mapping): 994 if getattr(self,'_v_course_list',None) is None: 995 self._v_course_list = [] 996 if getattr(self,'_v_departments',None) is None: 997 res = self.portal_catalog(portal_type = "Department") 998 self._v_departments = {} 999 for d in res: 1000 self._v_departments[d.getId] = d.getObject() 1001 did = mapping['department_code'] 1002 d = self._v_departments.get(did,None) 1003 if d is None: 1004 return '', "No Department with ID: %s" % fid 1005 course_id = mapping.get('code') 1006 if course_id in self._v_course_list: 1007 return '', "Duplicate Department ID: %s" % did 1008 c = getattr(d,course_id,None) 1009 if c is not None: 1010 return '', "Duplicate Department ID: %s" % did 1011 d.invokeFactory('Course', course_id) 1012 self._v_course_list.append(course_id) 1013 c = getattr(d,course_id) 1014 c.getContent().edit(mapping=mapping) 1015 return course_id,'' 1016 ###) 1017 992 1018 field2types_student = { ###( 993 1019 'StudentApplication': … … 1147 1173 editable_keys.remove('matric_no') 1148 1174 1149 # #included only to change wf state from admitted to returning1150 #if res[0].review_state not in ('admitted','objection_raised'):1151 #return '%s' % res[0].id ,"student is not in state admitted or objection_raised"1152 # #end inclusion1175 # included only to change wf state from admitted to returning 1176 if res[0].review_state not in ('admitted','objection_raised'): 1177 return '%s' % res[0].id ,"student is not in state admitted or objection_raised" 1178 # end inclusion 1153 1179 1154 1180 sid = res[0].id … … 1156 1182 f2t = self.field2types_student 1157 1183 d = {} 1184 #import pdb;pdb.set_trace() 1158 1185 any_change = False 1159 1186 for pt in f2t.keys(): … … 1183 1210 1184 1211 1185 # #included only to change wf state from admitted to returning1186 #if res[0].review_state in ('admitted','objection_raised'):1187 #new_state = f2t[pt]['wf_transition_return']1188 #sub_obj = getattr(student_obj,f2t[pt]['id'],None)1189 #if sub_obj and new_state != "remain":1190 #try:1191 #self.portal_workflow.doActionFor(sub_obj,new_state,dest_container=sub_obj)1192 #except:1193 ##logger.info('%s, wf transition %s of %s failed' % (sid,new_state,sub_obj.id))1194 #pass1195 #if res[0].review_state in ('admitted','objection_raised'):1196 #wfaction = 'return'1197 #try:1198 #self.portal_workflow.doActionFor(student_obj,wfaction)1199 #logger.info('%s, wf state changed' % sid)1200 #any_change = True1201 #except:1202 #logger.info('%s, wf transition failed, old state = %s' % (sid,res[0].review_state))1203 #pass1204 # #end inclusion1212 # included only to change wf state from admitted to returning 1213 if res[0].review_state in ('admitted','objection_raised'): 1214 new_state = f2t[pt]['wf_transition_return'] 1215 sub_obj = getattr(student_obj,f2t[pt]['id'],None) 1216 if sub_obj and new_state != "remain": 1217 try: 1218 self.portal_workflow.doActionFor(sub_obj,new_state,dest_container=sub_obj) 1219 except: 1220 #logger.info('%s, wf transition %s of %s failed' % (sid,new_state,sub_obj.id)) 1221 pass 1222 if res[0].review_state in ('admitted','objection_raised'): 1223 wfaction = 'return' 1224 try: 1225 self.portal_workflow.doActionFor(student_obj,wfaction) 1226 logger.info('%s, wf state changed' % sid) 1227 any_change = True 1228 except: 1229 logger.info('%s, wf transition failed, old state = %s' % (sid,res[0].review_state)) 1230 pass 1231 # end inclusion 1205 1232 1206 1233 … … 1282 1309 format_error = format + ',"%(Error)s"' 1283 1310 format = '"%(id)s",'+ format 1284 1311 1285 1312 dm = DataModel(item, adapters,context=self) 1286 1313 ds = DataStructure(data=item,datamodel=dm) -
WAeUP_SRP/uniben/profiles/default/layouts.xml
r2264 r2265 11 11 <object name="certificate_course" meta_type="CPS Layout"/> 12 12 <object name="course" meta_type="CPS Layout"/> 13 <object name="import_course" meta_type="CPS Layout"/> 13 14 <object name="import_department" meta_type="CPS Layout"/> 14 15 <object name="department" meta_type="CPS Layout"/> -
WAeUP_SRP/uniben/profiles/default/schemas.xml
r2264 r2265 10 10 <object name="certificate" meta_type="CPS Schema"/> 11 11 <object name="certificate_course" meta_type="CPS Schema"/> 12 <object name="import_course" meta_type="CPS Schema"/> 12 13 <object name="course" meta_type="CPS Schema"/> 13 14 <object name="import_department" meta_type="CPS Schema"/>
Note: See TracChangeset for help on using the changeset viewer.