Changeset 1250 for WAeUP_SRP


Ignore:
Timestamp:
9 Jan 2007, 17:19:20 (18 years ago)
Author:
joachim
Message:

set the level from results, also getCredential return the student_pw, fixLevel fixes existing levels

Location:
WAeUP_SRP/trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/WAeUPTool.py

    r1198 r1250  
    7171    ###)
    7272
     73    security.declareProtected(ModifyPortalContent,'getCredential')
     74    def getCredential(self,student_id):
     75        "return a student password"
     76        student_entry = getattr(self.portal_directories.students,student_id,None)
     77        if student_entry is None:
     78            return None
     79        else:
     80            return student_entry.password
     81
    7382    security.declareProtected(ModifyPortalContent,'createOne') ###(
    7483    def createOne(self,students_folder,student_brain,letter,commit=False):
     
    157166            logger.info(em)
    158167        level = student.Level
     168        validlevel = False
    159169        try:
    160170            int(level)
     171            validlevel = True
    161172        except:
    162173            em = '"%(matric_no)s","invalid Level","%(Level)s"' % student
    163174            logger.info(em)
     175        if not validlevel:
     176            erg = self.results_import(matric_no = student.matric_no)
     177            level = 'xxx'
     178            if erg:
     179                level = erg[0].Level
     180            try:
     181                int(level)
     182                em = '"%s","fixed Level from results_import","%s"' % (student.matric_no,erg[0].Level)
     183                logger.info(em)
     184                validlevel = True
     185            except:
     186                em = '"%s","invalid Level in results_import","%s"' % (student.matric_no,erg[0].Level)
     187                logger.info(em)
    164188        matric_no = student.matric_no
    165189        sid = student_id
Note: See TracChangeset for help on using the changeset viewer.