Bug
|
Size: 3178
Comment:
|
Size: 6689
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| ||<tablestyle="float:right; font-size: 0.9em; width:40%; background:#F1F1ED; margin: 0 0 1em 1em;" style="padding:0.5em;">'''Contents'''[[BR]][[TableOfContents]]|| |
|
| Line 27: | Line 29: |
| '' add a table of all attributes '' | ||'''Attribute'''||'''Description'''||'''Example'''|| ||.activity||Activity Log of a bugreport (type: list)|| [#activity] || ||.assignee||Person assigned to a bugreport (type: user)|| [#user] || ||.attachments||List of attachments|| [#attachments] || ||.branch||List of bzr branches|| || ||.bugnumber||Number of a bugreport (type: int)|| || ||.changed||List of local changes to a bugreport|| [#changed] || ||.comments||List of comments|| [#comments] || ||.date|| || || ||.description|| || || ||.duplicate_of|| || || ||.duplicates||List of duplicates of a bug|| || ||.get_subscriptions_category||Subscribers broken into 'directly', 'notified', and 'duplicates'|| || ||.importance|| || || ||.info|| || || ||.infotable|| || || ||.milestone|| || || ||.nickname|| || || ||.private|| || || ||.reporter|| || || ||.security|| || || ||.sourcepackage|| || || ||.status|| || || ||.subscriptions||All subscribers|| || ||.summary|| || || ||.tags|| || || ||.target|| || || ||.text|| || || ||.title|| || || ||.url|| || || === Activity Log === [[Anchor(activity)]] Get the Activity Log: {{{#!python start=5 >>> print b.activity[:3] #slice the list so it's more readable [<thekorn 2007-06-15 16:29:00 UTC 'bug'>, <thekorn 2007-06-15 18:41:00 UTC 'description'>, <thekorn 2007-07-18 07:38:00 UTC 'name'>] }}} Members of this list have the following attributes: * .date, datetime object indicating the time of the change * .user, lphelper.user object * .what, string saying what changed * .old_value. of type str * .new_value, of type str * .message, of type str |
| Line 30: | Line 79: |
| Get a list of attachments: | [[Anchor(attachments)]] Get a list of attachments: |
| Line 59: | Line 109: |
| >>> bug.attachments.remove([i for i in bug.attachments.filter(test_filter)]) | >>> bug.attachments.remove(test_filter) |
| Line 88: | Line 138: |
| Get a list of comments: | [[Anchor(comments)]] Get a list of comments: |
| Line 96: | Line 146: |
| >>> comment = Bug.NewComment(text="this is a test comment") | >>> comment = Bug.NewComment(text="this is a test comment",subject="test comment") |
| Line 102: | Line 152: |
| === User === [[Anchor(user)]] User are String-like objects with an additional attribute `.realname`.[[BR]] {{{#!python >>> str(bug.assignee) 'thekorn' >>> repr(bug.assignee) '<user thekorn (Markus Korn)>' >>> bug.assignee.realname 'Markus Korn' }}} |
|
| Line 106: | Line 168: |
| {{{#!python start=41 | [[Anchor(changed)]] {{{#!python start=41 |
| Line 118: | Line 180: |
There are two possible arguments to `.commit()`: * `force_changes=<bool>`: * `False (default)`: * `True`: ''Example:'' If a user tries to add a tag `foo` to a bugreport and `foo` s not a tag in this product yet, launchpad will raise an error. If this option is set to `True` `foo` will be added to the list of tags to this project and than added to this bugreport. * `ignore_lp_errors=<bool>`: * `True (default)`: ignores launchpad processing errors * `False`: raises a `ValueError` if launchpad is unable to change a value == Filing a bug report == {{{#!python bug = Bug.New(product={"name": "python-launchpad-bugs"}, summary="RFE: Add function to create a new bugreport", description="""It would be nice if a user could create a bugreport via a script using python-launchpad-bugs. Markus""") }}} * product is a dictionary like `{"name": <lpname of the product>, "target": <distribution>}` * `product={"name": "python-launchpad-bugs"}` creates a bug in https://bugs.launchpad.net/python-launchpad-bugs/ * `product={"name": "python-launchpad-bugs", "target": "ubuntu"}` creates a bug in https://bugs.launchpad.net/ubuntu/+source/python-launchpad-bugs/ * `product={"name": "ubuntu"}` creates a bug in https://bugs.launchpad.net/ubuntu/ (bug in "ubuntu" without a sourcepackage) * other optional arguments to `.New()`: * tags: list of tags like `["foo", "bar"]` * `security_related` (default: `False`) |
ContentsBRTableOfContents |
Bug - tutorial
General workflow
That is the way to use python-launchpad-bugs to get information on a bugreport or to edit a bugreport:
It is also possible to get a bugreport by its url:
3 >>> bug = Bug(url="https://bugs.launchpad.net/buglog-data/+bug/120593")
If you want to change the bugreport or view private bugs you have to set Bug.authentication:
4 >>> Bug.authentication="cookie.txt"
Attributes of a bugreport
Overview
Attribute |
Description |
Example |
.activity |
Activity Log of a bugreport (type: list) |
[#activity] |
.assignee |
Person assigned to a bugreport (type: user) |
[#user] |
.attachments |
List of attachments |
[#attachments] |
.branch |
List of bzr branches |
|
.bugnumber |
Number of a bugreport (type: int) |
|
.changed |
List of local changes to a bugreport |
[#changed] |
.comments |
List of comments |
[#comments] |
.date |
|
|
.description |
|
|
.duplicate_of |
|
|
.duplicates |
List of duplicates of a bug |
|
.get_subscriptions_category |
Subscribers broken into 'directly', 'notified', and 'duplicates' |
|
.importance |
|
|
.info |
|
|
.infotable |
|
|
.milestone |
|
|
.nickname |
|
|
.private |
|
|
.reporter |
|
|
.security |
|
|
.sourcepackage |
|
|
.status |
|
|
.subscriptions |
All subscribers |
|
.summary |
|
|
.tags |
|
|
.target |
|
|
.text |
|
|
.title |
|
|
.url |
|
|
Activity Log
Anchor(activity) Get the Activity Log:
Members of this list have the following attributes:
- .date, datetime object indicating the time of the change
- .user, lphelper.user object
- .what, string saying what changed
- .old_value. of type str
- .new_value, of type str
- .message, of type str
Attachments
Anchor(attachments) Get a list of attachments:
As you can see there are four files attached to the bug and the first attachment has already been downloaded.
You can for example filter the list of attachments by the filename:
These filtered attachments can be easily removed:
To add an attachment you have to create an new attachment-object:
Now you have to add this attachment to the bugreport:
Comments
Anchor(comments) Get a list of comments:
Create a new comment and add this comment to the bugreport:
User
Anchor(user) User are String-like objects with an additional attribute .realname.BR
Commit changes
get a list of changes
commit changes
46 >>> bug.commit()
There are two possible arguments to .commit():
force_changes=<bool>:
False (default):
True: Example: If a user tries to add a tag foo to a bugreport and foo s not a tag in this product yet, launchpad will raise an error. If this option is set to True foo will be added to the list of tags to this project and than added to this bugreport.
ignore_lp_errors=<bool>:
True (default): ignores launchpad processing errors
False: raises a ValueError if launchpad is unable to change a value
Filing a bug report
product is a dictionary like {"name": <lpname of the product>, "target": <distribution>}
product={"name": "python-launchpad-bugs"} creates a bug in https://bugs.launchpad.net/python-launchpad-bugs/
product={"name": "python-launchpad-bugs", "target": "ubuntu"} creates a bug in https://bugs.launchpad.net/ubuntu/+source/python-launchpad-bugs/
product={"name": "ubuntu"} creates a bug in https://bugs.launchpad.net/ubuntu/ (bug in "ubuntu" without a sourcepackage)
other optional arguments to .New():
tags: list of tags like ["foo", "bar"]
security_related (default: False)
BugHelper/Dev/python-launchpad-bugs/Bug (last edited 2008-08-12 22:24:51 by c-24-21-234-111)