aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/bug.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2011-05-12 08:41:25 -0400
committerW. Trevor King <wking@drexel.edu>2011-05-12 08:52:47 -0400
commitb3a21311f816a6f5ac91c1d7b94868e42ad42c1c (patch)
tree24271e51a9f1dad0a301990c8f8586d8fc63334c /libbe/bug.py
parent463e44ac93834de237d71ffb1fdd490a649b59aa (diff)
downloadbugseverywhere-b3a21311f816a6f5ac91c1d7b94868e42ad42c1c.tar.gz
Cache Bug.time by hand to avoid lots of redundant calls to str_to_time.
Diffstat (limited to 'libbe/bug.py')
-rw-r--r--libbe/bug.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/libbe/bug.py b/libbe/bug.py
index 8b4b130..47e4b67 100644
--- a/libbe/bug.py
+++ b/libbe/bug.py
@@ -194,10 +194,19 @@ class Bug (settings_object.SavedSettingsObject):
def _get_time(self):
if self.time_string == None:
+ self._cached_time_string = None
+ self._cached_time = None
return None
- return utility.str_to_time(self.time_string)
+ if (not hasattr(self, '_cached_time_string')
+ or self.time_string != self._cached_time_string):
+ self._cached_time_string = self.time_string
+ self._cached_time = utility.str_to_time(self.time_string)
+ return self._cached_time
def _set_time(self, value):
- self.time_string = utility.time_to_str(value)
+ if not hasattr(self, '_cached_time') or value != self._cached_time:
+ self.time_string = utility.time_to_str(value)
+ self._cached_time_string = self.time_string
+ self._cached_time = value
time = property(fget=_get_time,
fset=_set_time,
doc="An integer version of .time_string")