diff --git a/VERSION b/VERSION index 9eabb450..a3c25e38 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.6.0-development+timestamp.2013.08.27.16.11.32 +Version 2.6.0-development+timestamp.2013.08.27.16.17.15 diff --git a/gluon/template.py b/gluon/template.py index f5e579cf..bd68b157 100644 --- a/gluon/template.py +++ b/gluon/template.py @@ -434,6 +434,10 @@ class TemplateParser(object): # Get the filename; filename looks like ``"template.html"``. # We need to eval to remove the quotes and get the string type. filename = eval(filename, context) + + # Allow empty filename for conditional extend and include directives. + if not filename: + return '' # Get the path of the file on the system. filepath = self.path and os.path.join(self.path, filename) or filename @@ -468,7 +472,8 @@ class TemplateParser(object): Extend ``filename``. Anything not declared in a block defined by the parent will be placed in the parent templates ``{{include}}`` block. """ - text = self._get_file_text(filename) + # If no filename, create a dummy layout with only an {{include}}. + text = self._get_file_text(filename) or '%sinclude%s' % tuple(self.delimiters) # Create out nodes list to send to the parent super_nodes = []