← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/export-security_contact-for-1.0 into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/export-security_contact-for-1.0 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1051132 in Launchpad itself: "security_contact attribute no longer exported via API"
  https://bugs.launchpad.net/launchpad/+bug/1051132

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/export-security_contact-for-1.0/+merge/125092

During the death of IHasSecurityContact it was removed from every API version. This had the side effect of breaking users scripts. Resurrect security_contact for IProduct for 1.0 only. I did not want to resurrect IHasSecurityContact, so it's still dead on IDistribution.
-- 
https://code.launchpad.net/~stevenk/launchpad/export-security_contact-for-1.0/+merge/125092
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/export-security_contact-for-1.0 into lp:launchpad.
=== modified file 'lib/lp/registry/interfaces/product.py'
--- lib/lp/registry/interfaces/product.py	2012-09-12 21:08:11 +0000
+++ lib/lp/registry/interfaces/product.py	2012-09-19 04:13:20 +0000
@@ -781,6 +781,12 @@
 
     packagings = Attribute(_("All the packagings for the project."))
 
+    security_contact = exported(
+        TextLine(
+            title=_('Security contact'), required=False, readonly=True,
+            description=_('Obsolete field for security contact')),
+            ('devel', dict(exported=False)), as_of='1.0')
+
     def checkPrivateBugsTransitionAllowed(private_bugs, user):
         """Can the private_bugs attribute be changed to the value by the user?
 

=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py	2012-09-13 16:07:03 +0000
+++ lib/lp/registry/model/product.py	2012-09-19 04:13:20 +0000
@@ -409,6 +409,10 @@
         pass
 
     @property
+    def security_contact(self):
+        return None
+
+    @property
     def pillar(self):
         """See `IBugTarget`."""
         return self

=== modified file 'lib/lp/registry/tests/test_product_webservice.py'
--- lib/lp/registry/tests/test_product_webservice.py	2012-08-29 03:19:38 +0000
+++ lib/lp/registry/tests/test_product_webservice.py	2012-09-19 04:13:20 +0000
@@ -103,3 +103,18 @@
                 body=('A current commercial subscription is required to use '
                       'proprietary bugs.')))
         self.assertIs(None, product.bug_sharing_policy)
+
+    def fetch_product(self, webservice, product, api_version):
+        return webservice.get(
+            canonical_url(product, force_local_path=True),
+            api_version=api_version).jsonBody()
+
+    def test_security_contact_exported(self):
+        # security_contact is exported for 1.0, but not for other versions.
+        product = self.factory.makeProduct()
+        webservice = webservice_for_person(product.owner)
+        api_prod = self.fetch_product(webservice, product, '1.0')
+        self.assertEqual(None, api_prod['security_contact'])
+        for api_version in ('beta', 'devel'):
+            api_prod = self.fetch_product(webservice, product, api_version)
+            self.assertFalse(api_prod.has_key('security_contact'))


Follow ups