bug_target objects claim to belong to derived interfaces but don't allow fetching their attributes

Bug #394921 reported by Colin Watson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
launchpadlib
New
Undecided
Unassigned

Bug Description

The following behaviour is bizarre:

>>> launchpad.bugs[385605].bug_tasks[0].target
<project at https://api.edge.launchpad.net/beta/hardy-backports>
>>> launchpad.bugs[385605].bug_tasks[0].target.name
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/dist-packages/launchpadlib/resource.py", line 457, in __getattr__
    return super(Entry, self).__getattr__(name)
  File "/usr/lib/python2.6/dist-packages/launchpadlib/resource.py", line 302, in __getattr__
    % (self.__class__.__name__, attr))
AttributeError: 'Entry' object has no attribute 'name'

The object claims to be a project (indeed, in the actual code I was writing I was parsing and testing resource_type_link to make sure of this), and according to +apidoc a project object should have a "name" attribute.

A cheesy workaround appears to be as follows, but I feel dirty:

>>> launchpad.load(launchpad.bugs[385605].bug_tasks[0].target.self_link).name
'hardy-backports'

(Yes, I could use bug_task.bug_target_name, but I prefer using .target as it gives me a more structured way to distinguish between bugs filed on projects vs. distribution source packages and to pull out the salient attributes for each.)

Revision history for this message
Markus Korn (thekorn) wrote :

In my understanding this is a duplicate of bug 340935

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.