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

[errorpages] #176

Closed
microniko opened this issue Oct 9, 2016 · 12 comments
Closed

[errorpages] #176

microniko opened this issue Oct 9, 2016 · 12 comments

Comments

@microniko
Copy link

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
Copy link
Contributor

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
Copy link
Author

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

@felixfontein
Copy link
Contributor

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
Copy link
Member

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 #176.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#176 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAT-m01oDsrUrLJgQdZPPw1uKfddT8I-ks5qydeCgaJpZM4KSHLD
.

@felixfontein
Copy link
Contributor

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

@microniko
Copy link
Author

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_for_callable(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 exec_template
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
Copy link
Contributor

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

@felixfontein
Copy link
Contributor

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
Copy link
Member

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
Copy link
Contributor

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

@microniko
Copy link
Author

microniko commented Oct 23, 2016

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

@Kwpolska
Copy link
Member

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

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

3 participants