Changing bug attribute raises exception, if no attribute was previously read.

Bug #936502 reported by Eike on 2012-02-19
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
launchpadlib
Low
Unassigned

Bug Description

When a program wants to change attributes of a bug, it must first read one
attribute of the bug; otherwise the program fails with an exception from deep
inside Launchpadlib.

This script triggers the error:

from launchpadlib.launchpad import Launchpad
launchpad = Launchpad.login_with("bug-repo-syncer", "production")

lp_task = launchpad.load(
    'https://api.launchpad.net/1.0/bug-repo-syncer/+bug/934181')
lp_bug = lp_task.bug

#Un-commenting this makes the error go away.
#lp_bug.title

lp_bug.title = "Test bug"
lp_bug.description = "A bug for testing Launchpadlib."

#Fails with:
#Traceback (most recent call last):
# File "lp_problem.py", line 8, in <module>
# lp_bug.title = "Test bug"
# File "/usr/local/lib/python2.7/
#site-packages/lazr/restfulclient/resource.py", line 692, in __setattr__
# if not self.lp_has_parameter(name):
# File "/usr/local/lib/python2.7/
#site-packages/lazr/restfulclient/resource.py", line 206, in lp_has_parameter
# return self._get_external_param_name(param_name) is not None
# File "/usr/local/lib/python2.7/
#site-packages/lazr/restfulclient/resource.py", line 349, in
# _get_external_param_name
# if self._wadl_resource.get_parameter(name):
# File "/usr/local/lib/python2.7/site-packages/wadllib/application.py",
#line 452, in get_parameter
# definition = self._find_representation_definition(media_type)
# File "/usr/local/lib/python2.7/site-packages/wadllib/application.py",
#line 564, in _find_representation_definition
# "Resource is not bound to any representation, and no media "
#wadllib.application.NoBoundRepresentationError: Resource is not bound to any
# representation, and no media media type was specified.

Changed in launchpadlib:
status: New → Triaged
importance: Undecided → Low
Eike (eike-welk) on 2012-03-25
Changed in bug-repo-syncer:
status: New → Confirmed
importance: Undecided → Low
Eike (eike-welk) on 2012-03-25
description: updated
description: updated
Eike (eike-welk) on 2012-03-25
description: updated
Robert Collins (lifeless) wrote :

@Eike this bug isn't present in bug-repo-syncer - it may be affected by it, but it will be entirely fixed when launchpadlib is fixed - so I'm removing your task. If you want a bug on bug-repo-syncer to track your working around this, I suggest using a separate bug.

affects: bug-repo-syncer → null
no longer affects: null
description: updated
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers