← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~thumper/launchpad/bugtask-repr into lp:launchpad

 

Tim Penhey has proposed merging lp:~thumper/launchpad/bugtask-repr into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~thumper/launchpad/bugtask-repr/+merge/53731

A trivially simple branch to add a useful repr method to BugTask.
-- 
https://code.launchpad.net/~thumper/launchpad/bugtask-repr/+merge/53731
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~thumper/launchpad/bugtask-repr into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/tests/bugtask-adding-views.txt'
--- lib/lp/bugs/browser/tests/bugtask-adding-views.txt	2011-03-11 20:38:55 +0000
+++ lib/lp/bugs/browser/tests/bugtask-adding-views.txt	2011-03-17 02:46:28 +0000
@@ -216,7 +216,7 @@
     >>> form['field.product'] = u'evolution'
     >>> add_task_view = get_and_setup_view(
     ...     firefox_task, '+choose-affected-product', form)
-    ObjectCreatedEvent: <BugTask at ...>
+    ObjectCreatedEvent: <BugTask ...>
 
     >>> for bugtask in bug_four.bugtasks:
     ...     print bugtask.bugtargetdisplayname
@@ -262,7 +262,7 @@
     >>> form['field.link_upstream_how'] = u'UNLINKED_UPSTREAM'
     >>> add_task_view = get_and_setup_view(
     ...     firefox_task, '+choose-affected-product', form)
-    ObjectCreatedEvent: <BugTask at ...>
+    ObjectCreatedEvent: <BugTask ...>
     >>> print add_task_view.notifications
     []
     >>> add_task_view.next_url is not None
@@ -324,7 +324,7 @@
     >>> add_task_view = get_and_setup_view(
     ...     firefox_task, '+choose-affected-product', form)
     ObjectCreatedEvent: <BugWatch at ...>
-    ObjectCreatedEvent: <BugTask at ...>
+    ObjectCreatedEvent: <BugTask ...>
 
     >>> for bugtask in bug_four.bugtasks:
     ...     print bugtask.bugtargetdisplayname
@@ -347,7 +347,7 @@
     >>> add_task_view = get_and_setup_view(
     ...     firefox_task, '+choose-affected-product', form)
     ObjectCreatedEvent: <BugWatch at ...>
-    ObjectCreatedEvent: <BugTask at ...>
+    ObjectCreatedEvent: <BugTask ...>
 
     >>> print add_task_view.notifications
     []
@@ -390,7 +390,7 @@
     >>> add_task_view = get_and_setup_view(
     ...     bug_five_task, '+choose-affected-product', form)
     ObjectCreatedEvent: <BugWatch at ...>
-    ObjectCreatedEvent: <BugTask at ...>
+    ObjectCreatedEvent: <BugTask ...>
 
     >>> add_task_view.request.response.getHeader('Location')
     'http://.../+bug/5'
@@ -439,7 +439,7 @@
     ...     'field.sourcepackagename': u'mozilla-firefox-data'}
     >>> add_task_view = get_and_setup_view(
     ...     firefox_task, '+distrotask', form)
-    ObjectCreatedEvent: <BugTask at ...>
+    ObjectCreatedEvent: <BugTask ...>
     >>> add_task_view.errors
     []
 

=== modified file 'lib/lp/bugs/browser/tests/person-bug-views.txt'
--- lib/lp/bugs/browser/tests/person-bug-views.txt	2010-11-05 14:17:11 +0000
+++ lib/lp/bugs/browser/tests/person-bug-views.txt	2011-03-17 02:46:28 +0000
@@ -516,7 +516,7 @@
     >>> transaction.commit()
 
     >>> print pretty(list(related_bugs_view.searchUnbatched()))
-    [<BugTask at ...>]
+    [<BugTask ...>]
     >>> print pretty(related_bugs_view.getMilestoneWidgetValues())
     []
 

=== modified file 'lib/lp/bugs/doc/bug-nomination.txt'
--- lib/lp/bugs/doc/bug-nomination.txt	2011-03-11 15:56:11 +0000
+++ lib/lp/bugs/doc/bug-nomination.txt	2011-03-17 02:46:28 +0000
@@ -537,7 +537,7 @@
     ...     bug=bug_one, owner=no_privs,
     ...     distribution=ubuntu,
     ...     sourcepackagename=ubuntu_evolution.sourcepackagename)
-    <BugTask at ...>
+    <BugTask ...>
 
     >>> tasks = sorted(
     ...     bug_one.bugtasks, key=by_bugtargetdisplayname)

=== modified file 'lib/lp/bugs/doc/bug.txt'
--- lib/lp/bugs/doc/bug.txt	2011-03-11 15:43:27 +0000
+++ lib/lp/bugs/doc/bug.txt	2011-03-17 02:46:28 +0000
@@ -141,7 +141,7 @@
     >>> login("foo.bar@xxxxxxxxxxxxx")
 
     >>> bug.addTask(owner=params.owner, target=jukebox)
-    <BugTask at ...>
+    <BugTask ...>
 
     >>> from zope.event import notify
     >>> notify(event)

=== modified file 'lib/lp/bugs/doc/bugtask-retrieval.txt'
--- lib/lp/bugs/doc/bugtask-retrieval.txt	2010-10-19 18:44:31 +0000
+++ lib/lp/bugs/doc/bugtask-retrieval.txt	2011-03-17 02:46:28 +0000
@@ -20,7 +20,7 @@
 
     >>> retrieved_task = task_set.get(2)
     >>> retrieved_task
-    <BugTask at ...>
+    <BugTask ...>
 
     >>> from canonical.launchpad.webapp.testing import verifyObject 
     >>> verifyObject(IBugTask, retrieved_task)
@@ -63,7 +63,7 @@
 method returns a singleton dictionary:
 
     >>> task_set.getMultiple([2])
-    {2: <BugTask at ...>}
+    {2: <BugTask ...>}
 
 When given an empty sequence, the method returns an empty dictionary:
 
@@ -75,14 +75,14 @@
 those bug task IDs that are present in the database:
 
     >>> task_set.getMultiple([1, 2])
-    {2: <BugTask at ...>}
+    {2: <BugTask ...>}
 
     >>> task_set.get(1)
     Traceback (most recent call last):
     ...
     NotFoundError: ...
     >>> task_set.get(2)
-    <BugTask at ...>
+    <BugTask ...>
 
 When given an argument that isn't a valid sequence, or a sequence
 containing one or more entries that aren't valid bug task IDs, the

=== modified file 'lib/lp/bugs/doc/bugtask.txt'
--- lib/lp/bugs/doc/bugtask.txt	2011-03-15 22:58:07 +0000
+++ lib/lp/bugs/doc/bugtask.txt	2011-03-17 02:46:28 +0000
@@ -1076,7 +1076,7 @@
     ...     distribution=ubuntu,
     ...     sourcepackagename=(
     ...         sourcepackagenameset.queryByName('mozilla-firefox')))
-    <BugTask at ...>
+    <BugTask ...>
 
     >>> new_bug.addNomination(mark, ubuntu.currentseries).approve(mark)
 
@@ -1092,7 +1092,7 @@
     ...     distribution=ubuntu,
     ...     sourcepackagename=(
     ...         sourcepackagenameset.queryByName('alsa-utils')))
-    <BugTask at ...>
+    <BugTask ...>
 
 The second task has been created and has also been successfully
 nominated to Hoary.

=== modified file 'lib/lp/bugs/doc/security-teams.txt'
--- lib/lp/bugs/doc/security-teams.txt	2010-12-08 09:44:31 +0000
+++ lib/lp/bugs/doc/security-teams.txt	2011-03-17 02:46:28 +0000
@@ -296,7 +296,7 @@
     >>> reporter = factory.makePerson(displayname=u'Bug Reporter')
     >>> bug = factory.makeBug(product=product, owner=reporter)
     >>> bug.addTask(owner=reporter, target=distribution)
-    <BugTask at ...>
+    <BugTask ...>
     >>> old_state = Snapshot(bug, providing=IBug)
     >>> bug.setSecurityRelated(True)
     True

=== modified file 'lib/lp/bugs/model/bugtask.py'
--- lib/lp/bugs/model/bugtask.py	2011-03-15 22:58:07 +0000
+++ lib/lp/bugs/model/bugtask.py	2011-03-17 02:46:28 +0000
@@ -1227,6 +1227,9 @@
                 user == celebs.bug_watch_updater or
                 user == celebs.bug_importer)
 
+    def __repr__(self):
+        return "<BugTask for bug %s on %r>" % (self.bugID, self.target)
+
 
 def search_value_to_where_condition(search_value):
     """Convert a search value to a WHERE condition.

=== modified file 'lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt'
--- lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt	2010-10-20 19:41:34 +0000
+++ lib/lp/bugs/stories/bug-tags/xx-official-bug-tags.txt	2011-03-17 02:46:28 +0000
@@ -228,7 +228,7 @@
     >>> product2.official_bug_tags = [u'miney', u'moe']
     >>> bug = factory.makeBug(product=product1)
     >>> bug.addTask(target=product2, owner=factory.makePerson())
-    <BugTask at ...>
+    <BugTask ...>
     >>> bug_url = canonical_url(bug)
     >>> transaction.commit()
     >>> logout()