Changeset 6228 for main/waeup.sirp/trunk/src/waeup/sirp/browser
- Timestamp:
- 29 May 2011, 23:25:13 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r6216 r6228 16 16 from zope.authentication.interfaces import ( 17 17 IAuthentication, IUnauthenticatedPrincipal, ILogout) 18 from zope.catalog.interfaces import ICatalog 18 19 from zope.securitypolicy.interfaces import ( 19 20 IPrincipalRoleManager, IPrincipalRoleMap) … … 21 22 getUtility, createObject,getAllUtilitiesRegisteredFor) 22 23 from zope.component.interfaces import Invalid 23 from zope.exceptions import DuplicationError24 24 from zope.session.interfaces import ISession 25 25 from zope.event import notify … … 36 36 IWAeUPObject, IUserContainer, IUserAccount, IDataCenter, 37 37 IWAeUPXMLImporter, IWAeUPXMLExporter, IBatchProcessor, 38 ILocalRolesAssignable )38 ILocalRolesAssignable, DuplicationError) 39 39 from waeup.sirp.permissions import get_users_with_local_roles, getRoles 40 40 from waeup.sirp.university.catalog import search … … 1330 1330 certificate = createObject(u'waeup.Certificate') 1331 1331 self.applyData(certificate, **data) 1332 message = self.context.certificates.addCertificate(certificate) 1332 try: 1333 self.context.certificates.addCertificate(certificate) 1334 except DuplicationError, error: 1335 # signals duplication error 1336 entries = error.entries 1337 for entry in entries: 1338 # show links to all certs with same code 1339 message = 'A certificate with same code already exists: ' 1340 message += '<a href="%s">%s</a>' % ( 1341 self.url(entry), getattr(entry, '__name__', u'Unnamed')) 1342 self.flash(message) 1343 self.redirect(self.url(self.context, u'@@addcertificate')) 1344 return 1345 message = u'Certificate %s successfully created.' % (certificate.code) 1333 1346 self.flash(message) 1334 1347 self.redirect(self.url(self.context, u'@@manage')+'#tab-3') 1348 return 1335 1349 1336 1350 @grok.action('Cancel', validator=NullValidator)
Note: See TracChangeset for help on using the changeset viewer.