Index: /main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py	(revision 5046)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py	(revision 5047)
@@ -10,4 +10,18 @@
 from hurry import yui
 from hurry.workflow.interfaces import NoTransitionAvailableError
+from zope import schema
+try:
+    from zope.authentication.interfaces import (
+        IAuthentication, IUnauthenticatedPrincipal, ILogout)
+except ImportError:
+    # BBB
+    from zope.app.security.interfaces import (
+        IAuthentication, IUnauthenticatedPrincipal, ILogout)
+from zope.component import (
+    getUtility, createObject,getAllUtilitiesRegisteredFor)
+from zope.component.interfaces import Invalid
+from zope.exceptions import DuplicationError
+from zope.session.interfaces import ISession
+
 from waeup.sirp.browser import (
     WAeUPPage, WAeUPEditFormPage, WAeUPAddFormPage,
@@ -16,22 +30,11 @@
     IUniversity, IFacultyContainer, IFaculty, IDepartment, ICourse,
     ICertificate, ICertificateCourse)
-from waeup.sirp.university.catalog import search
 from waeup.sirp.catalog import search_context
 from waeup.sirp.interfaces import(
     IWAeUPObject, IUserContainer, IUserAccount, IDataCenter,
-    IWAeUPXMLImporter, IWAeUPXMLExporter)
+    IWAeUPXMLImporter, IWAeUPXMLExporter, IBatchProcessor)
+from waeup.sirp.university.catalog import search
+from waeup.sirp.utils.helpers import getName
 from waeup.sirp.widgets.interfaces import ITableProvider
-from waeup.sirp.utils.helpers import getName
-from zope import schema
-from zope.app.security.interfaces import (
-    IAuthentication, IUnauthenticatedPrincipal, ILogout)
-from zope.component import getUtility, createObject
-from zope.component.interfaces import Invalid
-from zope.exceptions import DuplicationError
-from zope.session.interfaces import ISession
-
-from waeup.sirp.interfaces import IBatchProcessor
-from zope.component import getAllUtilitiesRegisteredFor
-
 
 grok.context(IWAeUPObject)
@@ -215,4 +218,8 @@
             self.context.addUser(name, password, title=title,
                                  description=description, roles=roles)
+        except KeyError:
+            self.status = Invalid('The userid chosen already exists '
+                                  'in the database')
+            return
         except DuplicationError:
             self.status = Invalid('The userid chosen already exists '
@@ -768,4 +775,8 @@
         try:
             self.context.addFaculty(faculty)
+        except KeyError:
+            self.status = Invalid('The name chosen already exists '
+                                  'in the database')
+            return
         except DuplicationError:
             self.status = Invalid('The name chosen already exists '
@@ -841,6 +852,10 @@
         try:
             self.context.addDepartment(department)
+        except KeyError:
+            self.status = Invalid('The code chosen already exists '
+                                  'in the database')
+            return
         except DuplicationError:
-            self.status = Invalid('The name chosen already exists '
+            self.status = Invalid('The code chosen already exists '
                                   'in the database')
             return
@@ -949,4 +964,8 @@
         try:
             self.context.courses.addCourse(course)
+        except KeyError:
+            self.status = Invalid('The code chosen already exists '
+                                  'in the database')
+            return
         except DuplicationError:
             self.status = Invalid('The code chosen already exists '
@@ -982,4 +1001,8 @@
         try:
             self.context.certificates.addCertificate(certificate)
+        except KeyError:
+            self.status = Invalid('The name chosen already exists '
+                                  'in the database')
+            return
         except DuplicationError:
             self.status = Invalid('The name chosen already exists '
@@ -1205,4 +1228,8 @@
         try:
             self.context.addCourseRef(**data)
+        except KeyError:
+            self.status = Invalid('The chosen course is already part of'
+                                  'this certificate')
+            return
         except DuplicationError:
             self.status = Invalid('The chosen course is already part of'
