aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/properties.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-07-27 08:12:16 -0400
committerW. Trevor King <wking@drexel.edu>2009-07-27 08:12:16 -0400
commit675aa10516d1fe2a5f0502be5553e38169f444c0 (patch)
treecb19b2ee621cd1120ae9afdafe6f52ee70137a32 /libbe/properties.py
parent885b04b50ad3bbde81ec2eccfbfb2e516d0d3a80 (diff)
parent7f2ee356b76303edd01efad6bd049fbc7f01b5ff (diff)
downloadbugseverywhere-675aa10516d1fe2a5f0502be5553e38169f444c0.tar.gz
Merged "be subscribe" and be-handle-mail subscription support.
Also assorted other changes and fixes in the be.subscribe branch. Highlights: * Much more powerful libbe.diff with subclassable report generators. * "be diff" compares working copy with last commit by default. * comment reference text shown in "be comment" EDITOR footer * .revision_id() for all VCSs * meaningful comment comparison and stricter bug comparison * stricter .sync_with_disk interpretation. See BugDir.__doc__. * Comment.From and .time_string -> .author and .date, for better conformance with settings_object.setting_name_to_attr_name().
Diffstat (limited to 'libbe/properties.py')
-rw-r--r--libbe/properties.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/libbe/properties.py b/libbe/properties.py
index 144220b..09dd20e 100644
--- a/libbe/properties.py
+++ b/libbe/properties.py
@@ -160,10 +160,10 @@ def _get_cached_mutable_property(self, cacher_name, property_name, default=None)
if (cacher_name, property_name) not in self._mutable_property_cache_copy:
return default
return self._mutable_property_cache_copy[(cacher_name, property_name)]
-def _cmp_cached_mutable_property(self, cacher_name, property_name, value):
+def _cmp_cached_mutable_property(self, cacher_name, property_name, value, default=None):
_init_mutable_property_cache(self)
if (cacher_name, property_name) not in self._mutable_property_cache_hash:
- return 1 # any value > non-existant old hash
+ _set_cached_mutable_property(self, cacher_name, property_name, default)
old_hash = self._mutable_property_cache_hash[(cacher_name, property_name)]
return cmp(_hash_mutable_value(value), old_hash)
@@ -327,7 +327,7 @@ def primed_property(primer, initVal=None):
return funcs
return decorator
-def change_hook_property(hook, mutable=False):
+def change_hook_property(hook, mutable=False, default=None):
"""
Call the function hook(instance, old_value, new_value) whenever a
value different from the current value is set (instance is a a
@@ -359,9 +359,9 @@ def change_hook_property(hook, mutable=False):
value = new_value # compare new value with cached
else:
value = fget(self) # compare current value with cached
- if _cmp_cached_mutable_property(self, "change hook property", name, value) != 0:
+ if _cmp_cached_mutable_property(self, "change hook property", name, value, default) != 0:
# there has been a change, cache new value
- old_value = _get_cached_mutable_property(self, "change hook property", name)
+ old_value = _get_cached_mutable_property(self, "change hook property", name, default)
_set_cached_mutable_property(self, "change hook property", name, value)
if from_fset == True: # return previously cached value
value = old_value