Closed
Bug 910381
Opened 11 years ago
Closed 11 years ago
Collection creation without region/carrier fails with a 500
Categories
(Marketplace Graveyard :: API, defect, P2)
Tracking
(Not tracked)
VERIFIED
FIXED
2013-09-03
People
(Reporter: krupa.mozbugs, Assigned: mat)
References
()
Details
steps to reproduce:
1. Load https://marketplace-dev.allizom.org/curation/new_collection?type=operator
2. Try to create a collection after filling in all the required fields. Make sure to leave the region/carrier section empty.
expected behavior:
collection creation is successful
observed behavior:
Collection creation fails with a 500
[11:31:57.335] POST https://marketplace-dev.allizom.org/api/v1/rocketfuel/collections/?_user=kraj%40mozilla.com%2C3c51af17bfcb5c4d62d2bd781fda327c58d707147858405179d2a1002a0739cc094e4ede0880e84cb32a323694393d927d77cdce59a45073fbb318936b01dd65%2C2fdc85b495484ddfb9a77b81d1d38f0d&carrier=carrierless&lang=en-US [HTTP/1.1 500 INTERNAL SERVER ERROR 1909ms]
Comment 1•11 years ago
|
||
(1) Add HTML5 `required` attributes to Region and Carrier fields.
(2) Disallow the API from ever 500ing if region and/or carrier are missing.
Blocks: mkt-publishtool-api
Comment 2•11 years ago
|
||
Region and carrier are not required and should not be required.
Updated•11 years ago
|
Component: Admin Tools → API
Comment 3•11 years ago
|
||
(In reply to Matt Basta [:basta] from comment #2)
> Region and carrier are not required and should not be required.
For operator shelf? I thought carrier *was* required for operator shelf?
Comment 4•11 years ago
|
||
Sorry, region is optional. Carrier for OSCs is not. The API doesn't necessarily need to enforce that, though.
Assignee | ||
Comment 5•11 years ago
|
||
It's definitely weird that it's 500ing anyway, it shouldn't do that whatever parameters we pass or omit :)
Assignee | ||
Comment 6•11 years ago
|
||
Assignee: nobody → mpillard
Priority: -- → P1
Assignee | ||
Comment 7•11 years ago
|
||
This is an issue with Django-Rest-Framework https://groups.google.com/forum/#!msg/django-rest-framework/g3Mnp7YY5hU/_LwTqKf8-Z0J
It tries to do some magic with the choices and that doesn't work well for us. I'll find a workaround.
Assignee | ||
Comment 8•11 years ago
|
||
I have a workaround but it's too ugly, I submitted a pull request to DRF and I'm waiting to see if it's accepted and if people disagree with it to check if that's the right way to fix it.
https://github.com/tomchristie/django-rest-framework/pull/1074
Depending on how fast things are going we might need to apply my ugly workaround or use a fork of drf to get this fixed.
Assignee | ||
Updated•11 years ago
|
Status: NEW → ASSIGNED
Comment 9•11 years ago
|
||
(In reply to Mathieu Pillard [:mat] from comment #8)
> I have a workaround but it's too ugly, I submitted a pull request to DRF and
> I'm waiting to see if it's accepted and if people disagree with it to check
> if that's the right way to fix it.
>
> https://github.com/tomchristie/django-rest-framework/pull/1074
>
> Depending on how fast things are going we might need to apply my ugly
> workaround or use a fork of drf to get this fixed.
Well that was fast!
If it doesn't get merged/tagged into a stable version soon, I'm not terribly concerned about leaving this bug hanging. We now enforce `carrier` to be non-null in the front-end, so this shouldn't happen unless someone is manually hitting the API.
Assignee | ||
Comment 10•11 years ago
|
||
It can also happen with 'region' though. I think a workaround that could work would be to completely omit it from the POST/PUT/PATCH data when null instead of including it with an empty value.
In the meantime, I've submitted a pull request on zamboni switch our django-rest-framework requirement to point to the commit that has the fix while we wait for a stable release, on a suggestion from kumar. https://github.com/mozilla/zamboni/pull/1068
Assignee | ||
Comment 11•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Priority: P1 → P2
Resolution: --- → FIXED
Target Milestone: --- → 2013-09-03
Comment 12•11 years ago
|
||
Verified as fixed in https://marketplace-dev.allizom.org/curation/new_collection?type=operator on FF26 (Win 7).
Postfix screencast http://screencast.com/t/jkVmJGOxV
Closing bug.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•