summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblob8108 <spaaam42@gmail.com>2014-01-07 01:24:17 +0000
committerblob8108 <spaaam42@gmail.com>2014-01-07 01:24:17 +0000
commit78195c3ebf9b2b4857fcb64952cbce14a9763aa2 (patch)
treeb5880df0268aed0f0372c3c4a96c0dfae643cb65
parentf87dfae3ebe094b00448f7cc28d9e9df29bbf947 (diff)
downloadblockext-78195c3ebf9b2b4857fcb64952cbce14a9763aa2.tar.gz
blockext-78195c3ebf9b2b4857fcb64952cbce14a9763aa2.zip
Allow Blockext vars in block text
-rw-r--r--blockext/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/blockext/__init__.py b/blockext/__init__.py
index 6f3eede..c1779a5 100644
--- a/blockext/__init__.py
+++ b/blockext/__init__.py
@@ -227,7 +227,7 @@ class Block(object):
if blocking and shape != "command":
raise ValueError("only commands can be blocking")
- self.text = text
+ self._text = text
self.shape = shape
self.func = func
self.is_blocking = blocking
@@ -247,6 +247,10 @@ class Block(object):
shape_defaults = map(Block.INPUT_DEFAULTS.get, self.arg_shapes)
self.defaults = [a or b for (a, b) in zip(defaults, shape_defaults)]
+ @property
+ def text(self):
+ return self._text.format(**vars(Blockext))
+
def __repr__(self):
return "<Block(%r)>" % self.text