Opened 17 years ago
Closed 17 years ago
#5939 closed defect (invalid)
float conversion bug in util/datefmt.py
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | version control | Version: | 0.10.4 |
Severity: | major | Keywords: | |
Cc: | lele@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
When I try to "Browse Source" I get the following error:
Python Traceback
Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 406, in dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.5/site-packages/trac/web/main.py", line 237, in dispatch resp = chosen_handler.process_request(req) File "/usr/lib/python2.5/site-packages/trac/versioncontrol/web_ui/browser.py", line 143, in process_request self._render_directory(req, repos, node, rev) File "/usr/lib/python2.5/site-packages/trac/versioncontrol/web_ui/browser.py", line 168, in _render_directory changes = get_changes(self.env, repos, [i['rev'] for i in info]) File "/usr/lib/python2.5/site-packages/trac/versioncontrol/web_ui/util.py", line 67, in get_changes 'date': format_datetime(changeset.date), File "/usr/lib/python2.5/site-packages/trac/util/datefmt.py", line 58, in format_datetime t = time.localtime(float(t)) TypeError: float() argument must be a string or a number
I'm using trac-0.10.4 on Gentoo with python-2.5.1. I use the latest (directly from darcs) Darcs plugin for my repository.
This is the code on my system where the error occurs: File "/usr/lib/python2.5/site-packages/trac/util/datefmt.py", line 58
def format_datetime(t=None, format='%x %X', gmt=False): if t is None: t = time.time() if not isinstance(t, (list, tuple, time.struct_time)): if gmt: t = time.gmtime(float(t)) else: t = time.localtime(float(t)) # <<<<<<< Line 58 !!! text = time.strftime(format, t) encoding = locale.getpreferredencoding() or sys.getdefaultencoding() if sys.platform != 'win32': encoding = locale.getlocale(locale.LC_TIME)[1] or encoding # the above is broken on win32, e.g. we'd get '437' instead of 'cp437' return unicode(text, encoding, 'replace')
I think the following code from the Darcs Plugin is also relevant because here the time 't' is constructed:
http://darcs.arstecnica.it/trac-darcs/tracdarcs/repository.py
regards,
Bas van Dijk
Attachments (0)
Change History (2)
comment:1 by , 17 years ago
Version: | → 0.10.4 |
---|
comment:2 by , 17 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Looks like you're using a 0.11 plugin with Trac 0.10.4. That's not supported and you'll probably quickly get into other problem than this use of a
datetime
object for representing a date (see the API changes for 0.11).Look for a 0.10 compatible version of the Darcs plugin.