2830: running the site index tools results in warnings (not helpful for crontab)

daniel.*******@gmai***** (Google Code) (Is this you? Claim this profile.)
Jan. 14, 2013
What version are you running?
1.7.0.1

What steps will reproduce the problem?
1. /usr/local/bin/rb-site manage /var/www/SITENAME index


What is the expected output? What do you see instead?
I would expect silence - instead I get:
/usr/local/lib/python2.6/dist-packages/Djblets-0.7.7-py2.6.egg/djblets/gravatars/__init__.py:26: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  from md5 import md5
Traceback (most recent call last):
  File "/usr/local/bin/rb-site", line 9, in <module>
    load_entry_point('ReviewBoard==1.7', 'console_scripts', 'rb-site')()
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.7-py2.6.egg/reviewboard/cmdline/rbsite.py", line 1888, in main
    command.run()
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.7-py2.6.egg/reviewboard/cmdline/rbsite.py", line 1820, in run
    site.run_manage_command(args[0], args[1:])
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.7-py2.6.egg/reviewboard/cmdline/rbsite.py", line 532, in run_manage_command
    execute_manager(reviewboard.settings, [__file__, cmd] + params)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/core/management/__init__.py", line 459, in execute_manager
    utility.execute()
  File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/usr/local/lib/python2.6/dist-packages/ReviewBoard-1.7-py2.6.egg/reviewboard/reviews/management/commands/index.py", line 93, in handle_noargs
    objects = objects.filter(query)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/db/models/query.py", line 624, in filter
    return self._filter_or_exclude(False, *args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/db/models/query.py", line 642, in _filter_or_exclude
    clone.query.add_q(Q(*args, **kwargs))
  File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/db/models/sql/query.py", line 1247, in add_q
    self.add_q(child, used_aliases, force_having=force_having)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/db/models/sql/query.py", line 1250, in add_q
    can_reuse=used_aliases, force_having=force_having)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/db/models/sql/query.py", line 1185, in add_filter
    connector)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/db/models/sql/where.py", line 69, in add
    value = obj.prepare(lookup_type, value)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/db/models/sql/where.py", line 320, in prepare
    return self.field.get_prep_lookup(lookup_type, value)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/db/models/fields/__init__.py", line 709, in get_prep_lookup
    return super(DateField, self).get_prep_lookup(lookup_type, value)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/db/models/fields/__init__.py", line 310, in get_prep_lookup
    return self.get_prep_value(value)
  File "/usr/local/lib/python2.6/dist-packages/Django-1.4.3-py2.6.egg/django/db/models/fields/__init__.py", line 808, in get_prep_value
    RuntimeWarning)
RuntimeWarning: DateTimeField received a naive datetime (2012-12-18 08:33:08) while time zone support is active.

What operating system are you using? What browser?
Running Linux (Ubuntu 10.04), Python 2.6.x and Chrome
david
#1 david
  • +Component-Search
#2 bor****@gmai***** (Google Code) (Is this you? Claim this profile.)
patch in the attachment. hope this helps.
  • +
    diff --git a/reviewboard/reviews/management/commands/index.py b/reviewboard/reviews/management/commands/index.py
    index b6967d9..8185316 100644
    --- a/reviewboard/reviews/management/commands/index.py
    +++ b/reviewboard/reviews/management/commands/index.py
    @@ -3,9 +3,11 @@ import os
     import optparse
     import sys
     import time
    +import settings
     
     from django.core.management.base import NoArgsCommand
     from django.db.models import Q
    +from django.utils import timezone
     
     from djblets.siteconfig.models import SiteConfiguration
     
    @@ -60,7 +62,10 @@ class Command(NoArgsCommand):
             if incremental:
                 try:
                     f = open(timestamp_file, 'r')
    -                timestamp = datetime.utcfromtimestamp(int(f.read()))
    +                if timezone and settings.USE_TZ:
    +                    timestamp = timezone.make_aware(datetime.utcfromtimestamp(int(f.read())), timezone.get_default_timezone())
    +                else:
    +                    timestamp = datetime.utcfromtimestamp(int(f.r
#3 matthew********@kitwa****** (Google Code) (Is this you? Claim this profile.)
To quote the issue template:
"If you have a patch, please submit it to http://reviews.reviewboard.org/"

...you might have better luck getting it applied that way.
david
#4 david
  • +PendingReview
david
#5 david
Fixed in release-1.7.x (900df43). Thanks!
  • -PendingReview
    +Fixed