Modify

Opened 15 years ago

Closed 14 years ago

#6948 closed defect (worksforme)

Internal error

Reported by: agrabarski@… Owned by: Radek Bartoň
Priority: highest Component: DiscussionPlugin
Severity: blocker Keywords:
Cc: Trac Release: 0.11

Description

I've installed your plugin on Trac 0.11 without problems. I've created test forum, topic and post first message on it. And now, after click on Discussion link in upper menu I see:

Trac detected an internal error: TypeError: expecting datetime, int, long, float, or None; got <type 'unicode'>

Python Traceback

Most recent call last: File "/root/.python-eggs/TracDiscussion-0.7-py2.4.egg-tmp/tracdiscussion/templates/forum-list.html", line 70, in <Expression u"forum.lasttopic and format_datetime(forum.lasttopic) or 'no topics'">

${forum.lasttopic and format_datetime(forum.lasttopic) or 'no topics'}<br/>

File "/usr/lib/python2.4/site-packages/Trac-0.11.6-py2.4.egg/trac/util/datefmt.py", line 108, in format_datetime

t = to_datetime(t, tzinfo).astimezone(tz)

File "/usr/lib/python2.4/site-packages/Trac-0.11.6-py2.4.egg/trac/util/datefmt.py", line 52, in to_datetime

raise TypeError('expecting datetime, int, long, float, or None; got %s' %

Any ideas?

Attachments (2)

Python Traceback.png (96.8 KB) - added by MN 15 years ago.
The python traceback I get with this error
System Info.png (52.5 KB) - added by MN 15 years ago.
Information on the system I get this bug on

Download all attachments as: .zip

Change History (16)

comment:1 Changed 15 years ago by Radek Bartoň

Status: newassigned

I'll check that lately.

comment:2 Changed 15 years ago by Radek Bartoň

I don't know how to evoke this. Can you evoke it aggain or this just happened accidentaly? Can you describe precise procedure of evokation (Values of fields you are filling in, etc)? Can you post Trac log with DEBUG level enabled? What is you server configuration?

Changed 15 years ago by MN

Attachment: Python Traceback.png added

The python traceback I get with this error

comment:3 Changed 15 years ago by MN

I can confirm this same bug. I created 4 forums, filling out [subject] and [description] with ONLY letters and spaces (no punctuation, no wiki-links) adding 1 moderator, and adding 1 subscriber (my email). Then I posted in one of these forums. At first, everything works fine, but then after a period of time the bug occurs. It looks like it may have to do with fetching the date/time of the last post, perhaps?

Changed 15 years ago by MN

Attachment: System Info.png added

Information on the system I get this bug on

comment:4 Changed 15 years ago by MN

I can't post either wiki text or pictures of my pythong traceback and system info; blocked as spam.

comment:5 Changed 15 years ago by MN

Okay: the bug offiially occurs for me when I have 1 or more posts in any forum. I can create forums just fine; it's creating threads that produces the error.

System Information:

  • User Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
  • Trac: 0.11.5
  • Python: 2.3.3 (#1, May 7 2004, 10:31:40) [GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)]
  • setuptools: 0.6c5
  • SQLite: 2.8.16
  • pysqlite: 1.0.1
  • Genshi: 0.5.1
  • mod_python: < 3.2
  • Subversion: 1.2.1 (r15230)
  • jQuery: 1.2.6

comment:6 Changed 15 years ago by MN

I've been looking at the source code. It appears that the "forum.lasttopic" variable you pass into format_datetime on line 70 or so of forum-list.html is supposed to be a datetime, int, long, or float.

If I am understanding thing correctly, format_datetime and to_datetime are library functions. Can you convert forum.lastopic from unicode to a datetime object before you pass it to format_datetime? That way even if the script changes you will have already converted it and it won't throw an error.

I could be wrong though.

comment:7 Changed 15 years ago by MN

This site might be of use in this situation.

comment:8 Changed 15 years ago by Radek Bartoň

Great thanks for investigating this. I'll fix it as soon as I'll have spare minute...

comment:9 Changed 14 years ago by MN

Quick question - do you think this could be related to the Python version I'm running? On my personal computer with Python 2.6 I don't get this bug, but on my employer's server running python 2.3, I do.

-- Thanks

comment:10 Changed 14 years ago by Radek Bartoň

It's possible and it would explain why I couldn't evoke it since I wasn't using Python 2.3 for years. I may also be related to Gensi version. Could you please check what is your and your employers Genshi versions?

comment:11 Changed 14 years ago by anonymous

Genshi version is 0.5.1

System Information:

  • User Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
  • Trac: 0.11.5
  • Python: 2.3.3 (#1, May 7 2004, 10:31:40) [GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)]
  • setuptools: 0.6c5
  • SQLite: 2.8.16
  • pysqlite: 1.0.1
  • Genshi: 0.5.1
  • mod_python: < 3.2
  • Subversion: 1.2.1 (r15230)
  • jQuery: 1.2.6

comment:12 Changed 14 years ago by Radek Bartoň

And on your personal computer where it works fine?

comment:13 Changed 14 years ago by MN

On my personal computer I have Genshi .6

System Information:

  • Trac: 0.11.7
  • Python: 2.6.5 (r265:79063, May 25 2010, 02:35:04) [GCC 4.2.1 (Apple Inc. build 5646)]
  • setuptools: 0.6
  • SQLite: 3.6.23
  • pysqlite: 2.4.1
  • Genshi: 0.6
  • Pygments: 1.3.1
  • jQuery: 1.2.6

comment:14 Changed 14 years ago by Radek Bartoň

Resolution: worksforme
Status: assignedclosed

I see nothing wrong in the code and it works fine for me. I'm closing the ticket. If the problem persists on the lastest Trac, please reopen.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Radek Bartoň.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.