diff --git a/hyde/ext/templates/jinja.py b/hyde/ext/templates/jinja.py index a9be6dd..1133307 100644 --- a/hyde/ext/templates/jinja.py +++ b/hyde/ext/templates/jinja.py @@ -266,8 +266,12 @@ class Refer(Extension): includeNode.template = template return [ - nodes.Assign(nodes.Name(MARKINGS, 'store'), nodes.Const({})).set_lineno(lineno), - nodes.Assign(nodes.Name(namespace, 'store'), nodes.Const({})).set_lineno(lineno), + nodes.Assign( + nodes.Name(MARKINGS, 'store'), + nodes.Const({})).set_lineno(lineno), + nodes.Assign( + nodes.Name(namespace, 'store'), + nodes.Const({})).set_lineno(lineno), nodes.CallBlock( self.call_method('_push_resource', args=[ @@ -276,8 +280,11 @@ class Refer(Extension): nodes.Name('resource', 'load'), template]), [], [], []).set_lineno(lineno), - nodes.Assign(nodes.Name('resource', 'store'), - nodes.Getitem(nodes.Name(namespace, 'load'), nodes.Const('current_resource'), 'load')).set_lineno(lineno), + nodes.Assign( + nodes.Name('resource', 'store'), + nodes.Getitem(nodes.Name(namespace, 'load'), + nodes.Const('resource'), 'load') + ).set_lineno(lineno), nodes.CallBlock( self.call_method('_assign_reference', args=[ @@ -285,12 +292,14 @@ class Refer(Extension): nodes.Name(namespace, 'load')]), [], [], [includeNode]).set_lineno(lineno), nodes.Assign(nodes.Name('resource', 'store'), - nodes.Getitem(nodes.Name(namespace, 'load'), nodes.Const('parent_resource'), 'load')).set_lineno(lineno), + nodes.Getitem(nodes.Name(namespace, 'load'), + nodes.Const('parent_resource'), 'load') + ).set_lineno(lineno), ] def _push_resource(self, namespace, site, resource, template, caller): namespace['parent_resource'] = resource - namespace['current_resource'] = site.content.resource_from_relative_path(template) + namespace['resource'] = site.content.resource_from_relative_path(template) return '' def _assign_reference(self, markings, namespace, caller): diff --git a/hyde/model.py b/hyde/model.py index 8ad92c5..06269a7 100644 --- a/hyde/model.py +++ b/hyde/model.py @@ -19,6 +19,13 @@ class Expando(object): super(Expando, self).__init__() self.update(d) + def __iter__(self): + """ + Returns an iterator for all the items in the + dictionary as key value pairs. + """ + return self.__dict__.iteritems() + def update(self, d): """ Updates the expando with a new dictionary