- Timestamp:
- 28 May 2011, 10:56:27 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/university/certificatecontainer.py
r5005 r6210 5 5 ICertificateContainer, ICertificate) 6 6 from zope.component.interfaces import IFactory 7 from zope.catalog.interfaces import ICatalog 8 from zope.component import getUtility 7 9 from zope.interface import implementedBy 8 10 … … 17 19 raise TypeError('CertificateContainers contain only ' 18 20 'ICertificate instances') 21 cat = getUtility(ICatalog, name='certificates_catalog') 22 results = list(cat.searchResults(code=(certificate.code,certificate.code))) 23 if results: 24 dep = results[0].__parent__.__parent__.longtitle() 25 fac = results[0].__parent__.__parent__.__parent__.longtitle() 26 return 'Certificate exists in %s / %s.' % (fac,dep) 19 27 self[certificate.code] = certificate 20 return 28 return 'Certificate added.' 21 29 22 30 def clear(self):
Note: See TracChangeset for help on using the changeset viewer.