getnikola / plugins

Extra plugins for Nikola
https://plugins.getnikola.com/
MIT License
59 stars 95 forks source link

[errorpages] #176

Closed microniko closed 7 years ago

microniko commented 8 years ago

I install errorpages plugins but when I compiled the website, I have this error :

$ nikola build Scanning posts......done! Traceback (most recent call last): File "/home/nicolas/envvirt/nikola/lib/python3.5/site-packages/doit/doit_cmd.py", line 168, in run return command.parse_execute(args) File "/home/nicolas/envvirt/nikola/lib/python3.5/site-packages/doit/cmd_base.py", line 122, in parse_execute return self.execute(params, args) File "/home/nicolas/envvirt/nikola/lib/python3.5/site-packages/doit/cmd_base.py", line 380, in execute self, params, args) File "/home/nicolas/envvirt/nikola/lib/python3.5/site-packages/nikola/main.py", line 279, in load_tasks self.nikola.gen_tasks('render_site', "Task", 'Group of tasks to render the site.')) File "/home/nicolas/envvirt/nikola/lib/python3.5/site-packages/doit/loader.py", line 314, in generate_tasks for task_dict, x_doc in flat_generator(gen_result, gen_doc): File "/home/nicolas/envvirt/nikola/lib/python3.5/site-packages/doit/loader.py", line 28, in flat_generator for item in gen: File "/home/nicolas/envvirt/nikola/lib/python3.5/site-packages/nikola/nikola.py", line 1795, in gen_tasks for task in flatten(pluginInfo.plugin_object.gen_tasks()): File "/home/nicolas/envvirt/nikola/lib/python3.5/site-packages/nikola/nikola.py", line 1790, in flatten for ft in flatten(t): File "/home/nicolas/envvirt/nikola/lib/python3.5/site-packages/nikola/nikola.py", line 1789, in flatten for t in task: File "/home/nicolas/repo_site/plugins/errorpages/errorpages.py", line 117, in prepare_error_page task = self.site.generic_renderer(lang, destination, template, self.site.config["FILTERS"], context=context, url_type=url_type) AttributeError: 'Nikola' object has no attribute 'generic_renderer'

What happens ?!

felixfontein commented 8 years ago

The plugin depends on a feature in Nikola which was just merged into master yesterday (that implemented generic_renderer). You need to install the master branch from GitHub, or it doesn't work at the moment. (Also see the last paragraph in https://github.com/getnikola/plugins/blob/master/v7/errorpages/README.md.)

microniko commented 8 years ago

Ok, thanks ! I'll wait the next release… (404 error ;)

felixfontein commented 8 years ago

Waiting is definitely less hassle (if you don't want to hack on Nikola anyway)... I don't know what the current release plans are, but usually it's not too long.

Kwpolska commented 8 years ago

I'll attempt a release later this week.

Chris Warrick https://chriswarrick.com/

On 10 Oct 2016 08:13, "Felix Fontein" notifications@github.com wrote:

Closed #176 https://github.com/getnikola/plugins/issues/176.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/getnikola/plugins/issues/176#event-817611695, or mute the thread https://github.com/notifications/unsubscribe-auth/AAT-m01oDsrUrLJgQdZPPw1uKfddT8I-ks5qydeCgaJpZM4KSHLD .

felixfontein commented 8 years ago

Nikola 7.8.1 is released now, so errorpages should now work out of the box. :)

microniko commented 8 years ago

Woaw :-( I updated Nikola to 7.8.1 but errorpages does not still work …

$ nikola build Scanning posts......done! . errorpages:output/404.html ######################################## TaskError - taskid:errorpages:output/404.html PythonAction Error Traceback (most recent call last): File "/home/toto/envvirt/nikola/lib/python3.5/site-packages/doit/action.py", line 383, in execute returned_value = self.py_callable(_self.args, _kwargs) File "/home/toto/envvirt/nikola/lib/python3.5/site-packages/nikola/nikola.py", line 1318, in render_template template_name, None, local_context) File "/home/toto/envvirt/nikola/lib/python3.5/site-packages/nikola/plugins/template/mako.py", line 117, in render_template data = template.render_unicode(_context) File "/home/toto/envvirt/nikola/lib/python3.5/site-packages/mako/template.py", line 454, in render_unicode as_unicode=True) File "/home/toto/envvirt/nikola/lib/python3.5/site-packages/mako/runtime.py", line 829, in _render __kwargs_forcallable(callable, data)) File "/home/toto/envvirt/nikola/lib/python3.5/site-packages/mako/runtime.py", line 864, in _render_context _exec_template(inherit, lclcontext, args=args, kwargs=kwargs) File "/home/toto/envvirt/nikola/lib/python3.5/site-packages/mako/runtime.py", line 890, in _exectemplate callable(context, _args, _kwargs) File "/home/toto/site/www/cache/.mako.tmp/base.tmpl.py", line 64, in render_body __M_writer(str(base.html_headstart())) File "/home/toto/site/www/cache/.mako.tmp/base_helper.tmpl.py", line 241, in render_html_headstart __M_writer(str(url_replacer(permalink, '/assets/js/html5.js', lang))) File "/home/toto/envvirt/nikola/lib/python3.5/site-packages/nikola/nikola.py", line 1370, in url_replacer src_elems = parsed_src.path.split('/')[1:] TypeError: a bytes-like object is required, not 'str'

felixfontein commented 8 years ago

Looks like some problem with the default theme. I don't use the default theme so I never experienced that.

felixfontein commented 8 years ago

Looks like the default base plugin does some weird stuff with url_replacer and tries to insert relative links, which will obviously not work with error pages. What a mess. Also, it expects that every page has permalink set to the URL for the current page, which this plugin doesn't do.

Kwpolska commented 8 years ago

You could work around the first issue by passing url_type to templates, and the second one by checking for permalink not being None, I guess. (Both are global changes to Nikola core. Speaking of which, getnikola/nikola#2544 could use a review)

felixfontein commented 8 years ago

@microniko: the issue is now fixed if you use Nikola's master branch and the updated plugin.

microniko commented 8 years ago

Thanks @felixfontein. But I tried with github version and I have the same problem with yesplease and bootstrap3 themes.

Kwpolska commented 7 years ago

Closing. If this still happens, we can always reopen.