aboutsummaryrefslogtreecommitdiffstats
path: root/libbe
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-06-23 19:59:50 -0400
committerW. Trevor King <wking@drexel.edu>2009-06-23 19:59:50 -0400
commit269778a3983bc56b02c921a306b257b18fe16c47 (patch)
treeba800382313e59bc23eee3ca1b297f3f3c595501 /libbe
parent1bf91af13020de706608293139f358e3a6712c72 (diff)
downloadbugseverywhere-269778a3983bc56b02c921a306b257b18fe16c47.tar.gz
Use generator instead of default for libbe.bug.Bug.extra_strings.
This avoids the problems associated with mutable defaults.
Diffstat (limited to 'libbe')
-rw-r--r--libbe/bug.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/libbe/bug.py b/libbe/bug.py
index 89c0266..0f912cf 100644
--- a/libbe/bug.py
+++ b/libbe/bug.py
@@ -185,6 +185,8 @@ class Bug(settings_object.SavedSettingsObject):
fset=_set_time,
doc="An integer version of .time_string")
+ def _extra_strings_generator(self):
+ return []
def _extra_strings_check_fn(value):
"Require an iterable full of strings"
if not hasattr(value, "__iter__"):
@@ -198,7 +200,7 @@ class Bug(settings_object.SavedSettingsObject):
self._prop_save_settings(old, new)
@_versioned_property(name="extra_strings",
doc="Space for an array of extra strings. Useful for storing state for functionality implemented purely in becommands/<some_function>.py.",
- default=[],
+ generator=_extra_strings_generator,
check_fn=_extra_strings_check_fn,
change_hook=_extra_strings_change_hook,
mutable=True)