TypeError when lazr.restful tries to unmarshall URI

Bug #474522 reported by Gary Poster on 2009-11-04
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
High
Leonard Richardson
lazr.restful
High
Unassigned

Bug Description

OOPS-1403ED45 shows a problem in which lazr.restful tries to unmarshall a URI, but lazr.uri complains, ``TypeError: expected string or buffer``. I first guessed that this was caused by passing None, but in this case the error was on rev 9826, which used lazr.restful 0.9.13, which does check for None in lazr.restful.marshallers.SimpleFieldMarshaller.marshall_from_json_data . Therefore, I do not know what the TypeError could be. If we can't identify and fix the problem, we should at least instrument it so we'll know what to do next time.

Gary Poster (gary) on 2009-11-04
Changed in launchpad-foundations:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Leonard Richardson (leonardr)
tags: added: api oops
Leonard Richardson (leonardr) wrote :

This launchpadlib code will reproduce:

bug = launchpad.bugs[40000]
bug.owner = 42
bug.lp_save()

The problem is not that the object is None, but that it's not a string. Since only a string can be a valid URI, checking the type in the marshaller seems like a good way to solve the problem.

If you try to set a string field to a number, you 400 Bad Request and this error:

name: got 'int', expected unicode: 44

I'm not sure why that behavior isn't inherited.

Changed in lazr.restful:
status: New → Triaged
importance: Undecided → High
Leonard Richardson (leonardr) wrote :

I can no longer duplicate this bug: the Launchpad code I gave earlier now gives a 400 response code and no OOPS. OOPSes like this still happen, but apparently not in lazr.restful. ("expected string or buffer" is a pretty common error when you're using regular expressions.) I'm going to mark this invalid.

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

Other bug subscribers