Cleaned up some outdated libbe.settings_object.EMPTY cruft.
authorW. Trevor King <wking@drexel.edu>
Mon, 20 Jul 2009 22:39:31 +0000 (18:39 -0400)
committerW. Trevor King <wking@drexel.edu>
Mon, 20 Jul 2009 22:39:31 +0000 (18:39 -0400)
From back before commit
  wking@drexel.edu-20090619184215-nfx205yaj02sqrqx
cleaned up the versioned_property implementation.

Also a few style fixes and typos.

libbe/bug.py
libbe/bugdir.py
libbe/comment.py
libbe/properties.py

index f5f479c588f311284054646266dc166bbd6dcbc4..8be6010b89f0d2baf5db1abd248130d8dd30756c 100644 (file)
@@ -177,7 +177,7 @@ class Bug(settings_object.SavedSettingsObject):
     def time_string(): return {}
 
     def _get_time(self):
-        if self.time_string in [None, settings_object.EMPTY]:
+        if self.time_string == None:
             return None
         return utility.str_to_time(self.time_string)
     def _set_time(self, value):
@@ -254,10 +254,9 @@ class Bug(settings_object.SavedSettingsObject):
 
     def _setting_attr_string(self, setting):
         value = getattr(self, setting)
-        if value in [None, settings_object.EMPTY]:
+        if value == None:
             return ""
-        else:
-            return str(value)
+        return str(value)
 
     def xml(self, show_comments=False):
         if self.bugdir == None:
index 764e449bdbe56d4010c2b027e78dc588f300f661..e37db81e902f8836b2b9834902e1ba4f2ae90e3e 100644 (file)
@@ -141,10 +141,11 @@ class BugDir (list, settings_object.SavedSettingsObject):
     def _guess_encoding(self):
         return encoding.get_encoding()
     def _check_encoding(value):
-        if value != None and value != settings_object.EMPTY:
+        if value != None:
             return encoding.known_encoding(value)
     def _setup_encoding(self, new_encoding):
-        if new_encoding != None and new_encoding != settings_object.EMPTY:
+        # change hook called before generator.
+        if new_encoding not in [None, settings_object.EMPTY]:
             if self._manipulate_encodings == True:
                 encoding.set_IO_stream_encodings(new_encoding)
     def _set_encoding(self, old_encoding, new_encoding):
@@ -222,7 +223,7 @@ settings easy.  Don't set this attribute.  Set .rcs instead, and
     def _bug_map(): return {}
 
     def _setup_severities(self, severities):
-        if severities != None and severities != settings_object.EMPTY:
+        if severities not in [None, settings_object.EMPTY]:
             bug.load_severities(severities)
     def _set_severities(self, old_severities, new_severities):
         self._setup_severities(new_severities)
index e2f4ba7f936ef06f818c7c013a7e2ff58814c90d..60cccff2bdec7abf82c5da60875fc42789413ba5 100644 (file)
@@ -258,10 +258,9 @@ class Comment(Tree, settings_object.SavedSettingsObject):
 
     def _setting_attr_string(self, setting):
         value = getattr(self, setting)
-        if value in [None, settings_object.EMPTY]:
+        if value == None:
             return ""
-        else:
-            return str(value)
+        return str(value)
 
     def xml(self, indent=0, shortname=None):
         """
index e9affcb0e2369e7f43492758db1694e432ca4c05..8c039b220ff1821b29834f43cbc323c61c3a2dbb 100644 (file)
@@ -296,7 +296,7 @@ def cached_property(generator, initVal=None, mutable=False):
 
 def primed_property(primer, initVal=None):
     """
-    Just like a generator_property, except that instead of returning a
+    Just like a cached_property, except that instead of returning a
     new value and running fset to cache it, the primer performs some
     background manipulation (e.g. loads data into instance.settings)
     such that a _second_ pass through fget succeeds.