Changeset 2363


Ignore:
Timestamp:
15 Oct 2007, 12:04:52 (17 years ago)
Author:
joachim
Message:

new function picturesExist in waeup_tool used in clearance_edit

Location:
WAeUP_SRP/base
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/WAeUPTool.py

    r2354 r2363  
    690690    ###)
    691691
     692    security.declarePublic('picturesExist') ###(
     693    def picturesExist(self, ids):
     694        """check if pictures exist in the filesystem"""
     695        path = 'images'
     696        student_id = self.getStudentId()
     697        picture_path = os.path.join(i_home,path,student_id)
     698        if not os.path.exists(picture_path):
     699            return False
     700        pictures  = [picture[:picture.rfind('_')] for picture in os.listdir(picture_path)]
     701        return set(ids).issubset(set(pictures))
     702    ###)
     703
    692704    security.declarePublic('showFsPicture') ###(
    693705    def showFsPicture(self,path):
     
    705717        if os.path.exists(picture_path):
    706718            return open(picture_path).read()
    707 
    708 
    709719    ###)
    710720
  • WAeUP_SRP/base/skins/waeup_student/clearance_edit.py

    r2013 r2363  
    4949                  )
    5050required_scans = ('fst_sit_scan',
     51                  'age_dec',
     52                  'birth_certificate',
    5153#                 'jamb_slip',
    5254                  'ref_let',
     
    9698        logger.info('%s edited clearance object of %s' % (member_id,student_id ))
    9799
    98         ## No idea why the following lines were still active until July 6.
    99         ## The code does not make any sense. When editing the clearance object
    100         ## as admin, always the PIN HOS-1-4921190317
    101         ## was filled in. This was the only PIN ever used by admin.
    102        
    103         #if clear_doc.clr_ac_pin == "":
    104         #    res = context.portal_pins(student=member_id)
    105         #    if res:
    106         #        p = res[0].pin
    107         #        if len(p) > 10:
    108         #            pin = "%s-%s-%s" % (p[:3],p[3:4],p[4:])
    109         #        else:
    110         #            pin = p
    111         #        clear_doc.edit(mapping={'clr_ac_pin': pin})
    112 
    113         ## simple method to remove the wrong PIN
    114        
    115         #if clear_doc.clr_ac_pin.startswith('HOS'):
    116         #    pin=''
    117         #    clear_doc.edit(mapping={'clr_ac_pin': pin})
    118 
    119 
    120100    elif cpsdocument_edit_and_view_button:
    121101        if acknowledge and info['review_state'] == "clearance_pin_entered":
    122102            missing = False
    123             files = clear_doc.objectIds()
    124             for scan in required_scans:
    125                 if scan not in files:
    126                     missing = True
    127                     break
    128             if not missing:
    129                 if not "age_dec" in files and not "birth_certificate" in files:
    130                     missing = True
    131             if missing:
     103            #files = clear_doc.objectIds()
     104            # for scan in required_scans:
     105            #     if scan not in files:
     106            #         missing = True
     107            #         break
     108            # if not missing:
     109            #     if not "age_dec" in files and not "birth_certificate" in files:
     110            #         missing = True
     111            if not context.waeup_tool.picturesExist(required_scans):
    132112                logger.info('%s requested clearance with documents missing' % (student_id))
    133113                psm = "You have not uploaded all necessary documents to request clearance!"
Note: See TracChangeset for help on using the changeset viewer.