Changeset 2300
- Timestamp:
- 2 Oct 2007, 09:13:49 (17 years ago)
- Location:
- WAeUP_SRP/base
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/WAeUPTool.py
r2297 r2300 1484 1484 open(filename,"wb").write(str(image.data)) 1485 1485 1486 security.declareProtected(ModifyPortalContent,"movePassportToFS")###( 1487 def movePassportToFS(self,student_id="O738726"): 1488 "move the passports to the filesystem" 1489 images_dir = os.path.join("%s" % i_home,'passports') 1490 student_folder = getattr(self.portal_url.getPortalObject().campus.students,student_id) 1491 stool = getToolByName(self, 'portal_schemas') 1492 schemas = ['student_application', 1493 #'student_clearance', 1494 ] 1495 created = False 1496 for schema_id in schemas: 1497 schema = stool._getOb(schema_id) 1498 object = getattr(student_folder,schema_id[len('student_'):],None) 1499 if object is None: 1500 continue 1501 doc = object.getContent() 1502 for key in schema.keys(): 1503 if schema[key].meta_type != "CPS Image Field": 1504 continue 1505 #import pdb;pdb.set_trace() 1506 image = getattr(doc,key) 1507 if not hasattr(image,"data"): 1508 continue 1509 if not created: 1510 if not os.path.exists(images_dir): 1511 os.mkdir(images_dir) 1512 created = True 1513 filename = os.path.join(images_dir,"%(student_id)s.jpg" % vars()) 1514 open(filename,"wb").write(str(image.data)) 1515 1486 1516 InitializeClass(WAeUPTool)
Note: See TracChangeset for help on using the changeset viewer.