Changeset 5047
- Timestamp:
- 11 Mar 2010, 13:16:37 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r5007 r5047 10 10 from hurry import yui 11 11 from hurry.workflow.interfaces import NoTransitionAvailableError 12 from zope import schema 13 try: 14 from zope.authentication.interfaces import ( 15 IAuthentication, IUnauthenticatedPrincipal, ILogout) 16 except ImportError: 17 # BBB 18 from zope.app.security.interfaces import ( 19 IAuthentication, IUnauthenticatedPrincipal, ILogout) 20 from zope.component import ( 21 getUtility, createObject,getAllUtilitiesRegisteredFor) 22 from zope.component.interfaces import Invalid 23 from zope.exceptions import DuplicationError 24 from zope.session.interfaces import ISession 25 12 26 from waeup.sirp.browser import ( 13 27 WAeUPPage, WAeUPEditFormPage, WAeUPAddFormPage, … … 16 30 IUniversity, IFacultyContainer, IFaculty, IDepartment, ICourse, 17 31 ICertificate, ICertificateCourse) 18 from waeup.sirp.university.catalog import search19 32 from waeup.sirp.catalog import search_context 20 33 from waeup.sirp.interfaces import( 21 34 IWAeUPObject, IUserContainer, IUserAccount, IDataCenter, 22 IWAeUPXMLImporter, IWAeUPXMLExporter) 35 IWAeUPXMLImporter, IWAeUPXMLExporter, IBatchProcessor) 36 from waeup.sirp.university.catalog import search 37 from waeup.sirp.utils.helpers import getName 23 38 from waeup.sirp.widgets.interfaces import ITableProvider 24 from waeup.sirp.utils.helpers import getName25 from zope import schema26 from zope.app.security.interfaces import (27 IAuthentication, IUnauthenticatedPrincipal, ILogout)28 from zope.component import getUtility, createObject29 from zope.component.interfaces import Invalid30 from zope.exceptions import DuplicationError31 from zope.session.interfaces import ISession32 33 from waeup.sirp.interfaces import IBatchProcessor34 from zope.component import getAllUtilitiesRegisteredFor35 36 39 37 40 grok.context(IWAeUPObject) … … 215 218 self.context.addUser(name, password, title=title, 216 219 description=description, roles=roles) 220 except KeyError: 221 self.status = Invalid('The userid chosen already exists ' 222 'in the database') 223 return 217 224 except DuplicationError: 218 225 self.status = Invalid('The userid chosen already exists ' … … 768 775 try: 769 776 self.context.addFaculty(faculty) 777 except KeyError: 778 self.status = Invalid('The name chosen already exists ' 779 'in the database') 780 return 770 781 except DuplicationError: 771 782 self.status = Invalid('The name chosen already exists ' … … 841 852 try: 842 853 self.context.addDepartment(department) 854 except KeyError: 855 self.status = Invalid('The code chosen already exists ' 856 'in the database') 857 return 843 858 except DuplicationError: 844 self.status = Invalid('The name chosen already exists '859 self.status = Invalid('The code chosen already exists ' 845 860 'in the database') 846 861 return … … 949 964 try: 950 965 self.context.courses.addCourse(course) 966 except KeyError: 967 self.status = Invalid('The code chosen already exists ' 968 'in the database') 969 return 951 970 except DuplicationError: 952 971 self.status = Invalid('The code chosen already exists ' … … 982 1001 try: 983 1002 self.context.certificates.addCertificate(certificate) 1003 except KeyError: 1004 self.status = Invalid('The name chosen already exists ' 1005 'in the database') 1006 return 984 1007 except DuplicationError: 985 1008 self.status = Invalid('The name chosen already exists ' … … 1205 1228 try: 1206 1229 self.context.addCourseRef(**data) 1230 except KeyError: 1231 self.status = Invalid('The chosen course is already part of' 1232 'this certificate') 1233 return 1207 1234 except DuplicationError: 1208 1235 self.status = Invalid('The chosen course is already part of'
Note: See TracChangeset for help on using the changeset viewer.