Opened 13 years ago

Closed 12 years ago

#9612 closed defect (fixed)

document time/date format the plugin expects / provide better handling of such fileds

Reported by: anonymous Owned by: Russ Tyndall
Priority: normal Component: TimingAndEstimationPlugin
Severity: normal Keywords: time-date format
Cc: Trac Release: 0.12


there's no clues on which format to use for the time/date fields, and the system seems quite picky on that, throwing an error on any format which might be very usual yet not exactly the wanted one: I've tried what seems the format needed: 2011-12-07 00:00:00 but that yields an error too. So basically I'm using the plugin as if it were with no such date/time fields in the report/management - kinda pity. thx

Attachments (0)

Change History (8)

comment:1 Changed 13 years ago by Russ Tyndall

(In [11040]) added a couple more timeformats (to allow plain dates) re #9612

comment:2 Changed 13 years ago by Russ Tyndall

I tried to make this much more robust somewhat recently; I must have also introduced an error. I am looking into this and will post a patch to fix it soon.

Currently I am trying to parse these timeformats:

    '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %I:%M:%S.%f %p',
    '%Y-%m-%d %H:%M:%S', '%Y-%m-%d %I:%M:%S %p',
    '%Y-%m-%d %H:%M', '%Y-%m-%d %I:%M %p',
    '%Y-%m-%d %H', '%Y-%m-%d %I %p',
    '%Y/%m/%d %H:%M:%S.%f', '%Y/%m/%d %I:%M:%S.%f %p',
    '%Y/%m/%d %H:%M:%S', '%Y/%m/%d %I:%M:%S %p',
    '%Y/%m/%d %H:%M', '%Y/%m/%d %I:%M %p',
    '%Y/%m/%d %H', '%Y/%m/%d %H %p',
    '%Y.%m.%d %H:%M:%S.%f', '%Y.%m.%d %I:%M:%S.%f %p',
    '%Y.%m.%d %H:%M:%S', '%Y.%m.%d %I:%M:%S %p',
    '%Y.%m.%d %H:%M', '%Y.%m.%d %I:%M %p',
    '%Y.%m.%d %H', '%Y.%m.%d %I %p',

I am currently able to parse the pasted timestamp. Go ahead an install the new version as it will make things easier to verify (what version are you currently running of TandE?).

To verify that the parsing should work on your computer you could try the following in ipython:

In [1]: import timingandestimationplugin.webui as webui
In [2]: webui.parsetime('2011-12-07 00:00:00')
Out[2]: datetime.datetime(2011, 12, 7, 0, 0, tzinfo=<LocalTimezone "EST" -1 day, 19:00:00 "EDT" -1 day, 20:00:00>)

If that does not fix it for you, I will, at the very least, need a TracLogging log of the error occuring

Thanks for the bug report.

comment:3 Changed 13 years ago by anonymous

thx. Don't have ipython; upgraded to T&E 1.2.2; in manag page tried '2011-12-07' in 'swet billing date' at bottom, got the usual error - here's the relevant log excerpt, pls tell if it's enough else I'll post more:

2011-12-16 21:44:06,266 Trac[api] DEBUG: T&E BEGIN Reports need an upgrade check
2011-12-16 21:44:06,266 Trac[reportmanager] DEBUG: T&E Checking for custom_report upgrade
2011-12-16 21:44:06,274 Trac[reportmanager] DEBUG: T&E END Checking for custom_report upgrade
2011-12-16 21:44:06,276 Trac[api] DEBUG: T&E END Reports need an upgrade check
2011-12-16 21:44:06,282 Trac[api] DEBUG: T&E NEEDS UP?: sys:False, rep:False, stats:False, fields:False, man:False
2011-12-16 21:44:06,283 Trac[db] DEBUG: SELECT value FROM system WHERE name='fullblog_version'
2011-12-16 21:44:06,284 Trac[model] ERROR: DatabaseError: no such table: wiki_namespace
2011-12-16 21:44:06,286 Trac[env] WARNING: base_url option not set in configuration, generated links may be incorrect
2011-12-16 21:44:06,286 Trac[main] DEBUG: Dispatching <Request "POST '/billing'">
2011-12-16 21:44:06,436 Trac[svn_fs] DEBUG: Subversion bindings imported
2011-12-16 21:44:06,443 Trac[api] INFO: Synchronized '' repository in 0.14 seconds
2011-12-16 21:44:06,446 Trac[chrome] DEBUG: Prepare chrome data for request
2011-12-16 21:44:06,452 Trac[session] DEBUG: Retrieving session for ID 'user'
2011-12-16 21:44:06,457 Trac[api] DEBUG: action controllers for ticket workflow: ['ConfigurableTicketWorkflow']
2011-12-16 21:44:06,494 Trac[main] ERROR: Internal Server Error: 
Traceback (most recent call last):
  File "build/bdist.linux-i686/egg/trac/web/", line 511, in _dispatch_request
  File "build/bdist.linux-i686/egg/trac/web/", line 237, in dispatch
  File "build/bdist.linux-i686/egg/timingandestimationplugin/", line 119, in process_request
  File "build/bdist.linux-i686/egg/timingandestimationplugin/", line 63, in set_bill_date
  File "build/bdist.linux-i686/egg/timingandestimationplugin/", line 49, in parsetime
AttributeError: type object 'datetime.datetime' has no attribute 'strptime'
2011-12-16 21:44:07,656 Trac[tande_filters] DEBUG: self.billing_reports= set([10, 11, 12, 13, 14, 15, 16, 17, 18])
2011-12-16 21:44:07,658 Trac[ticket_webui] DEBUG: TicketWebUiAddon executing

comment:4 Changed 13 years ago by Russ Tyndall

This doesnt seem correct: type object 'datetime.datetime' has no attribute 'strptime'.

Instead of ipython, you can substitute python -i to allow you to interact with your python system dynamically:

>>> import datetime
>>> datetime.datetime.strptime('2007-12-01', '%Y-%m-%d')
datetime.datetime(2007, 12, 1, 0, 0)

datetime.datetime.strptime was added in python 2.5 which was released in Sept 2006.

Could you please post the relevant version numbers of trac, python etc? (about trac when logged in as admin will show these).

Thanks, Russ

comment:5 Changed 12 years ago by Russ Tyndall

It sounds like this is probably related to #9793 and that the problem is probably due to using less than python 2.5

Python 2.5 was released almost 6 years ago. Unless there is a pressing need I probably will not get to this (as I dont even have python 2.4 available right now).

comment:6 Changed 12 years ago by Russ Tyndall

(In [11383]) T&E Bug fixes

  • remove python version requirements
  • fix date parsing (again)
  • fix db_table_exists (again)

re #9612 and #9793 and #9844 and #9901

comment:7 Changed 12 years ago by Russ Tyndall

(In [11384]) T&E Bug fixes (version 1.2.7)

  • Enforce customizable permission on the billing/management page
  • remove python version requirements
  • fix date parsing (again)
  • fix db_table_exists (again)

re #9612 and #9793 and #9844 and #9901

comment:8 Changed 12 years ago by Russ Tyndall

Resolution: fixed
Status: newclosed

It seemed like there was a value in attempting to get this to run in python 2.4. I have made an attempt at changing the code so that it should work in 2.4 on.

I cant easily run 2.4 , but I have replaced the offending function, so it should hopefully work. Please report any bugs you might find.

Modify Ticket

Change Properties
Set your email in Preferences
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.