[Checkins]
SVN: martian/branches/jw-philipp-using-ndir-directives/src/martian/ndir.py
Use setdefault for storing the values list.
Jan-Wijbrand Kolman
janwijbrand at gmail.com
Sat May 3 05:20:35 EDT 2008
Log message for revision 86156:
Use setdefault for storing the values list.
Changed:
U martian/branches/jw-philipp-using-ndir-directives/src/martian/ndir.py
-=-
Modified: martian/branches/jw-philipp-using-ndir-directives/src/martian/ndir.py
===================================================================
--- martian/branches/jw-philipp-using-ndir-directives/src/martian/ndir.py 2008-05-03 09:06:20 UTC (rev 86155)
+++ martian/branches/jw-philipp-using-ndir-directives/src/martian/ndir.py 2008-05-03 09:20:35 UTC (rev 86156)
@@ -35,9 +35,8 @@
def set(self, frame, directive, value):
dotted_name = (directive.__class__.__module__ + '.' +
directive.__class__.__name__)
- values = frame.f_locals.get(dotted_name, [])
+ values = frame.f_locals.setdefault(dotted_name, [])
values.append(value)
- frame.f_locals[dotted_name] = values
MULTIPLE = StoreMultipleTimes()
@@ -85,9 +84,11 @@
(self.name, self.scope.description))
self.check_factory_signature(*args, **kw)
+
validate = getattr(self, 'validate', None)
if validate is not None:
validate(*args, **kw)
+
value = self.factory(*args, **kw)
self.store.set(frame, self, value)
@@ -122,6 +123,7 @@
value = self.store.get(self, module, _USE_DEFAULT)
if value is _USE_DEFAULT:
value = self.get_default(component)
+
return value
More information about the Checkins
mailing list