Modify

Opened 8 years ago

Closed 6 years ago

#1376 closed defect (fixed)

No Validation on Time

Reported by: anonymous Owned by: bobbysmith007
Priority: normal Component: TimingAndEstimationPlugin
Severity: normal Keywords:
Cc: fcorreia@… 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 6 years ago.
Add backend validation for hours fields

Download all attachments as: .zip

Change History (10)

comment:1 Changed 8 years ago by bobbysmith007

  • Priority changed from high to normal
  • Severity changed from major to normal
  • Summary changed from When entering time, it crashes if time is not a number to No Validation on Time

comment:2 follow-up: Changed 7 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 7 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 6 years ago by bobbysmith007

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 6 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 6 years ago by FilipeCorreia

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

comment:7 Changed 6 years ago by anonymous

  • Cc fcorreia@… added; anonymous removed

comment:8 Changed 6 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 6 years ago by anonymous

Add backend validation for hours fields

comment:9 Changed 6 years ago by bobbysmith007

  • Resolution set to fixed
  • Status changed from new to closed

(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

Add Comment

Modify Ticket

Action
as closed The owner will remain bobbysmith007.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.