Mercurial > kallithea
comparison rhodecode/model/validators.py @ 2897:1f7b8c73c94a
Merge with beta
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 08 Oct 2012 22:37:09 +0200 |
parents | eb180eb16c18 |
children | 4cc9bb83ecb4 |
comparison
equal
deleted
inserted
replaced
2880:3c7c24f9031f | 2897:1f7b8c73c94a |
---|---|
664 ) | 664 ) |
665 | 665 |
666 return _validator | 666 return _validator |
667 | 667 |
668 | 668 |
669 def NotReviewedRevisions(): | 669 def NotReviewedRevisions(repo_id): |
670 class _validator(formencode.validators.FancyValidator): | 670 class _validator(formencode.validators.FancyValidator): |
671 messages = { | 671 messages = { |
672 'rev_already_reviewed': | 672 'rev_already_reviewed': |
673 _(u'Revisions %(revs)s are already part of pull request ' | 673 _(u'Revisions %(revs)s are already part of pull request ' |
674 'or have set status') | 674 'or have set status') |
676 | 676 |
677 def validate_python(self, value, state): | 677 def validate_python(self, value, state): |
678 # check revisions if they are not reviewed, or a part of another | 678 # check revisions if they are not reviewed, or a part of another |
679 # pull request | 679 # pull request |
680 statuses = ChangesetStatus.query()\ | 680 statuses = ChangesetStatus.query()\ |
681 .filter(ChangesetStatus.revision.in_(value)).all() | 681 .filter(ChangesetStatus.revision.in_(value))\ |
682 .filter(ChangesetStatus.repo_id == repo_id)\ | |
683 .all() | |
684 | |
682 errors = [] | 685 errors = [] |
683 for cs in statuses: | 686 for cs in statuses: |
684 if cs.pull_request_id: | 687 if cs.pull_request_id: |
685 errors.append(['pull_req', cs.revision[:12]]) | 688 errors.append(['pull_req', cs.revision[:12]]) |
686 elif cs.status: | 689 elif cs.status: |