Colorbox_locales is undefined

33 views
Skip to first unread message

j.su...@wanadoo.fr

unread,
Dec 4, 2020, 7:13:49 AM12/4/20
to nikola-discuss

Hi all,

I'm updating a site that was working under Nikola 7. Since I passed it under Nikola 8 and python3.6, I have that strange error message. What is colorbox locales ? Why is it undefined ? Why now ?

$ nikola build
Scanning posts.done!
.  render_galleries:output/galleries/index.html
TaskError - taskid:render_galleries:output/galleries/index.html
PythonAction Error
Traceback (most recent call last):
  File "/Users/annebitranvallet/nikola/lib/python3.6/site-packages/doit/action.py", line 437, in execute
    returned_value = self.py_callable(*self.args, **kwargs)
  File "/Users/annebitranvallet/nikola/lib/python3.6/site-packages/nikola/plugins/task/galleries.py", line 706, in render_gallery_index
    self.site.render_template(template_name, output_name, context)
  File "/Users/annebitranvallet/nikola/lib/python3.6/site-packages/nikola/nikola.py", line 1472, in render_template
    template_name, None, local_context)
  File "/Users/annebitranvallet/nikola/lib/python3.6/site-packages/nikola/plugins/template/jinja.py", line 96, in render_template
    data = template.render(**context)
  File "/Users/annebitranvallet/nikola/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/Users/annebitranvallet/nikola/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/Users/annebitranvallet/nikola/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/annebitranvallet/nikola/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "themes/remouleurs/templates/gallery.tmpl", line 4, in top-level template code
    {% import 'crumbs.tmpl' as ui with context %}
  File "themes/remouleurs/templates/base.tmpl", line 67, in top-level template code
    {{ base.late_load_js() }}
  File "/Users/annebitranvallet/nikola/lib/python3.6/site-packages/jinja2/runtime.py", line 551, in _invoke
    rv = self._func(*arguments)
  File "themes/remouleurs/templates/base_helper.tmpl", line 95, in template
    <!-- {% if colorbox_locales[lang] %}
  File "/Users/annebitranvallet/nikola/lib/python3.6/site-packages/jinja2/environment.py", line 411, in getitem
    return obj[argument]
jinja2.exceptions.UndefinedError: 'colorbox_locales' is undefined

########################################
render_galleries:output/galleries/index.html <stdout>:


Thanks a lot !

J

ROSA RIVERA

unread,
Dec 4, 2020, 8:36:10 AM12/4/20
to nikola-...@googlegroups.com
hello how are you do you want me to help with yt

--
You received this message because you are subscribed to the Google Groups "nikola-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nikola-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nikola-discuss/5abfb77c-aa22-4f73-ad63-34eb829243e3n%40googlegroups.com.

j.su...@wanadoo.fr

unread,
Dec 4, 2020, 9:58:56 AM12/4/20
to nikola-discuss
Yes please ! I saw that with Nikola V8, colorbox i18n was replaced by babel. But simply updating Nikola doesn't remove colorboxes and the new version don't recognize it. Do you know how to define colorbox ?

Chris Warrick

unread,
Dec 4, 2020, 4:58:54 PM12/4/20
to Nikola—Discuss
On Fri, 4 Dec 2020 at 15:58, j.su...@wanadoo.fr <j.su...@wanadoo.fr> wrote:
>
> Yes please ! I saw that with Nikola V8, colorbox i18n was replaced by babel. But simply updating Nikola doesn't remove colorboxes and the new version don't recognize it. Do you know how to define colorbox ?

Colorbox was replaced by baguetteBox, and that does not need localized
messages. This change should have been applied to all themes at
themes.getnikola.com, if your theme comes from there, then you need to
update (reinstall with nikola theme -i). If you’re using a fully
custom theme, you can remove all colorbox references and switch to
baguetteBox (you could find commits that do the switch in the themes
repo for an example).

--
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16

j.su...@wanadoo.fr

unread,
Dec 5, 2020, 4:51:14 AM12/5/20
to nikola-discuss
Thank you so much for helping !
So I did replace (manually) colorbox with baguettebox (downloading it and calling it directly from the templates).

Then it logged :
"jinja2.exceptions.UndefinedError: 'jinja2.environment.TemplateModule object' has no attribute 'bar'"

I saw here https://github.com/getnikola/nikola-themes/issues/38 that it might come from an old version of jinja ?

Chris Warrick

unread,
Dec 5, 2020, 4:54:32 AM12/5/20
to Nikola—Discuss
On Sat, 5 Dec 2020 at 10:51, j.su...@wanadoo.fr <j.su...@wanadoo.fr> wrote:
>
> Thank you so much for helping !
> So I did replace (manually) colorbox with baguettebox (downloading it and calling it directly from the templates).
>
> Then it logged :
> "jinja2.exceptions.UndefinedError: 'jinja2.environment.TemplateModule object' has no attribute 'bar'"
>
> I saw here https://github.com/getnikola/nikola-themes/issues/38 that it might come from an old version of jinja ?

I’m not sure, remove the cache, update Jinja2 and try again. It’s also
possible that your templates are doing something weird.

Also, you should not download baguetteBox manually, it’s already
available (in base/base-jinja, from which every theme must inherit
directly or indirectly) and you just need to remove the colorbox
references and copy-paste the baguetteBox snippets.

j.su...@wanadoo.fr

unread,
Dec 5, 2020, 5:21:02 AM12/5/20
to nikola-discuss
I don't know if I'm doing this right. The only way to find a base-jinja folder in this site is in bin/python3.6/site-packages/nikola/data/themes.
Is it the path I have to declare in the snippets ?

I updated jinja2-2.9.5 to 2.11.2 and pip-20.2.4 to pip-20.3.1

The rebuild is now really long and leads to a 404 not found.

Here's my base-helper snippets :
{% macro late_load_js() %}
    {% if use_bundles %}
        {% if use_cdn %}
            <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
            <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
            <script src="/assets/js/all.js"></script>
        {% else %}
            <script src="/assets/js/all-nocdn.js"></script>
        {% endif %}
    {% else %}
        {% if use_cdn %}
            <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
            <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        {% else %}
            <script src="/assets/js/jquery.min.js"></script>
            <script src="/assets/js/bootstrap.min.js"></script>
            <script src="/assets/js/moment-with-locales.min.js"></script>
            <script src="/assets/js/fancydates.js"></script>
        {% endif %}
            <script src="/assets/js/baguetteBox.min.js" async></script>
            <script type="text/javascript">
                window.addEventListener('load', function() {
                    baguetteBox.run('.gallery');
                });
            </script>
    {% endif %}
    <script src="/assets/js/modal_newsletter.js"></script>
    {{ social_buttons_code }}
{% endmacro %}


{% macro html_stylesheets() %}
    {% if use_bundles %}
        {% if use_cdn %}
            <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
            <link href="/assets/css/all.css" rel="stylesheet" type="text/css">
        {% else %}
            <link href="/assets/css/all-nocdn.css" rel="stylesheet" type="text/css">
        {% endif %}
    {% else %}
        {% if use_cdn %}
            <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
        {% else %}
            <link href="/assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
        {% endif %}
        <link href="/assets/css/rst.css" rel="stylesheet" type="text/css">
        <link href="/assets/css/code.css" rel="stylesheet" type="text/css">
        <link rel="stylesheet" href="css/baguetteBox.min.css">
        <link href="/assets/css/theme.css" rel="stylesheet" type="text/css">
        {% if has_custom_css %}
            <link href="/assets/css/custom.css" rel="stylesheet" type="text/css">
        {% endif %}
    {% endif %}
    {% if needs_ipython_css %}
        <link href="/assets/css/ipython.min.css" rel="stylesheet" type="text/css">
        <link href="/assets/css/nikola_ipython.css" rel="stylesheet" type="text/css">
    {% endif %}

j.su...@wanadoo.fr

unread,
Dec 5, 2020, 5:23:10 AM12/5/20
to nikola-discuss
The error message is now
osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" cannot be used with the current OS because it has no OSAXHandlers entry in its Info.plist.

Chris Warrick

unread,
Dec 5, 2020, 5:26:04 AM12/5/20
to Nikola—Discuss
On Sat, 5 Dec 2020 at 11:23, j.su...@wanadoo.fr <j.su...@wanadoo.fr> wrote:
>
> The error message is now
> osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" cannot be used with the current OS because it has no OSAXHandlers entry in its Info.plist.

That’s not a Python error. I have no idea why that would be called.
Perhaps try moving that file to the Trash and testing again?
Are you using the bootstrap3-jinja theme with small customizations?
Then install that version from the index (nikola theme -i
bootstrap3-jinja) and copy over your changes.

j.su...@wanadoo.fr

unread,
Dec 5, 2020, 5:46:29 AM12/5/20
to nikola-discuss
Ok the reinstalled bootstrap made the site work again !!! But I don't think it was the parent of the custom theme. How can I find it ? The old site looks like this http://www.remouleurs.com/

j.su...@wanadoo.fr

unread,
Dec 5, 2020, 5:48:43 AM12/5/20
to nikola-discuss
So it was definitely the templates that were crushing things up, no ?

Chris Warrick

unread,
Dec 5, 2020, 6:14:28 AM12/5/20
to Nikola—Discuss
On Sat, 5 Dec 2020 at 11:46, j.su...@wanadoo.fr <j.su...@wanadoo.fr> wrote:
>
> Ok the reinstalled bootstrap made the site work again !!! But I don't think it was the parent of the custom theme. How can I find it ? The old site looks like this http://www.remouleurs.com/

It seems to be bootstrap3-based with some custom extras and CSS. You
should compare files between the two themes to recreate the old
layout.
Reply all
Reply to author
Forward
0 new messages