JSON sends numbers to restful date marshaller

Bug #396383 reported by Ursula Junque
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Launchpad itself
Low
Curtis Hovey
lazr.restful
High
Curtis Hovey

Bug Description

Steps to reproduce:

1. Open https://staging.launchpad.net/launchpad/trunk
2. Click create milestone
3. Fill in details
4. In the date field fill in 20090810
5. Click create milestone
6. OOPS-1284S483 TypeError: Expected a string argument

Revision history for this message
Curtis Hovey (sinzui) wrote :

This has always been the case, the js widget does the right thing, and the field description explains the format. The Date widget should have fixed or invalidated the input.

affects: launchpad-registry → launchpad-foundations
Changed in launchpad-foundations:
importance: Undecided → Low
status: New → Triaged
summary: - When creating a milestone, giving a date in format DDMMYYYY OOPSes
+ date widget could be smarter, giving a date in format DDMMYYYY OOPSes
description: updated
Revision history for this message
Curtis Hovey (sinzui) wrote : Re: date widget could be smarter, giving a date in format DDMMYYYY OOPSes

The datetime widget bug (while real) is not the bug in the oops. The restful marshaller expects a string, but the JSON serialized the numbers as numbers. Lazr.restful.marshallers.DateTimeFieldMarshaller must add a TypeError to its expected exceptions:

    TypeError('Expected a string argument')

So that normal error handling will occur.

This bug affects every date and datetime that is sent via AJAX.

Revision history for this message
Francis J. Lacoste (flacoste) wrote :

The problem lies in the JS widget, it should sent the datetime as a string, not a number.

Curtis Hovey (sinzui)
summary: - date widget could be smarter, giving a date in format DDMMYYYY OOPSes
+ JSON sends numbers to restfull date marshaller
Curtis Hovey (sinzui)
summary: - JSON sends numbers to restfull date marshaller
+ JSON sends numbers to restful date marshaller
Changed in lazr.restful:
assignee: nobody → Curtis Hovey (sinzui)
importance: Undecided → High
status: New → In Progress
Revision history for this message
Curtis Hovey (sinzui) wrote :

Fixed in r42.

Changed in launchpad-foundations:
assignee: nobody → Curtis Hovey (sinzui)
milestone: none → 2.2.7
status: Triaged → Fix Committed
Changed in lazr.restful:
status: In Progress → Fix Committed
Revision history for this message
Curtis Hovey (sinzui) wrote :

Also fixed launchpad~pqm r28.

Revision history for this message
Curtis Hovey (sinzui) wrote : Bug 396383 Fix released

Fixed released in Launchpad 2.2.7.

Changed in launchpad-foundations:
status: Fix Committed → Fix Released
Changed in lazr.restful:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers