Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 781 by marc.bee: missing exception in  
NewReviewRequestForm().create
http://code.google.com/p/reviewboard/issues/detail?id=781


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



--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"reviewboard-issues" group.
To post to this group, send email to reviewboard-issues@googlegroups.com
To unsubscribe from this group, send email to 
reviewboard-issues+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard-issues?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to