Changeset 6236 for main/waeup.sirp/trunk/src
- Timestamp:
- 30 May 2011, 00:29:49 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/university/certificatecontainer.py
r6233 r6236 62 62 def getInterfaces(self): 63 63 return implementedBy(CertificateContainer) 64 65 @grok.subscribe(ICertificate, grok.IObjectAddedEvent)66 def handle_cert_addition(certificate, event):67 """XXX: Move me to certificates.py when everything works as expected.68 """69 cat = queryUtility(ICatalog, name='certificates_catalog', default=None)70 if cat is None:71 return72 entries = cat.searchResults(73 code=(certificate.code,certificate.code))74 if len(entries) == 0:75 return76 for entry in entries:77 if entry is not certificate:78 # XXX: Evil! We should find a way to block addition _before_79 # it actually happens.80 del certificate.__parent__[certificate.__name__]81 raise ValueError('Certificate exists already elsewhere: % s' %82 (certificate.code, ))83
Note: See TracChangeset for help on using the changeset viewer.