316: Exception on "All review requests" using postgresql

peter.******@gmai***** (Google Code) (Is this you? Claim this profile.)
chipx86
chipx86
Dec. 19, 2007
What's the URL of the page containing the problem?

     http://localhost:8000/r/

What steps will reproduce the problem?

1. Fresh install of reviewboard configured using
   DATABASE_ENGINE="postgresql_psycopg2"
2. Login, click "All review requests"
3. If error does not occur immediately then click to show/hide submitted
reviews

Receive the error below. It appears that the psycopg2 driver is not
forgiving with integer valued booleans. Patch is attached, have not tested
with other DB engines.

Traceback:
File "/Users/ptaylor/projects/django.trunk/django/core/handlers/base.py" in
get_response
  82.                 response = callback(request, *callback_args,
**callback_kwargs)
File
"/Users/ptaylor/projects/reviewboard.trunk/reviewboard/accounts/decorators.py"
in _check
  24.             return view_func(*args, **kwargs)
File
"/Users/ptaylor/projects/reviewboard.trunk/reviewboard/reviews/views.py" in
all_review_requests
  172.         template_name=template_name)
File
"/Users/ptaylor/projects/reviewboard.trunk/reviewboard/reviews/views.py" in
review_list
  160.         profile.save()
File "/Users/ptaylor/projects/django.trunk/django/db/models/base.py" in save
  238.                         db_values +
self._meta.pk.get_db_prep_lookup('exact', pk_val))
File "/Users/ptaylor/projects/django.trunk/django/db/backends/util.py" in
execute
  18.             return self.cursor.execute(sql, params)

Exception Type: ProgrammingError at /r/
Exception Value: column "show_submitted" is of type boolean but expression
is of type integer
LINE 1: ...ordwrapped_diffs"=true,"syntax_highlighting"=true,"show_subm...
                                                             ^
HINT:  You will need to rewrite or cast the expression.
Index: reviewboard/reviews/views.py
===================================================================
--- reviewboard/reviews/views.py	(revision 1058)
+++ reviewboard/reviews/views.py	(working copy)
@@ -137,7 +137,7 @@
                                    Q(status='S')).order_by('-last_updated')
 
     sort = request.GET.get('sort', sort_columns)
-    show_submitted = int(request.GET.get('show_submitted', show_submitted))
+    show_submitted = bool(int(request.GET.get('show_submitted', show_submitted)))
 
     extra_context['show_submitted'] = show_submitted
 
chipx86
#1 chipx86
  • +Fixed
  • -Priority-Medium
    +Priority-High
    +Component-Reviews
  • +chipx86