Changeset 1194 for WAeUP_SRP/trunk
- Timestamp:
- 4 Jan 2007, 08:37:30 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/WAeUPTool.py
r1174 r1194 33 33 from Products.CMFCore.permissions import ModifyPortalContent 34 34 from Products.CMFCore.utils import UniqueObject 35 from Products.CMFCore.URLTool import URLTool 35 36 from Students import makeCertificateCode 36 37 import logging … … 55 56 56 57 57 58 58 def generateStudentId(self,letter): ###( 59 59 import random 60 60 r = random 61 if letter not in ('ABCDEFGIHKLMNOPQRSTUVWXY'): 61 ##if letter not in ('ABCDEFGIHKLMNOPQRSTUVWXY'): 62 if letter == '?': 62 63 letter= r.choice('ABCDEFGHKLMNPQRSTUVWXY') 63 students = self.portal_url.getPortalObject().campus.students64 64 sid = "%c%d" % (letter,r.randint(99999,1000000)) 65 while hasattr(students, sid): 65 ## students = self.portal_url.getPortalObject().campus.students 66 ## while hasattr(students, sid): 67 ## sid = "%c%d" % (letter,r.randint(99999,1000000)) 68 while self.students_catalog(id = sid): 66 69 sid = "%c%d" % (letter,r.randint(99999,1000000)) 67 70 return sid … … 69 72 70 73 security.declareProtected(ModifyPortalContent,'createOne') ###( 71 def createOne(self,student_brain,commit=False): 72 students_folder = self.portal_url.getPortalObject().campus.students 73 sid = self.waeup_tool.generateStudentId('?') 74 def createOne(self,students_folder,student_brain,letter,commit=False): 75 sid = self.waeup_tool.generateStudentId(letter) 74 76 students_folder.invokeFactory('Student', sid) 75 77 student = getattr(students_folder,sid) … … 224 226 # Level 225 227 # 226 ## l = getattr(studycourse,level,None) 227 ## if l is None: 228 ## studycourse.invokeFactory('StudentStudyLevel', level) 229 ## l = getattr(studycourse, level) 230 ## self.portal_workflow.doActionFor(l,'open',dest_container=l) 231 ## l.getContent().edit(mapping={'Title': "Level %s" % level}) 228 l = getattr(studycourse,level,None) 229 if l is None: 230 studycourse.invokeFactory('StudentStudyLevel', level) 231 l = getattr(studycourse, level) 232 self.portal_workflow.doActionFor(l,'open',dest_container=l) 233 l.getContent().edit(mapping={'Title': "Level %s" % level}) 234 ###) 235 236 security.declarePublic('makeStudentLevel') ###( 237 def makeStudentLevel(self,student_id): 238 "create the StudyLevel for a returning Student" 239 #import pdb;pdb.set_trace() 240 logger = logging.getLogger('Student.CreateLevel') 241 students_folder = self.portal_url.getPortalObject().campus.students 242 res = self.students_catalog(id=student_id) 243 if res: 244 st = res[0] 245 course = st.course 246 matric_no = st.matric_no 247 level = st.level 248 res = self.results_import(matric_no = matric_no) 249 if res: 250 results = res 251 logger.info('"%s", "creating Level", "%s"' % (student_id,level)) 252 # 253 # Level 254 # 255 student_obj = getattr(self.portal_url.getPortalObject().campus.students,student_id) 256 studycourse = getattr(student_obj,"study_course",None) 257 self.portal_workflow.doActionFor(studycourse,'close_for_edit',dest_container=studycourse) 258 l = getattr(studycourse,level,None) 259 if l is None: 260 studycourse.invokeFactory('StudentStudyLevel', level) 261 l = getattr(studycourse, level) 262 self.portal_workflow.doActionFor(l,'open',dest_container=l) 263 l.getContent().edit(mapping={'Title': "Level %s" % level}) 264 ###) 232 265 233 266 security.declarePublic('getAccommodationInfo') ###(
Note: See TracChangeset for help on using the changeset viewer.