diff options
| author | ianb <devnull@localhost> | 2007-06-13 03:00:26 +0000 |
|---|---|---|
| committer | ianb <devnull@localhost> | 2007-06-13 03:00:26 +0000 |
| commit | 2e66fbce02c51673f6fdbb6a7f17524fa24d6478 (patch) | |
| tree | bb9b9a33bfd22296f115e281704a14f54b46c156 /tests | |
| parent | ec2dc54ea78b8ebbe9e0d62d0aaa6386b81ba6cb (diff) | |
| download | paste-2e66fbce02c51673f6fdbb6a7f17524fa24d6478.tar.gz | |
Added {{default}} directive to paste.util.template
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_template.txt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_template.txt b/tests/test_template.txt index a56049f..7c66427 100644 --- a/tests/test_template.txt +++ b/tests/test_template.txt @@ -116,3 +116,17 @@ contains a directive/statement (if/for, etc):: 'x=1\n' >>> sub('{{if 1}}\nx={{x}}\n{{endif}}\n', x=1) 'x=1\n' + +Lastly, there is a special directive that will create a default value +for a variable, if no value is given:: + + >>> sub('{{default x=1}}{{x}}', x=2) + '2' + >>> sub('{{default x=1}}{{x}}') + '1' + >>> # The normal case: + >>> sub('{{x}}') + Traceback (most recent call last): + ... + NameError: name 'x' is not defined at line 1 column 3 + |
