From 356f9f943a34c6d059fec8fcea43b377a977f55c Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 19 Nov 2013 09:18:41 -0500 Subject: examples: Use new __default__ magic in TemplateHelper example --- examples/TemplateHelper/include.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/TemplateHelper/include.py b/examples/TemplateHelper/include.py index be0034f52..fcdb42ac9 100644 --- a/examples/TemplateHelper/include.py +++ b/examples/TemplateHelper/include.py @@ -5,14 +5,13 @@ Synopsis: {% python import os - include = metadata.TemplateHelper['include'] - custom = include.IncludeHelper(metadata, path).files(os.path.basename(name)) + custom = IncludeHelper(metadata, path).files(os.path.basename(name)) %}\ {% for file in custom %}\ - ########## Start ${include.describe_specificity(file)} ########## + ########## Start ${describe_specificity(file)} ########## {% include ${file} %} - ########## End ${include.describe_specificity(file)} ########## + ########## End ${describe_specificity(file)} ########## {% end %}\ This would let you include files with the same base name; e.g. in a @@ -20,7 +19,7 @@ template for ''foo.conf'', the include files would be called ''foo.conf.G_.genshi_include''. If a template needs to include different files in different places, you can do that like so: - inc = metadata.TemplateHelper['include'].IncludeHelper(metadata, path) + inc = IncludeHelper(metadata, path) custom_bar = inc.files("bar") custom_baz = inc.files("baz") @@ -33,7 +32,7 @@ from ''baz.conf.G_.genshi_include''. import os import re -__export__ = ["IncludeHelper", "get_specificity", "describe_specificity"] +__default__ = ["IncludeHelper", "get_specificity", "describe_specificity"] class IncludeHelper(object): -- cgit v1.2.3-1-g7c22