Changeset 1285


Ignore:
Timestamp:
12 Jan 2007, 16:04:40 (18 years ago)
Author:
joachim
Message:

upload passport foto during login for returning students.
filename of foto is matric_no.jpg in import/pictures_returning

Location:
WAeUP_SRP/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/WAeUPTool.py

    r1263 r1285  
    3535from Products.CMFCore.URLTool import URLTool
    3636from Students import makeCertificateCode
    37 import logging
     37from Globals import package_home,INSTANCE_HOME
     38p_home = package_home(globals())
     39i_home = INSTANCE_HOME
     40import logging,os
    3841import transaction
    3942
     
    7982        return getattr(student_entry,"password","not set")
    8083    ###)
     84
     85    security.declarePublic('loadStudentFoto') ###(
     86    def loadStudentFoto(self,student):
     87        "return a student passport picture"
     88        app_doc = student.application.getContent()
     89        clear = student.clearance
     90        clear_doc = clear.getContent()
     91        matric_no = clear_doc.matric_no.upper()
     92        picture ="%s/import/pictures_returning/%s.jpg" % (i_home,matric_no)
     93        #import pdb;pdb.set_trace()
     94        if not os.path.exists(picture):
     95            return "Passport foto not found %s" % picture
     96        file = open(picture)
     97        outfile = file.read()
     98        app_doc.manage_addFile('passport',
     99                               file=outfile,
     100                               title="%s.jpg" % matric_no)
     101        return "successfully loaded passport"
     102    ###)
     103
    81104
    82105    security.declareProtected(ModifyPortalContent,'createOne') ###(
  • WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py

    r1242 r1285  
    3131is_anon = mtool.isAnonymousUser()
    3232member = mtool.getAuthenticatedMember()
     33load_passport = hasattr(context.waeup_tool,'loadStudentFoto')
    3334
    3435if not is_anon:
     
    6566        logger.info('"%s", "logged in", "review_state %s"' % (member,s_review_state))
    6667        app_doc = student_app.getContent()
    67         #from Products.zdb import set_trace
    68         #set_trace()
     68        #from Products.zdb import set_trace;set_trace()
     69        if load_passport and 'passport' not in app_doc.objectIds():
     70            msg = context.waeup_tool.loadStudentFoto(student)
     71            logger.info('"%s", "%s"' % (member,msg))
    6972        if s_review_state in ("student_created","admitted") and\
    7073                             a_review_state == 'created' :
  • WAeUP_SRP/trunk/skins/waeup_utilities/fixLevel.py

    r1284 r1285  
    6666        context.students_catalog.modifyRecord(id=id, level=level)
    6767        modified.append("%s, %s" % (id,c))
    68        
    6968return '\n'.join(modified)
Note: See TracChangeset for help on using the changeset viewer.