From 78195c3ebf9b2b4857fcb64952cbce14a9763aa2 Mon Sep 17 00:00:00 2001 From: blob8108 Date: Tue, 7 Jan 2014 01:24:17 +0000 Subject: Allow Blockext vars in block text --- blockext/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 "" % self.text -- cgit v1.3.1