From: W. Trevor King Date: Mon, 20 Jul 2009 22:39:31 +0000 (-0400) Subject: Cleaned up some outdated libbe.settings_object.EMPTY cruft. X-Git-Tag: 1.0.0~63^2~18 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9ef6ad576c01444e35b91dfee8d05b39ec911d45;p=be.git Cleaned up some outdated libbe.settings_object.EMPTY cruft. From back before commit wking@drexel.edu-20090619184215-nfx205yaj02sqrqx cleaned up the versioned_property implementation. Also a few style fixes and typos. --- diff --git a/libbe/bug.py b/libbe/bug.py index f5f479c..8be6010 100644 --- a/libbe/bug.py +++ b/libbe/bug.py @@ -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: diff --git a/libbe/bugdir.py b/libbe/bugdir.py index 764e449..e37db81 100644 --- a/libbe/bugdir.py +++ b/libbe/bugdir.py @@ -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) diff --git a/libbe/comment.py b/libbe/comment.py index e2f4ba7..60cccff 100644 --- a/libbe/comment.py +++ b/libbe/comment.py @@ -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): """ diff --git a/libbe/properties.py b/libbe/properties.py index e9affcb..8c039b2 100644 --- a/libbe/properties.py +++ b/libbe/properties.py @@ -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.