My favorites | Sign in
Logo
          
New issue | Search
for
| Advanced search | Search tips
Issue 781: missing exception in NewReviewRequestForm().create
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Jul 2009
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by marc....@gmail.com, Dec 21, 2008

What's the URL of the page this enhancement relates to, if any?
The part of the code is used when creating a new review request

Describe the enhancement and the motivation for it.
This is just to avoid a future bug, two cases will delete the review 
request instance and a few lines later, the function will try to save it.


to sum-up, the code  below may be executed:
review_request.delete()
review_request.save() # will raise an exception.


You should raise a new exception for instance:
(from http://code.google.com/p/reviewboard/source/browse/trunk/reviewboard/review
s/forms.py)

        try:
            diff_form.create(diff_file, parent_diff_file,
                             review_request.diffset_history)
            if 'path' in diff_form.errors:
                review_request.delete()
                self.errors['diff_path'] = diff_form.errors['path']
                raise NewExceptionError # here
            elif 'base_diff_path' in diff_form.errors:
                review_request.delete()
                self.errors['base_diff_path'] = 
diff_form.errors['base_diff_path']
                raise NewExceptionError # and here
        except EmptyDiffError:
            review_request.delete()
            self.errors['diff_path'] = forms.util.ErrorList([
                'The selected file does not appear to be a diff.'])
            raise
        except Exception, e:
            review_request.delete()
            self.errors['diff_path'] = forms.util.ErrorList([e])
            raise

        review_request.add_default_reviewers()
        review_request.save()
        return review_request


Comment 1 by trowbrds, Jul 26, 2009
Fixed in SVN r2062. Thanks!
Status: Fixed
Sign in to add a comment

Powered by Google Project Hosting