~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/admin/projectservice.py

  • Committer: William Grant
  • Date: 2010-02-16 07:22:43 UTC
  • mto: This revision was merged to the branch mainline in revision 1674.
  • Revision ID: grantw@unimelb.edu.au-20100216072243-iq9ej3kz3xq6t0ja
Fail nicely if a project with the same name already exists.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
                "Project names must consist of an alphanumeric character "
48
48
                "followed by any number of alphanumerics, ., + or -.")
49
49
 
 
50
        if req.store.find(
 
51
            Project,
 
52
            Project.short_name == unicode(short_name),
 
53
            Project.project_set_id == ProjectSet.id,
 
54
            ProjectSet.offering == self.context.offering).one():
 
55
            raise BadRequest(
 
56
                "A project with that URL name already exists in this offering."
 
57
                )
 
58
 
50
59
        new_project = Project()
51
60
        new_project.name = unicode(name)
52
61
        new_project.short_name = unicode(short_name)