Merge lp:~thekorn/launchpadlib/fix-342709-ensure-representation into lp:~launchpad-pqm/launchpadlib/devel

Proposed by Markus Korn
Status: Rejected
Rejected by: Leonard Richardson
Proposed branch: lp:~thekorn/launchpadlib/fix-342709-ensure-representation
Merge into: lp:~launchpad-pqm/launchpadlib/devel
Diff against target: None lines
To merge this branch: bzr merge lp:~thekorn/launchpadlib/fix-342709-ensure-representation
Reviewer Review Type Date Requested Status
Leonard Richardson (community) Disapprove
Review via email: mp+4483@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Markus Korn (thekorn) wrote :

Make sure a resource has its representation fetched when retrieving the resource's parameters

Revision history for this message
Leonard Richardson (leonardr) wrote :

My initial reaction was that this undid an optimization. If we automatically retrieved representations we'd be making all kinds of unnecessary requests.

But actually, this is fine. We only make the request when (eg.) dir() is called on an object that doesn't have a representation. If you never call dir() this code will never run. So I think this is a good patch.

Revision history for this message
Leonard Richardson (leonardr) wrote :

AFAICT this branch doesn't solve a problem. dir() works fine even when there is no loaded representation of the resource. If the problem is that dir() shows the object to be of the wrong type, that's a problem that can be fixed in general before the object is created.

review: Disapprove

Unmerged revisions

37. By Markus Korn

* launchpadlib/resources.py: small fix to make sure a resource has its
  representation fetched when retrieving the resource's parameters
  (LP: #342709)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launchpadlib/resource.py'
2--- launchpadlib/resource.py 2009-02-17 15:42:25 +0000
3+++ launchpadlib/resource.py 2009-03-14 10:07:46 +0000
4@@ -154,6 +154,7 @@
5 def _get_parameter_names(self, *kinds):
6 """Retrieve some subset of the resource's parameters."""
7 names = []
8+ self._ensure_representation()
9 for name in self._wadl_resource.parameter_names(
10 self.JSON_MEDIA_TYPE):
11 if name.endswith('_collection_link'):

Subscribers

People subscribed via source and target branches