Changeset 5763 for main/waeup.sirp/trunk
- Timestamp:
- 13 Feb 2011, 14:40:04 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/applicants.py
r5753 r5763 108 108 109 109 class ApplicantTraverser(grok.Traverser): 110 """Get image of the context applicant. 111 112 Each applicant can provide a passport photograph which will be 113 returned by this traverser if: 114 115 - we request the exact filename of the picture or 116 117 - ask for a picture named 'passport.jpg'. 118 119 If no picture was stored yet, we get a placeholder image when 120 asking for `passport.jpg`. 121 122 If none of the above applies, we return ``None``, most probably 123 resulting a :exc:`NotFound` exception. 124 125 """ 110 126 grok.context(IApplicant) 111 127 def traverse(self, name): 112 #passport_filename = self.context.passport.filename113 128 passport_filename = getattr(self.context.passport, 'filename', None) 114 print "FILENAME: ", passport_filename115 129 if name == passport_filename: 116 print "USE FILE", self.context.passport117 130 return self.context.passport 118 131 if name == 'passport.jpg': 119 if self.context.passport is not None: 120 print "PP: ", self.context.passport 132 if self.context.passport is not False: 121 133 return self.context.passport 122 134 return PassportImage(None) 135 return 123 136 124 137 class ApplicantFactory(grok.GlobalUtility):
Note: See TracChangeset for help on using the changeset viewer.