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

« back to all changes in this revision

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

  • Committer: Matt Giuca
  • Date: 2010-02-25 06:52:09 UTC
  • mto: This revision was merged to the branch mainline in revision 1731.
  • Revision ID: matt.giuca@gmail.com-20100225065209-9vc7j8mlwbcj181e
subject.py: ProjectUniquenessValidator now allows a project to have the same shortname as the one it is replacing (allowing you to edit a project without changing its short name, once edit is implemented).

Show diffs side-by-side

added added

removed removed

Lines of Context:
766
766
    hold that short_name. If any other project holds it, the input is rejected.
767
767
    """
768
768
    def _to_python(self, value, state):
769
 
        # TODO: Allow short_name to be equal to existing_project
770
 
        if state.store.find(
 
769
        if (state.store.find(
771
770
            Project,
772
771
            Project.short_name == unicode(value),
773
772
            Project.project_set_id == ProjectSet.id,
774
 
            ProjectSet.offering == state.offering).one():
 
773
            ProjectSet.offering == state.offering).one() not in
 
774
            (None, state.existing_project)):
775
775
            raise formencode.Invalid(
776
776
                "A project with that URL name already exists in this offering."
777
777
                , value, state)