Browse Source

Added more log messages and fixed an issue with meta plugin for files that contain only meta data

main
Lakshmi Vyasarajan 13 years ago
parent
commit
e769c88eda
3 changed files with 14 additions and 4 deletions
  1. +3
    -0
      hyde/ext/plugins/auto_extend.py
  2. +2
    -2
      hyde/ext/plugins/meta.py
  3. +9
    -2
      hyde/ext/templates/jinja.py

+ 3
- 0
hyde/ext/plugins/auto_extend.py View File

@@ -23,6 +23,7 @@ class AutoExtendPlugin(Plugin):

if not resource.uses_template:
return text

layout = None
block = None
try:
@@ -36,6 +37,8 @@ class AutoExtendPlugin(Plugin):
pass

if layout:
self.logger.debug("Autoextending %s with %s" % (
resource.relative_path, layout))
extends_pattern = self.template.patterns['extends']

if not re.search(extends_pattern, text):


+ 2
- 2
hyde/ext/plugins/meta.py View File

@@ -78,7 +78,7 @@ class MetaPlugin(Plugin):
"""
self.logger.info("Trying to load metadata from resource [%s]" % resource)
yaml_finder = re.compile(
r"^\s*(?:---|===)\s*\n((?:.|\n)+?)\n\s*(?:---|===)\s*\n?",
r"^\s*(?:---|===)\s*\n((?:.|\n)+?)\n\s*(?:---|===)\s*\n*",
re.MULTILINE)
match = re.match(yaml_finder, text)
if not match:
@@ -97,7 +97,7 @@ class MetaPlugin(Plugin):
self.__update_standard_attributes__(resource)
self.logger.info("Successfully loaded metadata from resource [%s]"
% resource)
return text
return text or ' '

def __update_standard_attributes__(self, obj):
"""


+ 9
- 2
hyde/ext/templates/jinja.py View File

@@ -581,8 +581,15 @@ class Jinja2Template(Template):
"""
Renders the given resource using the context
"""
template = self.env.get_template(resource.relative_path)
return template.render(context)
try:
template = self.env.get_template(resource.relative_path)
out = template.render(context)
except:
out = ""
logger.debug(self.env.loader.get_source(
self.env, resource.relative_path))
raise
return out

def render(self, text, context):
"""


Loading…
Cancel
Save