Changeset 2265


Ignore:
Timestamp:
20 Sep 2007, 19:20:04 (17 years ago)
Author:
joachim
Message:

import courses started (not yet finished)

Location:
WAeUP_SRP
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/WAeUPTool.py

    r2264 r2265  
    990990    ###)
    991991
     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
    9921018    field2types_student = {   ###(
    9931019                      'StudentApplication':
     
    11471173            editable_keys.remove('matric_no')
    11481174
    1149         ## included only to change wf state from admitted to returning
    1150         #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 inclusion
     1175        # 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
    11531179
    11541180        sid = res[0].id
     
    11561182        f2t = self.field2types_student
    11571183        d = {}
     1184        #import pdb;pdb.set_trace()
    11581185        any_change = False
    11591186        for pt in f2t.keys():
     
    11831210
    11841211
    1185         ## included only to change wf state from admitted to returning
    1186         #    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         #                pass
    1195         #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 = True
    1201         #    except:
    1202         #        logger.info('%s, wf transition failed, old state = %s' % (sid,res[0].review_state))
    1203         #        pass
    1204         ## end inclusion
     1212        # 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
    12051232
    12061233
     
    12821309                format_error = format + ',"%(Error)s"'
    12831310                format = '"%(id)s",'+ format
    1284 
     1311                           
    12851312            dm = DataModel(item, adapters,context=self)
    12861313            ds = DataStructure(data=item,datamodel=dm)
  • WAeUP_SRP/uniben/profiles/default/layouts.xml

    r2264 r2265  
    1111  <object name="certificate_course" meta_type="CPS Layout"/>
    1212  <object name="course" meta_type="CPS Layout"/>
     13  <object name="import_course" meta_type="CPS Layout"/>
    1314  <object name="import_department" meta_type="CPS Layout"/>
    1415  <object name="department" meta_type="CPS Layout"/>
  • WAeUP_SRP/uniben/profiles/default/schemas.xml

    r2264 r2265  
    1010 <object name="certificate" meta_type="CPS Schema"/>
    1111 <object name="certificate_course" meta_type="CPS Schema"/>
     12 <object name="import_course" meta_type="CPS Schema"/>
    1213 <object name="course" meta_type="CPS Schema"/>
    1314 <object name="import_department" meta_type="CPS Schema"/>
Note: See TracChangeset for help on using the changeset viewer.