~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/xmlrpc/codehosting.py

  • Committer: Aaron Bentley
  • Date: 2011-08-11 21:24:28 UTC
  • mto: This revision was merged to the branch mainline in revision 13690.
  • Revision ID: aaron@canonical.com-20110811212428-n7xd7jd2taaek4ce
Handle invalid source package names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
    LAUNCHPAD_SERVICES,
65
65
    )
66
66
from lp.code.interfaces.linkedbranch import ICanHasLinkedBranch
67
 
from lp.registry.errors import NoSuchSourcePackageName
 
67
from lp.registry.errors import (
 
68
    InvalidName,
 
69
    NoSuchSourcePackageName,
 
70
    )
68
71
from lp.registry.interfaces.person import (
69
72
    IPersonSet,
70
73
    NoSuchPerson,
223
226
                return faults.NotFound(
224
227
                    "Project '%s' does not exist." % e.name)
225
228
            except NoSuchSourcePackageName as e:
226
 
                getUtility(ISourcePackageNameSet).new(e.name)
 
229
                try:
 
230
                    getUtility(ISourcePackageNameSet).new(e.name)
 
231
                except InvalidName:
 
232
                    return faults.InvalidSourcePackageName(e.name)
227
233
                return self.createBranch(login_id, branch_path)
228
234
            except NameLookupFailed, e:
229
235
                return faults.NotFound(str(e))