Changeset 2364 for WAeUP_SRP/base


Ignore:
Timestamp:
15 Oct 2007, 17:03:44 (17 years ago)
Author:
joachim
Message:

new function picturesList in waeup_tool used in clearance_edit

Location:
WAeUP_SRP/base
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/WAeUPTool.py

    r2363 r2364  
    702702    ###)
    703703
     704    security.declarePublic('picturesList') ###(
     705    def picturesList(self):
     706        """check if pictures exist in the filesystem"""
     707        path = 'images'
     708        student_id = self.getStudentId()
     709        picture_path = os.path.join(i_home,path,student_id)
     710        if not os.path.exists(picture_path):
     711            return []
     712        return [picture[:picture.rfind('_')] for picture in os.listdir(picture_path)]
     713    ###)
     714
    704715    security.declarePublic('showFsPicture') ###(
    705716    def showFsPicture(self,path):
  • WAeUP_SRP/base/skins/waeup_student/clearance_edit.py

    r2363 r2364  
    3636#'Sorry, you are not allowed to access this page!'
    3737if info == None:
    38   return REQUEST.RESPONSE.redirect(context.standard_error_message())
     38    return REQUEST.RESPONSE.redirect(context.standard_error_message())
    3939student = info['student']
    4040#app = info['app']
     
    4949                  )
    5050required_scans = ('fst_sit_scan',
    51                   'age_dec',
    52                   'birth_certificate',
    5351#                 'jamb_slip',
    5452                  'ref_let',
     
    9795        psm = "Content changed!"
    9896        logger.info('%s edited clearance object of %s' % (member_id,student_id ))
    99 
    10097    elif cpsdocument_edit_and_view_button:
    10198        if acknowledge and info['review_state'] == "clearance_pin_entered":
    102             missing = False
    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):
     99            files = context.waeup_tool.picturesList()
     100            req_found = [scan for scan in required_scans if scan in files]
     101            birth_found = "age_dec" in files or "birth_certificate" in files
     102            if not req_found or not birth_found:
    112103                logger.info('%s requested clearance with documents missing' % (student_id))
    113104                psm = "You have not uploaded all necessary documents to request clearance!"
Note: See TracChangeset for help on using the changeset viewer.