launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #05072
[Merge] lp:~wallyworld/launchpad/bug-subscribers-portlet-json into lp:launchpad
Ian Booth has proposed merging lp:~wallyworld/launchpad/bug-subscribers-portlet-json into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #859276 in Launchpad itself: "Bug secrecy view ajax rendering"
https://bugs.launchpad.net/launchpad/+bug/859276
For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/bug-subscribers-portlet-json/+merge/76920
== Implementation ==
A quick fix to improve how the json is constructed for the BugSecrecyEditView change action.
== Tests ==
Run the existing test_secrecy_view_ajax_render test
== Lint ==
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/bugs/browser/bug.py
lib/lp/bugs/browser/bugsubscription.py
--
https://code.launchpad.net/~wallyworld/launchpad/bug-subscribers-portlet-json/+merge/76920
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/bug-subscribers-portlet-json into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bug.py'
--- lib/lp/bugs/browser/bug.py 2011-09-21 13:27:17 +0000
+++ lib/lp/bugs/browser/bug.py 2011-09-25 23:54:24 +0000
@@ -881,16 +881,15 @@
bug = self.context
subscribers_portlet = BugPortletSubscribersWithDetails(
bug, self.request)
- subscription_data = subscribers_portlet()
- cache_data = dumps(
- cache, cls=ResourceJSONEncoder,
+ subscription_data = subscribers_portlet.subscriber_data
+ result_data = dict(
+ cache_data=cache,
+ subscription_data=subscription_data)
+ self.request.response.setHeader('content-type', 'application/json')
+ return dumps(
+ result_data, cls=ResourceJSONEncoder,
media_type=EntryResource.JSON_TYPE)
- return """{
- "cache_data": %s,
- "subscription_data": %s}
- """ % (cache_data, subscription_data)
-
def _handlePrivacyChanged(self, user_will_be_subscribed):
"""Handle the case where the privacy of the bug has been changed.
=== modified file 'lib/lp/bugs/browser/bugsubscription.py'
--- lib/lp/bugs/browser/bugsubscription.py 2011-09-21 04:16:05 +0000
+++ lib/lp/bugs/browser/bugsubscription.py 2011-09-25 23:54:24 +0000
@@ -560,7 +560,7 @@
return data
@property
- def subscriber_data_js(self):
+ def subscriber_data(self):
"""Return subscriber_ids in a form suitable for JavaScript use."""
bug = IBug(self.context)
data = self.direct_subscriber_data(bug)
@@ -583,7 +583,11 @@
'subscription_level': 'Maybe',
}
data.append(record)
- return dumps(data)
+ return data
+
+ @property
+ def subscriber_data_js(self):
+ return dumps(self.subscriber_data)
def render(self):
"""Override the default render() to return only JSON."""
Follow ups