Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render_excerpt fails (inc patch) #21

Open
hugovincent opened this issue Feb 21, 2010 · 0 comments
Open

render_excerpt fails (inc patch) #21

hugovincent opened this issue Feb 21, 2010 · 0 comments

Comments

@hugovincent
Copy link

The following issue:

INFO:Processing /blog/[2010-02-21 22:09:24,468]
***********************
Error while rendering page /blog/
***********************
Generation Failed
(<type 'exceptions.AttributeError'>, AttributeError("'SafeUnicode' object has no attribute 'render'",), <traceback object at 0x1013c9f38>)

Was fixed with the following patch:
diff --git a/hydeengine/templatetags/hydetags.py b/hydeengine/templatetags/hydetags.py
index aec60ed..88a33e4 100644
--- a/hydeengine/templatetags/hydetags.py
+++ b/hydeengine/templatetags/hydetags.py
@@ -39,7 +39,7 @@ def excerpt(parser, token):
return BracketNode("Excerpt", nodelist)

 @register.tag(name="article")
-def excerpt(parser, token):
+def article(parser, token):
     nodelist = parser.parse(('endarticle',))
     parser.delete_first_token()
     return BracketNode("Article", nodelist)
@@ -63,8 +63,6 @@ class LatestExcerptNode(template.Node):

     def render(self, context):
         sitemap_node = None
-        if not self.words == 50:
-            self.words = self.words.render(context)
         self.path = self.path.render(context).strip('"')
         sitemap_node = context["site"].find_node(Folder(self.path))
         if not sitemap_node:
@@ -154,7 +152,7 @@ def latest_excerpt(parser, token):
     if len(tokens) > 1:
         path = Template(tokens[1])
     if len(tokens) > 2:
-        words = Template(tokens[2])
+        words = int(tokens[2])
     return LatestExcerptNode(path, words)

 @register.tag(name="render_excerpt")    
@@ -165,7 +163,7 @@ def render_excerpt(parser, token):
     if len(tokens) > 1:
         path = parser.compile_filter(tokens[1])
     if len(tokens) > 2:
-        words = Template(tokens[2])
+        words = int(tokens[2])
     return RenderExcerptNode(path, words)

 @register.tag(name="render_article")    
@@ -182,8 +180,6 @@ class RenderExcerptNode(template.Node):
         self.words = words

     def render(self, context):
-        if not self.words == 50:
-            self.words = self.words.render(context)
         page = self.page.resolve(context)
         context["excerpt_url"] = page.url
         context["excerpt_title"] = page.title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant