Changeset 1818


Ignore:
Timestamp:
24 May 2007, 08:57:06 (18 years ago)
Author:
joachim
Message:

fix undefined matric_no in loadStudentFoto

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/WAeUPTool.py

    r1816 r1818  
    6767                     )
    6868
    69     def rwrite(self,s):
     69    def rwrite(self,s): ###(
    7070        response = self.REQUEST.RESPONSE
    7171        response.setHeader('Content-type','text/html; charset=ISO-8859-15')
    7272        response.write("%s<br />\r\n" % s)
    73 
    74     security.declareProtected(ModifyPortalContent,'openLog')
     73    ###)
     74
     75    def sleep(self,secs): ###(
     76        "sleep"
     77        import time
     78        time.sleep(secs)
     79        return
     80   
     81###)
     82
     83    security.declareProtected(ModifyPortalContent,'openLog') ###(
    7584    def openLog(self,name):
    7685        """open a log file"""
     
    8392        return log
    8493
    85     security.declareProtected(ModifyPortalContent,'writeLog')
     94###)
     95
     96    security.declareProtected(ModifyPortalContent,'writeLog') ###(
    8697    def writeLog(self,logfile,s):
    8798        """write to the log file"""
    8899        logfile.write(s)
    89100
     101###)
    90102
    91103    def generateStudentId(self,letter): ###(
     
    169181        app_doc.manage_addFile('passport',
    170182                               file=outfile,
    171                                title="%s.jpg" % matric_no)
     183                               title="%s.jpg" % filename)
    172184        return "successfully loaded passport picture"
    173185    ###)
     
    740752
    741753    security.declareProtected(ModifyPortalContent,'importStudent') ###(
    742     def importStudent(self,dict):
     754    def importStudent(self,mapping):
    743755        "create a students record due import"
    744756        logger = logging.getLogger('WAeUPTool.importStudent')
    745757        students_folder = self.portal_url.getPortalObject().campus.students
    746         jamb_reg_no = dict.get('jamb_reg_no',None)
     758        jamb_reg_no = mapping.get('jamb_reg_no',None)
    747759        if jamb_reg_no:
    748760            res = self.students_catalog(jamb_reg_no = jamb_reg_no)
    749761            if res:
    750762                return '',"jamb_reg_no exists"
    751         matric_no = dict.get('matric_no',None)
     763        matric_no = mapping.get('matric_no',None)
    752764        if matric_no:
    753765            res = self.students_catalog(matric_no = matric_no)
     
    760772        d = {}
    761773        d['jamb_sex']  = 'M'
    762         if dict.get('sex'):
     774        if mapping.get('sex'):
    763775            d['jamb_sex']  = 'F'
    764776        for pt in f2t.keys():
     
    768780            d['Title'] = f2t[pt]['title']
    769781            for field in f2t[pt]['fields']:
    770                 d[field] = dict.get(field,'')
     782                d[field] = mapping.get(field,'')
     783            if pt == "StudyCourse":
     784                for von,zu in (('entry_mode','current_mode'),
     785                               ('entry_session','current_session')):
     786                    if mapping.get(zu,None) is None and mapping.get(von,None) is not None:
     787                        d[zu] = mapping[von]
    771788            sub_doc.edit(mapping = d)
    772789            new_state = f2t[pt]['wf_transition']
     
    780797
    781798    security.declareProtected(ModifyPortalContent,'importEditStudent') ###(
    782     def importEditStudent(self,dict):
     799    def importEditStudent(self,mapping):
    783800        "edit a students record due import"
    784801        logger = logging.getLogger('WAeUPTool.importEditStudent')
    785802        students_folder = self.portal_url.getPortalObject().campus.students
    786         sid = dict.get('id',None)
    787         jamb_reg_no = dict.get('jamb_reg_no',None)
    788         matric_no = dict.get('matric_no',None)
     803        sid = mapping.get('id',None)
     804        jamb_reg_no = mapping.get('jamb_reg_no',None)
     805        matric_no = mapping.get('matric_no',None)
    789806        if sid:
    790807            res = self.students_catalog(id = sid)
     
    813830        d = {}
    814831        d['jamb_sex']  = 'M'
    815         if dict.get('sex'):
     832        if mapping.get('sex'):
    816833            d['jamb_sex']  = 'F'
    817834        for pt in f2t.keys():
     
    827844            d['Title'] = f2t[pt]['title']
    828845            for field in f2t[pt]['fields']:
    829                 d[field] = dict.get(field,'')
     846                d[field] = mapping.get(field,'')
    830847            sub_doc.edit(mapping = d)
    831848            # new_state = f2t[pt]['wf_transition']
     
    911928            error_string = ""
    912929            for k in import_keys:
    913                 # if k == "birthday":
    914                 #     from pdb import set_trace; set_trace()
    915930                if not validators[k](ds):
    916931                    error_string += " %s : %s" % (k,ds.getError(k))
Note: See TracChangeset for help on using the changeset viewer.