getnikola / nikola

A static website and blog generator
https://getnikola.com/
MIT License
2.62k stars 450 forks source link

Fails to build with ipython-xkcd #1253

Closed bnmnetp closed 10 years ago

bnmnetp commented 10 years ago

Hi,

I did a clean install into a virtual environment using python3.4. Everything works fine with the defaults, but when I try to use the ipython-xkcd theme I get the following crash.

I thought it might be 3.4 related, so I installed in a python2.7 virtual environment and got the same error. Any ideas or workarounds?

TaskError - taskid:render_archive:output/2014/index.html
PythonAction Error
Traceback (most recent call last):
  File "/Users/bmiller/Environments/nikola27/lib/python2.7/site-packages/doit/action.py", line 360, in execute
    returned_value = self.py_callable(*self.args, **kwargs)
  File "/Users/bmiller/Environments/nikola27/lib/python2.7/site-packages/nikola/nikola.py", line 639, in render_template
    template_name, None, local_context)
  File "/Users/bmiller/Environments/nikola27/lib/python2.7/site-packages/nikola/plugins/template/jinja.py", line 74, in render_template
    output = template.render(**context)
  File "/Users/bmiller/Environments/nikola27/lib/python2.7/site-packages/jinja2/environment.py", line 969, in render
    return self.environment.handle_exception(exc_info, True)
  File "/Users/bmiller/Environments/nikola27/lib/python2.7/site-packages/jinja2/environment.py", line 742, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "themes/base-jinja/templates/list_post.tmpl", line 2, in top-level template code
    {% extends 'base.tmpl' %}
  File "themes/bootstrap-jinja/templates/base.tmpl", line 43, in top-level template code
    {{ bootstrap.html_navigation_links() }}
  File "themes/ipython-xkcd/templates/bootstrap_helper.tmpl", line 91, in template
    {% if rel_link(permalink, url) == "#" %}
  File "/Users/bmiller/Environments/nikola27/lib/python2.7/site-packages/nikola/nikola.py", line 901, in rel_link
    dst = urljoin(src, dst)
  File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urlparse.py", line 260, in urljoin
    urlparse(url, bscheme, allow_fragments)
  File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urlparse.py", line 142, in urlparse
    tuple = urlsplit(url, scheme, allow_fragments)
  File "/usr/local/Cellar/python/2.7.6_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urlparse.py", line 181, in urlsplit
    i = url.find(':')
AttributeError: 'tuple' object has no attribute 'find'

(nikola27)bmiller@zebra ~/s/b/reputablejournal> deactivate
bmiller@zebra ~/s/b/reputablejournal> ls
README.txt    assets/  conf.py   files/      import_octo.py*  output/  stories/
__pycache__/  cache/   conf.pyc  galleries/  listings/        posts/   themes/
bmiller@zebra ~/s/b/reputablejournal>
. ~/Environments/nikola/bin/activate.fish
(nikola) bmiller@zebra ~/s/b/reputablejournal> nikola build
Scanning posts.....done!
.  render_archive:output/2013/index.html
########################################
TaskError - taskid:render_archive:output/2013/index.html
PythonAction Error
Traceback (most recent call last):
  File "/Users/bmiller/Environments/nikola/lib/python3.4/site-packages/doit/action.py", line 360, in execute
    returned_value = self.py_callable(*self.args, **kwargs)
  File "/Users/bmiller/Environments/nikola/lib/python3.4/site-packages/nikola/nikola.py", line 639, in render_template
    template_name, None, local_context)
  File "/Users/bmiller/Environments/nikola/lib/python3.4/site-packages/nikola/plugins/template/jinja.py", line 74, in render_template
    output = template.render(**context)
  File "/Users/bmiller/Environments/nikola/lib/python3.4/site-packages/jinja2/environment.py", line 969, in render
    return self.environment.handle_exception(exc_info, True)
  File "/Users/bmiller/Environments/nikola/lib/python3.4/site-packages/jinja2/environment.py", line 742, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/bmiller/Environments/nikola/lib/python3.4/site-packages/jinja2/_compat.py", line 36, in reraise
    raise value.with_traceback(tb)
  File "themes/base-jinja/templates/list_post.tmpl", line 2, in <module>
    {% extends 'base.tmpl' %}
  File "themes/bootstrap-jinja/templates/base.tmpl", line 43, in <module>
    {{ bootstrap.html_navigation_links() }}
  File "themes/ipython-xkcd/templates/bootstrap_helper.tmpl", line 91, in <module>
    {% if rel_link(permalink, url) == "#" %}
  File "/Users/bmiller/Environments/nikola/lib/python3.4/site-packages/nikola/nikola.py", line 901, in rel_link
    dst = urljoin(src, dst)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/parse.py", line 412, in urljoin
    base, url, _coerce_result = _coerce_args(base, url)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/urllib/parse.py", line 109, in _coerce_args
    raise TypeError("Cannot mix str and non-str arguments")
TypeError: Cannot mix str and non-str arguments
ralsina commented 10 years ago

Version of Nikola, please.

bnmnetp commented 10 years ago

I tried it with 6.4, and with HEAD from github. Same error.

damianavila commented 10 years ago

Weird, with 6.4, IPython themes are working for me... For current master I have to work on them yet... I will try to investigate further...

bnmnetp commented 10 years ago

I started over, and added some things in one at a time. I have isolated it to the NAVIGATION_LINKS variable in conf.py

NAVIGATION_LINKS = {
    DEFAULT_LANG: (
        ('/archive.html', 'Archives'),
        ('/categories/index.html', 'Tags'),
        ('/rss.xml', 'RSS'),
        ('/galleries','Photos'),
        ((('/stories/publications.html','Publications'),('/stories/publications.html','Bar')),'pages')
    ),
}

If I comment out the line that creates the pages pull down menu, it works fine. with that line in there I get the traceback above. The line works fine with other themes so maybe I'm doing something wrong for the ipython-xkcd theme??

damianavila commented 10 years ago

ipython-xkcd does not support this kind of pull down menu, I have to work on the themes to update them... thanks for dig into it!

bnmnetp commented 10 years ago

OK, that explains it.

The theme page for ipython-xkcd says: "Has a fixed navigation bar at top that displays the NAVIGATION_LINKS setting and supports nested menus"

So, you may want to update that until it does.

damianavila commented 10 years ago

In fact, when I wrote it, it was not supported, but there were some changes later improving the themes... so let me check why is not working... thanks.

Kwpolska commented 10 years ago

@damianavila You should check all your themes in the repo… we changed a lot in v7, and they can easily break. Changes include comment handler template names, HIDE_SOURCELINK → SHOW_SOURCELINK, a general structure overhaul, addition of new blocks, functions and template hooks, and much more…

damianavila commented 10 years ago

Yes, I took a look at the weekend an they are broken with v7 and I have to fix a lot of things... I will try to work on them during the week, but not sure if I can get enough time to make it OK by the v7 release... If not, I suppose we can "suspend" my themes to avoid people trying to use it with v7... but first, let see if I can fix them before the release date...

ralsina commented 10 years ago

@damianavila I am 100% ok with delaying the release a few days, or adding version checks like we have for plugins so you have more time to fix them.

Kwpolska commented 10 years ago

On Wed, Apr 23, 2014 at 5:06 PM, Roberto Alsina notifications@github.comwrote:

@damianavila https://github.com/damianavila I am 100% ok with delaying the release a few days, or adding version checks like we have for plugins so you have more time to fix them.

— Reply to this email directly or view it on GitHubhttps://github.com/getnikola/nikola/issues/1253#issuecomment-41172256 .

The themes (zen in particular) are possibly the most professional ones we have, we should make sure they’re usable with our shiny new release. We should wait.

Chris “Kwpolska” Warrick http://kwpolska.tk PGP: 5EAAEA16 stop html mail | always bottom-post | only UTF-8 makes sense

damianavila commented 10 years ago

Yes, I am pointing my efforts to this one, because the other ones are only minor modifications from the shipped by Nikola itself...

damianavila commented 10 years ago

OK, ipython theme was easy to fix... I finally began with the simple one because I had only 10 min free in the lunch... I will try go forward... go go go Damián!