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

TemplateModule has no attribute open_graph_metadata #1363

Closed
bnmnetp opened this issue Jul 18, 2014 · 4 comments
Closed

TemplateModule has no attribute open_graph_metadata #1363

bnmnetp opened this issue Jul 18, 2014 · 4 comments
Assignees
Milestone

Comments

@bnmnetp
Copy link
Contributor

bnmnetp commented Jul 18, 2014

I get this error when trying to render with the ipython theme. Various Mako based themes seem to work fine with the same source files.

TaskError - taskid:render_pages:output/posts/2011/03/cruise-wrapup-part-i.html
PythonAction Error
Traceback (most recent call last):
  File "/Users/bmiller/Environments/nikola3/lib/python3.4/site-packages/doit/action.py", line 360, in execute
    returned_value = self.py_callable(*self.args, **kwargs)
  File "/Users/bmiller/Environments/nikola3/lib/python3.4/site-packages/nikola/nikola.py", line 769, in render_template
    template_name, None, local_context)
  File "/Users/bmiller/Environments/nikola3/lib/python3.4/site-packages/nikola/plugins/template/jinja.py", line 88, in render_template
    output = template.render(**context)
  File "/Users/bmiller/Environments/nikola3/lib/python3.4/site-packages/jinja2/environment.py", line 969, in render
    return self.environment.handle_exception(exc_info, True)
  File "/Users/bmiller/Environments/nikola3/lib/python3.4/site-packages/jinja2/environment.py", line 742, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/bmiller/Environments/nikola3/lib/python3.4/site-packages/jinja2/_compat.py", line 36, in reraise
    raise value.with_traceback(tb)
  File "themes/ipython/templates/post.tmpl", line 5, in <module>
    {% extends 'base.tmpl' %}
  File "themes/bootstrap3-jinja/templates/base.tmpl", line 6, in <module>
    {% block extra_head %}
  File "themes/ipython/templates/post.tmpl", line 13, in <module>
    {{ helper.open_graph_metadata(post) }}
jinja2.exceptions.UndefinedError: 'jinja2.environment.TemplateModule object' has no attribute 'open_graph_metadata'
@Kwpolska Kwpolska self-assigned this Jul 19, 2014
@Kwpolska Kwpolska added this to the v7.0.2 milestone Jul 19, 2014
@Kwpolska
Copy link
Member

I assume you just upgraded to Nikola v7. In which case, you should

rm -rf themes/ipython themes/boostrap3-jinja themes/base-jinja
nikola install_theme ipython

@Suleman-Elahi
Copy link

Suleman-Elahi commented Jan 7, 2023

Faced the same error after installing the Srcco.de theme.

After installing the theme when I issue 'build' command, the same errors is shown.

(nikola) PS D:\nikola\site> nikola theme -i srcco.de
[2023-01-07 12:50:33] INFO: theme: Downloading 'https://themes.getnikola.com/v7/srcco.de.zip'
[2023-01-07 12:50:33] INFO: theme: Extracting 'srcco.de' into themes/
[2023-01-07 12:50:33] INFO: theme: Remember to set THEME="srcco.de" in conf.py to use this theme.
(nikola) PS D:\nikola\site> nikola build
Scanning posts........done!
.  render_galleries:output\galleries\index.html
.  render_galleries:output\galleries\rss.xml
.  render_galleries:output\galleries\demo\index.html
TaskError - taskid:render_galleries:output\galleries\demo\index.html
PythonAction Error
Traceback (most recent call last):
  File "D:\nikola\lib\site-packages\doit\action.py", line 461, in execute
    returned_value = self.py_callable(*self.args, **kwargs)
  File "D:\nikola\lib\site-packages\nikola\plugins\task\galleries.py", line 717, in render_gallery_index
    self.site.render_template(template_name, output_name, context)
  File "D:\nikola\lib\site-packages\nikola\nikola.py", line 1487, in render_template
    data = self.template_system.render_template(
  File "D:\nikola\lib\site-packages\nikola\plugins\template\jinja.py", line 98, in render_template
    data = template.render(**context)
  File "D:\nikola\lib\site-packages\jinja2\environment.py", line 1301, in render
    self.environment.handle_exception()
  File "D:\nikola\lib\site-packages\jinja2\environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "D:\nikola\lib\site-packages\nikola\data\themes\base-jinja\templates\gallery.tmpl", line 5, in top-level template code
    {% import 'post_helper.tmpl' as post_helper with context %}
  File "themes\srcco.de\templates\base.tmpl", line 9, in top-level template code
    {% block extra_head %}
  File "D:\nikola\lib\site-packages\nikola\data\themes\base-jinja\templates\gallery.tmpl", line 77, in block 'extra_head'    {{ post_helper.open_graph_metadata(post) }}
  File "D:\nikola\lib\site-packages\jinja2\utils.py", line 83, in from_obj
    if hasattr(obj, "jinja_pass_arg"):
jinja2.exceptions.UndefinedError: 'jinja2.environment.TemplateModule object' has no attribute 'open_graph_metadata'

########################################
render_galleries:output\galleries\demo\index.html <stdout>:

How to fix this.

@Kwpolska
Copy link
Member

Kwpolska commented Jan 7, 2023

@Suleman-Elahi This looks like a bug in the theme. Please report bugs for themes in the nikola-themes repo instead of commenting on a mostly unrelated 8-year-old issue.

@Suleman-Elahi
Copy link

Oh sorry didn't know. I posted here because of the same error.

posted: getnikola/nikola-themes#214

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants