← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/branch-privacy-properties into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/branch-privacy-properties into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #933768 in Launchpad itself: "Update branch to use information_visibility_policy"
  https://bugs.launchpad.net/launchpad/+bug/933768

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/branch-privacy-properties/+merge/109987

As the first step to weaning our code off Branch.private and Branch.transitively_private, shift them to be properties, and leave the columns protected by underscores.
-- 
https://code.launchpad.net/~stevenk/launchpad/branch-privacy-properties/+merge/109987
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/branch-privacy-properties into lp:launchpad.
=== modified file 'lib/lp/code/model/branch.py'
--- lib/lp/code/model/branch.py	2012-06-06 23:34:24 +0000
+++ lib/lp/code/model/branch.py	2012-06-13 06:51:20 +0000
@@ -187,15 +187,24 @@
 
     # This attribute signifies whether *this* branch is private, irrespective
     # of the state of any stacked on branches.
-    explicitly_private = BoolCol(
+    _explicitly_private = BoolCol(
         default=False, notNull=True, dbName='private')
     # A branch is transitively private if it is private or it is stacked on a
     # transitively private branch. The value of this attribute is maintained
     # by a database trigger.
-    transitively_private = BoolCol(dbName='transitively_private')
+    _transitively_private = BoolCol(dbName='transitively_private')
     information_type = EnumCol(
         enum=InformationType, default=InformationType.PUBLIC)
 
+    # These can die after the UI is dropped.
+    @property
+    def explicitly_private(self):
+        return self.information_type in PRIVATE_INFORMATION_TYPES
+
+    @property
+    def transitively_private(self):
+        return self.explicitly_private
+
     @property
     def private(self):
         return self.information_type in PRIVATE_INFORMATION_TYPES
@@ -242,13 +251,13 @@
         self.information_type = information_type
         self._reconcileAccess()
         # Set the legacy values for now.
-        self.explicitly_private = private
+        self._explicitly_private = private
         # If this branch is private, then it is also transitively_private
         # otherwise we need to reload the value.
         if private:
-            self.transitively_private = True
+            self._transitively_private = True
         else:
-            self.transitively_private = AutoReload
+            self._transitively_private = AutoReload
 
     registrant = ForeignKey(
         dbName='registrant', foreignKey='Person',


Follow ups