duplicate_of_link empty in API XHTML response

Bug #1982509 reported by Swiftb0y
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Triaged
Low
Unassigned

Bug Description

This seems to be more related the launchpad API in general than to launchpadlib but I didn't know where else to file this bug.

When you query the api for a bug that has duplicates, the `duplicate_of_link` is always empty. From my understanding it contain the link to the bug of which the queried bug is a duplicate of.

Take bug 1094714 which is a duplicate of 862025 in the launchpad web interface. If you query the api for that bug (https://api.launchpad.net/devel/bugs/1094714) then the `duplicate_of_link` is empty.
Querying https://api.launchpad.net/devel/bugs/862025/duplicates does however contain a copy of 1094714 inside.

Am I misunderstanding the API here or is this a bug?

TIA for your help.

Tags: api lp-bugs
William Grant (wgrant)
affects: launchpadlib → launchpad
Guruprasad (lgp171188)
Changed in launchpad:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Colin Watson (cjwatson) wrote :

I can't reproduce this. Could you please post your code that demonstrates the problem? Interactively, in `lp-shell production devel`:

    In [1]: bug = lp.bugs[1094714]

    In [2]: bug.duplicate_of
    Out[2]: <bug at https://api.launchpad.net/devel/bugs/862025>

Changed in launchpad:
status: Triaged → Incomplete
tags: added: api lp-bugs
Revision history for this message
Colin Watson (cjwatson) wrote :

I agree that https://api.launchpad.net/devel/bugs/1094714 looks wrong when I open it in Firefox. This seems to be specific to the XHTML response; if you try `curl -s https://api.launchpad.net/devel/bugs/1094714 | jq -S` then you see the correct `duplicate_of_link`. We should work out what's wrong there, but this shouldn't affect launchpadlib.

Revision history for this message
Swiftb0y (swiftb0y) wrote :

Thanks for your response. I can confirm that the property is indeed there when requesting the json response. It also seems to work in launchpadlib. I think its primarily my fault. When I initially tested this, I queried `searchTasks` but with `omit_duplicates` implicitly set to true. The result was that none of the queried bugs had a `duplicate_of` (obviously). When I then did the manual testing with XHTML response, my initial suspicion (that the API had an issue) seemed to be confirmed.
Thanks for helping me clear this up. I guess the only thing broken seems to be the XHTML response but not the JSON Response.

Swiftb0y (swiftb0y)
summary: - duplicate_of_link always empty
+ duplicate_of_link empty in API XHTML response
Revision history for this message
William Grant (wgrant) wrote :

This is because lp.app.browser.webservice.reference_xhtml_representation assumes that the webservice field name matches the model attribute name, which is not the case here because exported_as is used to rename "duplicateof" to "duplicate_of". getattr returns none, and format_link's empty_value is returned.

Changed in launchpad:
status: Incomplete → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.