Opened 7 years ago

Closed 4 years ago

#6636 closed defect (fixed)

[patch] Failure on use: "day of month out of range" (in Python 2.4)

Reported by: Michel Jouvin <jouvin@…> Owned by: Steffen Hoffmann
Priority: normal Component: WikiCalendarMacro
Severity: normal Keywords: date/time timezone locale
Cc: Trac Release: 0.12


I just installed WikiCalendarMacro r7528 on a fairly recent Trac trunk (r9115). I cannot succeed to get it to work. Whatever argument I use, I get the error message "day of month out of range" with the following traceback in the log file:

2010-02-15 21:16:38,102 Trac[formatter] ERROR: Macro WikiCalendar(*,*) failed:
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/trac/wiki/", line 608, in _macro_formatter
  File "build/bdist.linux-x86_64/egg/trac/wiki/", line 273, in process

  File "build/bdist.linux-x86_64/egg/trac/wiki/", line 260, in _macro_processor
    if not margin and fstack:
  File "/wwwdata/products/trac/site-config/plugins/0.11/", line 163, in expand_macro
    buff.write('<table><tr><td class="x"><a class="prev" href="%(url)s" title="%(title)s">&lt;&lt;</a></td>' % {
ValueError: day of month out of range



Attachments (0)

Change History (12)

comment:1 Changed 7 years ago by Ryan J Ollos

I noticed this last week as well when I tried to install it on my production Trac instance. However, it seems to work fine in the Trac development environment.

I'll be working on fixing this within the hour. Can you send me the details of you system from the System Information section of the About page?

comment:2 Changed 7 years ago by Michel Jouvin <jouvin@…>

Her it is:

Trac	0.12dev-r9115
Python	2.4.3 (#1, Sep 10 2009, 18:34:35) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]
setuptools	0.6c11
SQLite	3.5.9
pysqlite	2.3.3
Genshi	0.6dev-r1092
Babel	0.9.4
mod_wsgi	3.1 (WSGIProcessGroup trac WSGIApplicationGroup %{GLOBAL})
Pygments	1.0
RPC	1.0.6
FullBlog	0.1.1-r7214
GIT	1.6.6
Subversion	1.6.5 (r38866)
jQuery:	1.3.2


comment:3 Changed 7 years ago by Ryan J Ollos

I'm also running Python 2.4 on my production Trac, but my development environment is Python 2.6.

The original author left a note "breaks Python 2.4": wikicalendarmacro/0.11/

I'll look into making this Python 2.4 compatible.

comment:4 Changed 7 years ago by Ryan J Ollos

Status: newassigned

I'm working on making it compatible with Python 2.4, but I need to setup a development Trac instance in a 2.4 virtualenv, so it will probably be a few days before I have a new revision of the macro ready.

Thank you for the detailed report, it helped with quickly tracking down the issue.

comment:5 Changed 7 years ago by Michel Jouvin <jouvin@…>

Any progress on this?



comment:6 Changed 7 years ago by pipern

Keywords: patch added

Is this as simple as


    127127        # 9-tuple for use with time.* functions requiring a struct_time
    128128        # argument. The ninth value of -1 signals "do the right thing"
    129129        # w.r.t. daylight savings time.
    130         date = [0] * 8 + [-1] # AS: breaks Python 2.4
     130        date = [1] * 8 + [-1]
    131131        # date = list( today ) # AS: breaks SQL query
    133133        # building the output

? This "appears to work" for the little manual testing I've done.

comment:7 Changed 7 years ago by Ryan J Ollos

I'm on Python 2.6 now, so the macro is working for me. I'm happy to make the change if it will make it work with Python 2.4.

Michel, would you be willing to test the patch?

comment:8 Changed 7 years ago by Ryan J Ollos

Summary: Failure to use the macro : day of month out of rangeFailure to use the macro: day of month out of range (in Python 2.4)

comment:9 Changed 6 years ago by Steffen Hoffmann

Keywords: date/time timezone locale added; patch removed
Summary: Failure to use the macro: day of month out of range (in Python 2.4)[patch] Failure on use: "day of month out of range" (in Python 2.4)

An alternative approach would be to avoid Python time at all and go with datetime.

And since Trac internally uses datetime objects for representing any date/time stamp this looks like the preferable way to me, hence I've done so for the 'sister' plugin, WikiTicketCalendarMacro, in changeset [8356] (consider [8434] for proper behavior with time zones other than GMT as well).

Considering #7564 I'd appreciate, if you could test your issue with the current version of WikiTicketCalendarMacro as well and report back here. Thanks for your patience and for taking care to help us with improvement.

comment:10 Changed 6 years ago by Ryan J Ollos

Owner: changed from Ryan J Ollos to Steffen Hoffmann
Status: assignednew

comment:11 Changed 6 years ago by Steffen Hoffmann

Status: newassigned

Ping. Michael, would you please test the patch?

Or even better test WikiTicketCalendarMacro in current trunk here with Python time replaced as mentioned before. The WikiCalendarMacro will be integrated there too very soon, so this would help me a lot to get this issue resolved for you and me.

comment:12 Changed 4 years ago by Steffen Hoffmann

Resolution: fixed
Status: assignedclosed

(In [12842]) WikiCalendarMacro: Releasing current, tested macro package as final product, closes #64, #578, #6636, #7564, #7653, #8818, #9568, #9718 and #9719.

After a long time one of the oldest Trac hacks (see changeset [53]) is united with its ambitious fork WikiTicketCalendarMacro for convenience. While maintaining separate wiki pages for both macros, upstream development continues together in the source:wikicalendarmacro/trunk branch.

Modify Ticket

as closed The owner will remain Steffen Hoffmann.
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.