From 06c639db6b98affab4abf07e57a90e2fcb5402ef Mon Sep 17 00:00:00 2001 From: rcoh Date: Sat, 5 Feb 2011 22:34:34 -0500 Subject: Early stages of param-binding in xml. Functional. RCOH --- operationscore/SmootCoreObject.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'operationscore') diff --git a/operationscore/SmootCoreObject.py b/operationscore/SmootCoreObject.py index 0d32773..51b84e3 100644 --- a/operationscore/SmootCoreObject.py +++ b/operationscore/SmootCoreObject.py @@ -2,6 +2,7 @@ import pdb import threading import thread import util.Config as configGetter +import types class SmootCoreObject(object): """SmootCoreObject is essentially a super-object class which grants us some niceties. It allows @@ -34,9 +35,13 @@ class SmootCoreObject(object): def __setitem__(self,k, item): self.argDict[k] = item - def __getitem__(self, item): - if item in self.argDict: - return self.argDict[item] + def __getitem__(self, key): + if key in self.argDict: + item = self.argDict[key] + if isinstance(item, types.FunctionType): + return item(self.argDict) #resolve the lambda function, if it exists + else: + return item else: return None def __contains__(self, item): -- cgit v1.2.3