Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#1230 closed defect (fixed)

Changing 'Add hours to ticket' results in an error 'module object not callable'

Reported by: carsten.reimer@… Owned by: Russ Tyndall
Priority: normal Component: TimingAndEstimationPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11



trying to use this very useful plugin I came across a little error wanting to add hours to a ticket. After submitting the form trac raised an error 'module object not callable'.

Obviously this is due to a little typo in the file in line 9 (the last line in the following snippet).

import trac.util.datefmt

def identity(x):
    return x;

to_timestamp = trac.util.datefmt or identity;

As you can see from the source code provided above there is an import of trac.util.datefmt which a few lines later is assigned to to_timestamp. But trac.util.datefmt is a module not a function so what is needed in line 9 is the following:

to_timestamp = trac.util.datefmt.to_timestamp or identity;

So the hole snippet will be:

import trac.util.datefmt

def identity(x):
    return x;

to_timestamp = trac.util.datefmt.to_timestamp or identity;

Attachments (0)

Change History (1)

comment:1 Changed 10 years ago by Russ Tyndall

Resolution: fixed
Status: newclosed

That is almost right and fixes it for trac .11 However, I needed a try except to make it work everywhere.

See changeset:2015

Thanks for the great bug report!

Modify Ticket

as closed The owner will remain Russ Tyndall.
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.