Changeset 7038 for main/waeup.sirp
- Timestamp:
- 8 Nov 2011, 20:48:58 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/branches/ulif-extimgstore/src/waeup/sirp/applicants/applicant.py
r7002 r7038 23 23 import grok 24 24 from grok import index 25 from zope.component import getUtility26 25 from zope.component.interfaces import IFactory 27 26 from zope.interface import implementedBy 28 27 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 29 from waeup.sirp.interfaces import IObjectHistory, IExtFileStore30 28 from waeup.sirp.app import University 29 from waeup.sirp.image import WAeUPImageFile 30 from waeup.sirp.imagestorage import DefaultFileStoreHandler 31 from waeup.sirp.interfaces import ( 32 IObjectHistory, IFileStoreHandler, IFileStoreNameChooser) 33 from waeup.sirp.utils.helpers import attrs_to_fields 31 34 from waeup.sirp.applicants.interfaces import ( 32 IResultEntry, IApplicant, IApplicantEdit, default_passport_image,35 IResultEntry, IApplicant, IApplicantEdit, 33 36 ) 34 from waeup.sirp.image import WAeUPImageFile 35 from waeup.sirp.utils.helpers import attrs_to_fields 37 36 38 37 39 def get_regno_or_ac(context): … … 57 59 self.application_date = None 58 60 return 59 60 #def getApplicantsRootLogger(self):61 # return grok.getSite()['applicants'].logger62 61 63 62 def loggerInfo(self, ob_class, comment=None): … … 90 89 access_code = index.Field(attribute='access_code') 91 90 92 #class ApplicantTraverser(grok.Traverser):93 # """Get image of the context applicant.94 #95 # Each applicant can provide a passport photograph which will be96 # returned by this traverser if:97 #98 # - we request the exact filename of the picture or99 #100 # - ask for a picture named 'passport.jpg'.101 #102 # If no picture was stored yet, we get a placeholder image when103 # asking for `passport.jpg`.104 #105 # If none of the above applies, we return ``None``, most probably106 # resulting a :exc:`NotFound` exception.107 #108 # """109 # grok.context(IApplicant)110 # def traverse(self, name):111 # if name != 'passport.jpg':112 # return113 # marked_filename = '__img_appl__%s.jpg' % (114 # get_regno_or_ac(self.context))115 # image = getUtility(IExtFileStore).getFile(marked_filename)116 # if image is None:117 # # Return placeholder118 # from waeup.sirp.applicants.interfaces import IMAGE_PATH119 # return open(os.path.join(IMAGE_PATH, 'placeholder_m.jpg'), 'rb')120 # pass121 # return image #WAeUPImageFile(marked_filename, image.read())122 # if not hasattr(self.context, 'passport'):123 # return None124 # passport_filename = getattr(self.context.passport, 'filename', None)125 # if name == passport_filename:126 # return self.context.passport127 # if name == 'passport.jpg':128 # if self.context.passport is not None:129 # return self.context.passport130 # return131 132 91 class ApplicantFactory(grok.GlobalUtility): 133 92 """A factory for applicants. … … 144 103 return implementedBy(Applicant) 145 104 146 from waeup.sirp.interfaces import IFileStoreHandler, IFileStoreNameChooser147 from waeup.sirp.imagestorage import DefaultFileStoreHandler148 105 106 #: The file id marker for applicant passport images 149 107 APPLICANT_IMAGE_STORE_NAME = 'img-applicant' 150 108
Note: See TracChangeset for help on using the changeset viewer.