Changeset 6210 for main/waeup.sirp/trunk
- Timestamp:
- 28 May 2011, 10:56:27 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r6183 r6210 1338 1338 certificate = createObject(u'waeup.Certificate') 1339 1339 self.applyData(certificate, **data) 1340 1341 #try: 1342 # self.applyData(certificate, **data) 1343 #except NoTransitionAvailableError: 1344 # self.status = Invalid('Review state cannot be changed to ' 1345 # 'requested state: no such transition ' 1346 # 'available in workflow.') 1347 # return 1348 1349 try: 1350 self.context.certificates.addCertificate(certificate) 1351 except KeyError: 1352 self.status = Invalid('The name chosen already exists ' 1353 'in the database') 1354 return 1355 except DuplicationError: 1356 self.status = Invalid('The name chosen already exists ' 1357 'in the database') 1358 return 1340 message = self.context.certificates.addCertificate(certificate) 1341 self.flash(message) 1359 1342 self.redirect(self.url(self.context, u'@@manage')+'#tab-3') 1360 1343 -
main/waeup.sirp/trunk/src/waeup/sirp/university/catalog.py
r6208 r6210 28 28 """ 29 29 grok.site(IUniversity) 30 grok.name('certif cates_catalog')30 grok.name('certificates_catalog') 31 31 grok.context(ICertificate) 32 32 33 33 code = grok.index.Field(attribute='code') 34 title= grok.index.Field(attribute='application_category')34 application_category = grok.index.Field(attribute='application_category') 35 35 36 36 class CertificateCoursesIndexes(grok.Indexes): -
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.