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

new function picturesExist in waeup_tool used in clearance_edit

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.