Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix an exception in the fill-database script.

fill-database.py raised the following error "AttributeError: 'file'
object has no attribute 'size'" whenever it was called with a greater
than 0 diff number.

Updating the script to use UploadedFile instead of a regular File object
fixes the problem.

Reviewed at http://reviews.reviewboard.org/r/3086/
  • Loading branch information...
commit 6cdbdf7e74d50058f7cdb3fcfce87e2df80edd41 1 parent 77e875a
@bogdanap bogdanap authored chipx86 committed
View
1  AUTHORS
@@ -24,6 +24,7 @@ Contributors:
* Ben Jansen
* Bob Miller
* Bob Van Zant
+ * Bogdana Popa
* Brad Taylor
* Bret McMillan
* Brett Simmers
View
3  reviewboard/reviews/management/commands/fill-database.py
@@ -6,6 +6,7 @@
from django import db
from django.contrib.auth.models import User
+from django.core.files.uploadedfile import UploadedFile
from django.core.management.base import (
BaseCommand, CommandError, NoArgsCommand )
from django.db import transaction
@@ -228,7 +229,7 @@ def handle_noargs(self, users=None, review_requests=None, diffs=None,
random_number = random.randint(0, len(files) - 1)
file_to_open = diff_dir + files[random_number]
- f = open(file_to_open, 'r')
+ f = UploadedFile(open(file_to_open, 'r'))
form = UploadDiffForm(review_request.repository, f)
cur_diff = form.create(f, None, diffset_history)
review_request.diffset_history = diffset_history
Please sign in to comment.
Something went wrong with that request. Please try again.