Ignore:
Timestamp:
11 Mar 2010, 13:16:37 (15 years ago)
Author:
uli
Message:
  • Reorder imports (PEP 8)
  • BBB imports for old packages.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py

    r5007 r5047  
    1010from hurry import yui
    1111from hurry.workflow.interfaces import NoTransitionAvailableError
     12from zope import schema
     13try:
     14    from zope.authentication.interfaces import (
     15        IAuthentication, IUnauthenticatedPrincipal, ILogout)
     16except ImportError:
     17    # BBB
     18    from zope.app.security.interfaces import (
     19        IAuthentication, IUnauthenticatedPrincipal, ILogout)
     20from zope.component import (
     21    getUtility, createObject,getAllUtilitiesRegisteredFor)
     22from zope.component.interfaces import Invalid
     23from zope.exceptions import DuplicationError
     24from zope.session.interfaces import ISession
     25
    1226from waeup.sirp.browser import (
    1327    WAeUPPage, WAeUPEditFormPage, WAeUPAddFormPage,
     
    1630    IUniversity, IFacultyContainer, IFaculty, IDepartment, ICourse,
    1731    ICertificate, ICertificateCourse)
    18 from waeup.sirp.university.catalog import search
    1932from waeup.sirp.catalog import search_context
    2033from waeup.sirp.interfaces import(
    2134    IWAeUPObject, IUserContainer, IUserAccount, IDataCenter,
    22     IWAeUPXMLImporter, IWAeUPXMLExporter)
     35    IWAeUPXMLImporter, IWAeUPXMLExporter, IBatchProcessor)
     36from waeup.sirp.university.catalog import search
     37from waeup.sirp.utils.helpers import getName
    2338from waeup.sirp.widgets.interfaces import ITableProvider
    24 from waeup.sirp.utils.helpers import getName
    25 from zope import schema
    26 from zope.app.security.interfaces import (
    27     IAuthentication, IUnauthenticatedPrincipal, ILogout)
    28 from zope.component import getUtility, createObject
    29 from zope.component.interfaces import Invalid
    30 from zope.exceptions import DuplicationError
    31 from zope.session.interfaces import ISession
    32 
    33 from waeup.sirp.interfaces import IBatchProcessor
    34 from zope.component import getAllUtilitiesRegisteredFor
    35 
    3639
    3740grok.context(IWAeUPObject)
     
    215218            self.context.addUser(name, password, title=title,
    216219                                 description=description, roles=roles)
     220        except KeyError:
     221            self.status = Invalid('The userid chosen already exists '
     222                                  'in the database')
     223            return
    217224        except DuplicationError:
    218225            self.status = Invalid('The userid chosen already exists '
     
    768775        try:
    769776            self.context.addFaculty(faculty)
     777        except KeyError:
     778            self.status = Invalid('The name chosen already exists '
     779                                  'in the database')
     780            return
    770781        except DuplicationError:
    771782            self.status = Invalid('The name chosen already exists '
     
    841852        try:
    842853            self.context.addDepartment(department)
     854        except KeyError:
     855            self.status = Invalid('The code chosen already exists '
     856                                  'in the database')
     857            return
    843858        except DuplicationError:
    844             self.status = Invalid('The name chosen already exists '
     859            self.status = Invalid('The code chosen already exists '
    845860                                  'in the database')
    846861            return
     
    949964        try:
    950965            self.context.courses.addCourse(course)
     966        except KeyError:
     967            self.status = Invalid('The code chosen already exists '
     968                                  'in the database')
     969            return
    951970        except DuplicationError:
    952971            self.status = Invalid('The code chosen already exists '
     
    9821001        try:
    9831002            self.context.certificates.addCertificate(certificate)
     1003        except KeyError:
     1004            self.status = Invalid('The name chosen already exists '
     1005                                  'in the database')
     1006            return
    9841007        except DuplicationError:
    9851008            self.status = Invalid('The name chosen already exists '
     
    12051228        try:
    12061229            self.context.addCourseRef(**data)
     1230        except KeyError:
     1231            self.status = Invalid('The chosen course is already part of'
     1232                                  'this certificate')
     1233            return
    12071234        except DuplicationError:
    12081235            self.status = Invalid('The chosen course is already part of'
Note: See TracChangeset for help on using the changeset viewer.