Modify

Opened 17 years ago

Closed 15 years ago

#1376 closed defect (fixed)

No Validation on Time

Reported by: anonymous Owned by: Russ Tyndall
Priority: normal Component: TimingAndEstimationPlugin
Severity: normal Keywords:
Cc: Filipe Correia Trac Release: 0.10

Description

When I put e.g. "3h" in "add hours to ticket", it shows following screen:

Traceback (most recent call last):

File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 387, in dispatch_request

dispatcher.dispatch(req)

File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 237, in dispatch

resp = chosen_handler.process_request(req)

File "/usr/lib/python2.4/site-packages/trac/ticket/web_ui.py", line 279, in process_request

self._do_save(req, db, ticket)

File "/usr/lib/python2.4/site-packages/trac/ticket/web_ui.py", line 546, in _do_save

cnum=internal_cnum):

File "/usr/lib/python2.4/site-packages/trac/ticket/model.py", line 262, in save_changes

listener.ticket_changed(self, comment, author, old_values)

File "build/bdist.linux-i686/egg/timingandestimationplugin/ticket_daemon.py", line 100, in ticket_changed File "build/bdist.linux-i686/egg/timingandestimationplugin/ticket_daemon.py", line 62, in watch_hours File "build/bdist.linux-i686/egg/timingandestimationplugin/ticket_daemon.py", line 53, in readTicketValue

ValueError: invalid literal for float(): 3h

Validation should be added.

Attachments (1)

trac-timingandestimationplugin-validate-input.patch (1.7 KB) - added by anonymous 15 years ago.
Add backend validation for hours fields

Download all attachments as: .zip

Change History (10)

comment:1 Changed 17 years ago by Russ Tyndall

Priority: highnormal
Severity: majornormal
Summary: When entering time, it crashes if time is not a numberNo Validation on Time

comment:2 Changed 16 years ago by anonymous

It would also be great if times could be converted from "0,5" to "0.5", so that swedish users can use their numerical keypad.

comment:3 Changed 16 years ago by anonymous

Note: at present it is possible to reduce the hours worked on a ticket, for example if you made a mistake and typed 35 instead of 3.5 hours. This is a helpful feature and should be preserved if possible.

comment:4 in reply to:  2 Changed 16 years ago by Russ Tyndall

Replying to anonymous:

It would also be great if times could be converted from "0,5" to "0.5", so that swedish users can use their numerical keypad.

This is now available for data entry...

comment:5 Changed 15 years ago by anonymous

I suggest you look at my patch for time integer custom fields http://trac.edgewall.org/attachment/wiki/TimeTracking/CustomFields0.11Rev7651.patch

This is a good place to start for adding some client side validation. Server side I'm not sure about.

comment:6 Changed 15 years ago by Filipe Correia

I'm for the inclusion of this ticket on the next release! Are there any plans in this regard?

comment:7 Changed 15 years ago by anonymous

Cc: Filipe Correia added; anonymous removed

comment:8 Changed 15 years ago by anonymous

While javascript can be a nice addition to the user experience, it should _never_ be used as a substitute for proper back end validation. I'm attaching a patch that adds validation on the back end, should apply cleanly to trunk.

Changed 15 years ago by anonymous

Add backend validation for hours fields

comment:9 Changed 15 years ago by Russ Tyndall

Resolution: fixed
Status: newclosed

(In [5162]) closes #1376 Much thanks to Anonymous for the patch!

Adds standard trac validation on the ticket hours and estimated hours fields New version is 0.7.6 and available

Modify Ticket

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