Re: [nikola-discuss] Re: AttributeError: 'Undefined' object has no attribute 'meta'

2020-05-22 Thread Roberto Alsina
I did not check anything other than that it built.

On Fri, May 22, 2020 at 5:26 AM Julien Vallet  wrote:

> It worked just fine thanks ! I had changed the base.tmpl trying to impose
> the banner.
> Now the site works well, but I'm still in struggle with the metadata, yet
> I think I have set the global context at the right place and tried numerous
> possibilities to set the pagekind to main_index and BANNER_URL.
> Did the banner opened when you build it ?
>
>
> Le mercredi 13 mai 2020 10:59:50 UTC+2, Julien Vallet a écrit :
>>
>> Hi,
>>
>>
>> I have trouble with the replacement of an old theme.
>>
>> When building under a new theme (canterville), I get a
>>
>>
>> __M_writer(str(post.meta('banner')))
>> AttributeError: 'Undefined' object has no attribute 'meta'
>>
>> 
>> render_galleries:output/galleries/index.html :
>>
>>
>> Maybe its because I misused conf.py ?
>>
>>
>> GLOBAL_CONTEXT = {
>>"BANNER_URL": '/assets/img/oeil.jpg',
>>
>> }
>>
>>
>> Yet I've been careful with the Global_context location...
>>
>>
>> Or in my template ?
>>
>>
>> 
>> % if 'main_index' in pagekind:
>> 
>> % else:
>> 
>> % else:
>> 
>> % endif
>>
>>
>> Can you help me ?
>>
> --
> 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-discuss+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nikola-discuss/30d378ed-0a7d-4752-ba9c-b9f1cafefdb4%40googlegroups.com
> 
> .
>

-- 
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-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nikola-discuss/CALXDAfqJv-ED3Rs7%3DtEt-_HZ-%2Bv9jTGhtLEBiU-jMWdpPpbFrg%40mail.gmail.com.


Re: [nikola-discuss] Re: AttributeError: 'Undefined' object has no attribute 'meta'

2020-05-21 Thread Roberto Alsina
I got the zip you sent me.

* I moved aside the copy of canterville you included and downloaded the
original
* Re-added as empty the galleries you removed before sending

And it built just fine.

* Put back your version of canterville:

[2020-05-21 06:12:17] ERROR: Nikola: File
"/home/ralsina/Downloads/x/nikola_test/cache/.mako.tmp/base.tmpl.py", line
88
else:
^
SyntaxError: invalid syntax

So, the problem seems to either have been fixed in canterville after you
installed it, or was introduced when you edited it.

These are the relevant differences:

-% if 'main_index' in pagekind and BANNER_URL:
+% if 'main_index' in pagekind and BANNER_URL :
 
-% else:
+% elif 'post_page' in pagekind and post.meta('banner'):
 
 % else:
 

You can just get the original base.tmpl from canterville and replace yours
and it will probably build just fine:

https://github.com/getnikola/nikola-themes/blob/master/v8/canterville/templates/base.tmpl


On Wed, May 13, 2020 at 8:08 AM Roberto Alsina  wrote:

> On Wed, May 13, 2020 at 7:30 AM Julien Vallet 
> wrote:
>
>> Can I send you the context ? What would you need ? I'm just at the end of
>> the rope
>>
>>
> Is your site's source code somewhere I can see it?
>
> Or just make a zip and email it to me.
>

-- 
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-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nikola-discuss/CALXDAfr94HgQKHVQPF%3D4SZGutGX0mirJ-jyYyM6L81K1Eka_%3Dg%40mail.gmail.com.


Re: [nikola-discuss] Re: AttributeError: 'Undefined' object has no attribute 'meta'

2020-05-13 Thread Roberto Alsina
On Wed, May 13, 2020 at 7:30 AM Julien Vallet  wrote:

> Can I send you the context ? What would you need ? I'm just at the end of
> the rope
>
>
Is your site's source code somewhere I can see it?

Or just make a zip and email it to me.

-- 
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-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nikola-discuss/CALXDAfota_CE7XfRPGP6VKonQPiBVZG%3Dsk8k9ho5UT8ctSNRbA%40mail.gmail.com.


Re: [nikola-discuss] Re: AttributeError: 'Undefined' object has no attribute 'meta'

2020-05-13 Thread Julien Vallet
Can I send you the context ? What would you need ? I'm just at the end of 
the rope

Le mercredi 13 mai 2020 12:08:20 UTC+2, Roberto Alsina a écrit :
>
> The template has no "post", you only have it inside that loop, after the 
> line
>
> % for post in posts:
>
> I am guessing the call to post.meta that's failing is outside that.
> Trying to explain how to fix that without context is difficult, but you 
> just can't use post anywhere outside that loop.
>
>
> On Wed, May 13, 2020 at 6:49 AM Julien Vallet  > wrote:
>
>> Yet there is a block for articles no ?
>>
>> 
>> % for post in posts:
>>
>>
>> 
>> 
>> 
>> ${post.title()|h}
>> 
>> %if index_teasers:
>> 
>> ${post.text(teaser_only=True)}
>> %else:
>> 
>> ${post.text(teaser_only=False)}
>> %endif
>> 
>> 
>> % if author_pages_generated:
>> 
>> ${post.author()|h}
>> % else:
>> ${post.author()|h}
>> % endif
>>
>> on
>> % for tag in post.tags:
>> #${tag},
>> % endfor
>>
>> > "${post.formatted_date('webiso')}">
>> ${post.formatted_date(date_format)|h}
>> 
>> 
>> 
>>
>>
>>
>> -- 
>> 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-...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/nikola-discuss/679cfc08-d74f-42c7-8879-ad068a6313a1%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nikola-discuss/a00346ef-7535-4d4d-beca-d013e6fd8236%40googlegroups.com.


Re: [nikola-discuss] Re: AttributeError: 'Undefined' object has no attribute 'meta'

2020-05-13 Thread Roberto Alsina
The template has no "post", you only have it inside that loop, after the
line

% for post in posts:

I am guessing the call to post.meta that's failing is outside that.
Trying to explain how to fix that without context is difficult, but you
just can't use post anywhere outside that loop.


On Wed, May 13, 2020 at 6:49 AM Julien Vallet  wrote:

> Yet there is a block for articles no ?
>
> 
> % for post in posts:
>
>
> 
> 
> 
> ${post.title()|h}
> 
> %if index_teasers:
> 
> ${post.text(teaser_only=True)}
> %else:
> 
> ${post.text(teaser_only=False)}
> %endif
> 
> 
> % if author_pages_generated:
> 
> ${post.author()|h}
> % else:
> ${post.author()|h}
> % endif
>
> on
> % for tag in post.tags:
> #${tag},
> % endfor
>
>  "${post.formatted_date('webiso')}">
> ${post.formatted_date(date_format)|h}
> 
> 
> 
>
>
>
> --
> 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-discuss+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nikola-discuss/679cfc08-d74f-42c7-8879-ad068a6313a1%40googlegroups.com
> 
> .
>

-- 
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-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nikola-discuss/CALXDAfp2wfy92Phqyt5pbnVDbxkGt6tR-2EexwgueZMVC9C30A%40mail.gmail.com.


Re: [nikola-discuss] Re: AttributeError: 'Undefined' object has no attribute 'meta'

2020-05-13 Thread Roberto Alsina
Ok, the index template has no post, so you will need to make that
conditional on post being there.

On Wed, May 13, 2020 at 6:12 AM Julien Vallet  wrote:

> It has three posts and it's the index template.
>
> Le mercredi 13 mai 2020 10:59:50 UTC+2, Julien Vallet a écrit :
>>
>> Hi,
>>
>>
>> I have trouble with the replacement of an old theme.
>>
>> When building under a new theme (canterville), I get a
>>
>>
>> __M_writer(str(post.meta('banner')))
>> AttributeError: 'Undefined' object has no attribute 'meta'
>>
>> 
>> render_galleries:output/galleries/index.html :
>>
>>
>> Maybe its because I misused conf.py ?
>>
>>
>> GLOBAL_CONTEXT = {
>>"BANNER_URL": '/assets/img/oeil.jpg',
>>
>> }
>>
>>
>> Yet I've been careful with the Global_context location...
>>
>>
>> Or in my template ?
>>
>>
>> 
>> % if 'main_index' in pagekind:
>> 
>> % else:
>> 
>> % else:
>> 
>> % endif
>>
>>
>> Can you help me ?
>>
> --
> 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-discuss+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nikola-discuss/0d3c44d3-685d-426c-845b-13918cd9c2e7%40googlegroups.com
> 
> .
>

-- 
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-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nikola-discuss/CALXDAfqHUKrJaSx7L2yt6gb42p-Z83CDEkZyc8RAKRXMxV-cWg%40mail.gmail.com.