Changeset 2413
- Timestamp:
- 22 Oct 2007, 11:48:58 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/WAeUPTool.py
r2396 r2413 43 43 from Students import makeCertificateCode 44 44 from Globals import package_home,INSTANCE_HOME 45 p_home = package_home(globals())46 i_home = INSTANCE_HOME47 45 import DateTime,time 48 46 import logging 49 47 import transaction 50 48 import csv,re,os,sys 49 from shutil import copy2 51 50 from Products.AdvancedQuery import Eq, Between, Le,In 51 52 p_home = package_home(globals()) 53 i_home = INSTANCE_HOME 54 images_base = os.path.join(i_home,"images") 55 52 56 53 57 def getObject(object,name): … … 374 378 def loadStudentFoto(self,student,filename,folder): 375 379 "return a student passport picture" 380 #import pdb;pdb.set_trace() 381 picture ="%s/import/%s/%s" % (i_home,folder,filename) 382 student_id = student.getId() 383 images_dir = os.path.join("%s" % images_base,student_id) 384 if not os.path.exists(images_dir): 385 os.mkdir(images_dir) 386 image_name = os.path.join(images_dir,"passport_%(student_id)s.jpg" % vars()) 387 for extension in ('.jpg','.JPG'): 388 fullname = "%(picture)s%(extension)s" % vars() 389 if os.path.exists(fullname): 390 copy2(fullname,image_name) 391 return "successfully copied passport picture" 392 return "passport picture not found %s.(jpg,.JPG)" % picture 393 ###) 394 395 security.declarePublic('loadStudentFoto') ###( 396 def old____loadStudentFoto(self,student,filename,folder): 397 "return a student passport picture" 376 398 app = student.application 377 399 app_doc = app.getContent() … … 1509 1531 def moveImagesToFS(self,student_id="O738726"): 1510 1532 "move the images to the filesystem" 1511 images_dir = os.path.join("%s /images" % i_home,student_id)1533 images_dir = os.path.join("%s" % images_base,student_id) 1512 1534 student_folder = getattr(self.portal_url.getPortalObject().campus.students,student_id) 1513 1535 stool = getToolByName(self, 'portal_schemas')
Note: See TracChangeset for help on using the changeset viewer.