Changeset 1818
- Timestamp:
- 24 May 2007, 08:57:06 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/WAeUPTool.py
r1816 r1818 67 67 ) 68 68 69 def rwrite(self,s): 69 def rwrite(self,s): ###( 70 70 response = self.REQUEST.RESPONSE 71 71 response.setHeader('Content-type','text/html; charset=ISO-8859-15') 72 72 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') ###( 75 84 def openLog(self,name): 76 85 """open a log file""" … … 83 92 return log 84 93 85 security.declareProtected(ModifyPortalContent,'writeLog') 94 ###) 95 96 security.declareProtected(ModifyPortalContent,'writeLog') ###( 86 97 def writeLog(self,logfile,s): 87 98 """write to the log file""" 88 99 logfile.write(s) 89 100 101 ###) 90 102 91 103 def generateStudentId(self,letter): ###( … … 169 181 app_doc.manage_addFile('passport', 170 182 file=outfile, 171 title="%s.jpg" % matric_no)183 title="%s.jpg" % filename) 172 184 return "successfully loaded passport picture" 173 185 ###) … … 740 752 741 753 security.declareProtected(ModifyPortalContent,'importStudent') ###( 742 def importStudent(self, dict):754 def importStudent(self,mapping): 743 755 "create a students record due import" 744 756 logger = logging.getLogger('WAeUPTool.importStudent') 745 757 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) 747 759 if jamb_reg_no: 748 760 res = self.students_catalog(jamb_reg_no = jamb_reg_no) 749 761 if res: 750 762 return '',"jamb_reg_no exists" 751 matric_no = dict.get('matric_no',None)763 matric_no = mapping.get('matric_no',None) 752 764 if matric_no: 753 765 res = self.students_catalog(matric_no = matric_no) … … 760 772 d = {} 761 773 d['jamb_sex'] = 'M' 762 if dict.get('sex'):774 if mapping.get('sex'): 763 775 d['jamb_sex'] = 'F' 764 776 for pt in f2t.keys(): … … 768 780 d['Title'] = f2t[pt]['title'] 769 781 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] 771 788 sub_doc.edit(mapping = d) 772 789 new_state = f2t[pt]['wf_transition'] … … 780 797 781 798 security.declareProtected(ModifyPortalContent,'importEditStudent') ###( 782 def importEditStudent(self, dict):799 def importEditStudent(self,mapping): 783 800 "edit a students record due import" 784 801 logger = logging.getLogger('WAeUPTool.importEditStudent') 785 802 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) 789 806 if sid: 790 807 res = self.students_catalog(id = sid) … … 813 830 d = {} 814 831 d['jamb_sex'] = 'M' 815 if dict.get('sex'):832 if mapping.get('sex'): 816 833 d['jamb_sex'] = 'F' 817 834 for pt in f2t.keys(): … … 827 844 d['Title'] = f2t[pt]['title'] 828 845 for field in f2t[pt]['fields']: 829 d[field] = dict.get(field,'')846 d[field] = mapping.get(field,'') 830 847 sub_doc.edit(mapping = d) 831 848 # new_state = f2t[pt]['wf_transition'] … … 911 928 error_string = "" 912 929 for k in import_keys: 913 # if k == "birthday":914 # from pdb import set_trace; set_trace()915 930 if not validators[k](ds): 916 931 error_string += " %s : %s" % (k,ds.getError(k))
Note: See TracChangeset for help on using the changeset viewer.