Version 1 (modified by 14 years ago) ( diff ) | ,
---|
Custom Ticket Time Fields
This page presents information on adding a new type 'time' the list of all currently available custom ticket fields.
Proposed Implementation
Trac core
- add 'time' to available types, inheriting most of the definition from 'text', a simple (one line) text field
At that point TracQuery already works as intended by providing from..to input fields on selection of custom time fields for query. Praise to the flexible, modularized software design of Trac developers!
- extend ticket.model, ticket.web_ui, util.datefmt and ticket/templates/ticket.html to
- allow for reading unix time stamp values from db table ticket_custom
- convert unix time stamp values to localized time string
- parse user input and consolidate different flavors of time stamps
- write back unix time stamp to db
- send out properly formatted notification
Related Trac Plugins
- provide a patch for CustomFieldAdminPlugin to ease the setup for new field type
Discussion
Additional code dependecies
Amongst the few new dependencies use of eGenix.com time string parser mxDateTime.Parser for Python is the most notable one [2]. We need to add such a powerful tool to provide a mature parser right from the start. If handled with care, similar but incompatible classes datetime.datetime and mxDateTime.DateTime are not much of an issue. In fact it doesn't matter at all, as long as we stick to unix time stamp format for saving times in the db for other (good) reasons as well.
Status of Development
There is working code for all but the notification stuff (only plain unix time stamp values in change notes). Sure, this will be fixed soon too.
So I'm looking forward on getting feedback about the way to contribute it to trac development. Current development is based on Trac-0.12dev_r9115 working with Python2.5 on Debian GNU/Linux stable. It would be great to have it in trunk soon (trac-0.12dev?).
Related tickets
#1942 - the main resource on requests and considerations related to the topic FIXME already seen much more related, put it in here
External related resources
Ideas and OS code was shamelessly taken from the following places:
[1] Date and Time Representation in Python by Jochen Voss
[2] eGenix.com, especially see mxDateTime related documentation
Attachments (3)
-
TracQuery_on_CustomTimeField.png
(43.9 KB
) - added by 14 years ago.
Trac 0.12dev screenshot with ticket list from query based on custom time field
-
TracQuery_on_CustomTimeField.2.png
(48.3 KB
) - added by 14 years ago.
Trac 0.12dev screenshot with ticket list from query based on custom time field - updated version
-
TracQuery_on_CustomTimeField_odd-old-date.png
(29.0 KB
) - added by 14 years ago.
Trac 0.12dev screenshot with ticket list from query based on custom time field - parseable string shown but ignored for query
Download all attachments as: .zip