What version are you running?
ReviewBoard-1.1alpha3.dev_20100113-py2.6.egg
What's the URL of the page containing the problem?
http://myserver/groups/?sort=-name
Fix:
reviewboard/reviews/templatetags/reviewtags.py
add profile test at line 503
if profile:
starred = profile.starred_groups.filter(pk=obj.id).count() > 0
else:
starred = 0
What steps will reproduce the problem?
1. Only one group defined
2. click on Groups
3. Get a trace
What is the expected output? What do you see instead?
The All groups list
UnboundLocalError at /groups/
local variable 'starred' referenced before assignment
Request Method: GET
Request URL: http://linux-4/groups/
Exception Type: UnboundLocalError
Exception Value:
local variable 'starred' referenced before assignment
Exception Location:
/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.1alpha3.dev_20100113-py2.6.egg/reviewboard/reviews/templatetags/reviewtags.py
in render_star, line 513
Python Executable: /usr/bin/python
Python Version: 2.6.4
Python Path: ['/var/www/reviews.microksystems.com/conf',
'/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg',
'/home/cking/SimpleSite',
'/usr/local/lib/python2.6/dist-packages/nose-0.11.1-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/Pygments-1.2.2-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/cmemcache-0.95-py2.6-linux-x86_64.egg',
'/usr/local/lib/python2.6/dist-packages/Django-1.1.1-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/recaptcha_client-1.0.5-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/pytz-2009u-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/paramiko-1.7.6-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.1alpha3.dev_20100113-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/Djblets-0.5.7alpha0.dev_20100113-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/django_evolution-0.0.0-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/RBTools-0.2beta2-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/SQLAlchemy-0.5.2-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/Pylons-0.9.7-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/Tempita-0.4-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/WebTest-1.2-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/WebError-0.10.1-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/WebOb-0.9.7.1-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/Mako-0.2.5-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/decorator-3.1.2-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/Beaker-1.5.1-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/WebHelpers-1.0b3-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/Routes-1.11-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/AuthKit-0.4.5-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/elementtree-1.2.7_20070827_preview-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/Trac-0.12dev_r9055-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/Genshi-0.6dev_r1092-py2.6.egg',
'/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2',
'/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old',
'/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages',
'/usr/lib/python2.6/dist-packages/PIL',
'/usr/lib/python2.6/dist-packages/gst-0.10',
'/usr/lib/pymodules/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.6/gtk-2.0',
'/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode',
'/usr/local/lib/python2.6/dist-packages']
Server time: Thu, 21 Jan 2010 18:27:32 -0800
Traceback Switch to copy-and-paste view
*
/usr/local/lib/python2.6/dist-packages/Django-1.1.1-py2.6.egg/django/core/handlers/base.py
in get_response
85. # Apply view middleware
86. for middleware_method in self._view_middleware:
87. response = middleware_method(request, callback, callback_args,
callback_kwargs)
88. if response:
89. return response
90.
91. try:
92. response = callback(request, *callback_args, **callback_kwargs) ...
93. except Exception, e:
94. # If the view raised an exception, run it through exception
95. # middleware, and if the exception middleware returns a
96. # response, use that. Otherwise, reraise the exception.
97. for middleware_method in self._exception_middleware:
98. response = middleware_method(request, e)
▶ Local vars
Variable Value
callback
<function group_list at 0x7fa08c2276e0>
callback_args
()
callback_kwargs
{}
e
UnboundLocalError("local variable 'starred' referenced before
assignment",)
exc_info
(<type 'exceptions.UnboundLocalError'>, UnboundLocalError("local
variable 'starred' referenced before assignment",), <traceback object at
0x7fa08c429ea8>)
exceptions
<module 'django.core.exceptions' from
'/usr/local/lib/python2.6/dist-packages/Django-1.1.1-py2.6.egg/django/core/exceptions.pyc'>
middleware_method
<bound method LoggingMiddleware.process_exception of
<djblets.log.middleware.LoggingMiddleware object at 0x7fa08bfc2b90>>
receivers
[(<function _rollback_on_exception at 0x7fa08b6cff50>, None)]
request
<ModPythonRequest path:/groups/, GET:<QueryDict: {}>,
POST:<QueryDict: {}>, COOKIES:{'collapsediffs': 'True', 'rbsessionid':
'dfdaa199cb9fe86446ebafa0ba18bc35'}, META:{'AUTH_TYPE': None,
'CONTENT_LENGTH': 0, 'CONTENT_TYPE': None, 'GATEWAY_INTERFACE': 'CGI/1.1',
'HTTP_ACCEPT':
'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE':
'en-us,en;q=0.5', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_COOKIE':
'rbsessionid=dfdaa199cb9fe86446ebafa0ba18bc35; collapsediffs=True',
'HTTP_HOST': 'linux-4', 'HTTP_KEEP_ALIVE': '300', 'HTTP_REFERER':
'http://linux-4/users/', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; U; Linux
x86_64; en-US; rv:1.9.1.7) Gecko/20100106 Ubuntu/9.10 (karmic)
Firefox/3.5.7', 'PATH_INFO': u'/groups/', 'PATH_TRANSLATED': None,
'QUERY_STRING': None, 'REMOTE_ADDR': '10.79.98.104', 'REMOTE_HOST': None,
'REMOTE_IDENT': None, 'REMOTE_USER': None, 'REQUEST_METHOD': 'GET',
'SCRIPT_NAME': '', 'SERVER_NAME': 'linux-4.microksystems.com',
'SERVER_PORT': 80, 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE':
'mod_python'}>
resolver
<RegexURLResolver djblets.util.rooturl (None:None) ^/>
response
None
self
<django.core.handlers.modpython.ModPythonHandler object at
0x7fa08b2bab50>
settings
<django.conf.LazySettings object at 0x7fa08b3af050>
urlconf
'djblets.util.rooturl'
urlresolvers
<module 'django.core.urlresolvers' from
'/usr/local/lib/python2.6/dist-packages/Django-1.1.1-py2.6.egg/django/core/urlresolvers.pyc'>
*
/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.1alpha3.dev_20100113-py2.6.egg/reviewboard/accounts/decorators.py
in _check
20. """
21. def _check(*args, **kwargs):
22. siteconfig = SiteConfiguration.objects.get_current()
23.
24. if siteconfig.get("auth_require_sitewide_login"):
25. return login_required(view_func)(*args, **kwargs)
26. else:
27. return view_func(*args, **kwargs) ...
28.
29. return _check
30.
31.
32. @simple_decorator
33. def valid_prefs_required(view_func):
▶ Local vars
Variable Value
args
(<ModPythonRequest path:/groups/, GET:<QueryDict: {}>,
POST:<QueryDict: {}>, COOKIES:{'collapsediffs': 'True', 'rbsessionid':
'dfdaa199cb9fe86446ebafa0ba18bc35'}, META:{'AUTH_TYPE': None,
'CONTENT_LENGTH': 0, 'CONTENT_TYPE': None, 'GATEWAY_INTERFACE': 'CGI/1.1',
'HTTP_ACCEPT':
'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE':
'en-us,en;q=0.5', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_COOKIE':
'rbsessionid=dfdaa199cb9fe86446ebafa0ba18bc35; collapsediffs=True',
'HTTP_HOST': 'linux-4', 'HTTP_KEEP_ALIVE': '300', 'HTTP_REFERER':
'http://linux-4/users/', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; U; Linux
x86_64; en-US; rv:1.9.1.7) Gecko/20100106 Ubuntu/9.10 (karmic)
Firefox/3.5.7', 'PATH_INFO': u'/groups/', 'PATH_TRANSLATED': None,
'QUERY_STRING': None, 'REMOTE_ADDR': '10.79.98.104', 'REMOTE_HOST': None,
'REMOTE_IDENT': None, 'REMOTE_USER': None, 'REQUEST_METHOD': 'GET',
'SCRIPT_NAME': '', 'SERVER_NAME': 'linux-4.microksystems.com',
'SERVER_PORT': 80, 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE':
'mod_python'}>,)
kwargs
{}
siteconfig
<SiteConfiguration: localhost (version 1.1 alpha 3 (dev))>
view_func
<function group_list at 0x7fa08c227500>
*
/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.1alpha3.dev_20100113-py2.6.egg/reviewboard/reviews/views.py
in group_list
271.
272.
273. @check_login_required
274. def group_list(request, template_name='reviews/datagrid.html'):
275. """
276. Displays a list of all review groups.
277. """
278. return GroupDataGrid(request).render_to_response(template_name) ...
279.
280.
281. @login_required
282. @valid_prefs_required
283. def dashboard(request, template_name='reviews/dashboard.html'):
284. """
▶ Local vars
Variable Value
request
<ModPythonRequest path:/groups/, GET:<QueryDict: {}>,
POST:<QueryDict: {}>, COOKIES:{'collapsediffs': 'True', 'rbsessionid':
'dfdaa199cb9fe86446ebafa0ba18bc35'}, META:{'AUTH_TYPE': None,
'CONTENT_LENGTH': 0, 'CONTENT_TYPE': None, 'GATEWAY_INTERFACE': 'CGI/1.1',
'HTTP_ACCEPT':
'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE':
'en-us,en;q=0.5', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_COOKIE':
'rbsessionid=dfdaa199cb9fe86446ebafa0ba18bc35; collapsediffs=True',
'HTTP_HOST': 'linux-4', 'HTTP_KEEP_ALIVE': '300', 'HTTP_REFERER':
'http://linux-4/users/', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; U; Linux
x86_64; en-US; rv:1.9.1.7) Gecko/20100106 Ubuntu/9.10 (karmic)
Firefox/3.5.7', 'PATH_INFO': u'/groups/', 'PATH_TRANSLATED': None,
'QUERY_STRING': None, 'REMOTE_ADDR': '10.79.98.104', 'REMOTE_HOST': None,
'REMOTE_IDENT': None, 'REMOTE_USER': None, 'REQUEST_METHOD': 'GET',
'SCRIPT_NAME': '', 'SERVER_NAME': 'linux-4.microksystems.com',
'SERVER_PORT': 80, 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE':
'mod_python'}>
template_name
'reviews/datagrid.html'
*
/usr/local/lib/python2.6/dist-packages/Djblets-0.5.7alpha0.dev_20100113-py2.6.egg/djblets/datagrid/grids.py
in render_to_response
673. must_revalidate=True)
674. return response
675.
676. def render_to_response(self, template_name, extra_context={}):
677. """
678. Renders a template containing this datagrid as a context variable.
679. """
680. self.load_state() ...
681.
682. # If the caller is requesting just this particular grid, return it.
683. if self.request.GET.get('gridonly', False) and \
684. self.request.GET.get('datagrid-id', None) == self.id:
685. return self.render_listview_to_response()
686.
▶ Local vars
Variable Value
extra_context
{}
self
<reviewboard.reviews.datagrids.GroupDataGrid object at 0x7fa08bfc3b10>
template_name
'reviews/datagrid.html'
*
/usr/local/lib/python2.6/dist-packages/Djblets-0.5.7alpha0.dev_20100113-py2.6.egg/djblets/datagrid/grids.py
in load_state
509.
510. if profile_dirty:
511. profile.save()
512.
513. self.state_loaded = True
514.
515. # Fetch the list of objects and have it ready.
516. self.precompute_objects() ...
517.
518.
519. def load_extra_state(self, profile):
520. """
521. Loads any extra state needed for this grid.
522.
▶ Local vars
Variable Value
colname
u'pending_count'
colnames
[u'star', u'name', u'displayname', u'pending_count']
colnames_str
u'star,name,displayname,pending_count'
column
<djblets.datagrid.grids.Column object at 0x7fa08c244c50>
expand_columns
[<djblets.datagrid.grids.Column object at 0x7fa08c244c50>]
expanded_column_width
80
normal_column_width
20
normal_columns
[<djblets.datagrid.grids.Column object at 0x7fa08c244710>]
profile
<Profile: cking>
profile_columns_list
u'star,name,displayname,pending_count'
profile_dirty
False
profile_sort_list
u'-name'
self
<reviewboard.reviews.datagrids.GroupDataGrid object at 0x7fa08bfc3b10>
sort_str
u'-name'
total_pct
80
*
/usr/local/lib/python2.6/dist-packages/Djblets-0.5.7alpha0.dev_20100113-py2.6.egg/djblets/datagrid/grids.py
in precompute_objects
610. # Grab the whole list at once. We know it won't be too large,
611. # and it will prevent one query per row.
612. object_list = list(self.page.object_list)
613.
614. for obj in object_list:
615. self.rows.append({
616. 'object': obj,
617. 'cells': [column.render_cell(obj) for column in self.columns] ...
618. })
619.
620. def post_process_queryset(self, queryset):
621. """
622. Processes a QuerySet after the initial query has been built and
623. pagination applied. This is only used when optimizing a sort.
▶ Local vars
Variable Value
_[2]
[]
base_sort_item
u'name'
column
<reviewboard.reviews.datagrids.StarColumn object at 0x7fa08c244410>
db_field
'name'
id
1L
index
{1L: 0}
obj
<Group: SimpleSite>
object_list
[<Group: SimpleSite>]
page_num
1
pos
0
prefix
'-'
query
[<Group: SimpleSite>]
self
<reviewboard.reviews.datagrids.GroupDataGrid object at 0x7fa08bfc3b10>
sort_item
u'-name'
sort_list
['-name']
use_select_related
False
*
/usr/local/lib/python2.6/dist-packages/Djblets-0.5.7alpha0.dev_20100113-py2.6.egg/djblets/datagrid/grids.py
in render_cell
196.
197. return s
198.
199. def render_cell(self, obj):
200. """
201. Renders the table cell containing column data.
202. """
203. rendered_data = self.render_data(obj) ...
204. css_class = ""
205. url = ""
206.
207. if self.css_class:
208. if callable(self.css_class):
209. css_class = self.css_class(obj)
▶ Local vars
Variable Value
obj
<Group: SimpleSite>
self
<reviewboard.reviews.datagrids.StarColumn object at 0x7fa08c244410>
*
/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.1alpha3.dev_20100113-py2.6.egg/reviewboard/reviews/datagrids.py
in render_data
26. self.image_alt = _("Starred")
27. self.detailed_label = _("Starred")
28. self.shrink = True
29. self.all_starred = {}
30.
31. def render_data(self, obj):
32. obj.starred = self.all_starred.get(obj.id, False)
33. return render_star(self.datagrid.request.user, obj) ...
34.
35.
36. class ReviewRequestStarColumn(StarColumn):
37. """
38. A specialization of StarColumn that augments the SQL query to
include
39. the starred calculation for review requests.
▶ Local vars
Variable Value
obj
<Group: SimpleSite>
self
<reviewboard.reviews.datagrids.StarColumn object at 0x7fa08c244410>
*
/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.1alpha3.dev_20100113-py2.6.egg/reviewboard/reviews/templatetags/reviewtags.py
in render_star
506. #else:
507. # starred = 0
508. else:
509. raise template.TemplateSyntaxError, \
510. "star tag received an incompatible object type (%s)" % \
511. type(obj)
512.
513. if starred: ...
514. image_alt = _("Starred")
515. else:
516. image_alt = _("Click to star")
517.
518. return render_to_string('reviews/star.html', {
519. 'object': obj_info,
▶ Local vars
What operating system are you using? What browser?
Ubuntu 9.10 Firefox 3.5.7
Please provide any additional information below.