[ckan-dev] POSSIBLY SPOOFED: Re: POSSIBLY SPOOFED: Re: most popular groups in our own theme

Judith Moran Judith.Moran at nt.gov.au
Tue Apr 30 04:13:14 UTC 2019


Hi,

Added some code to index.html and it is displaying Layout page 3 as the homepage style.

{% set homepage_style = ( g.homepage_style or '1' ) %}

  <div class="">
           <h2> Layout Page </h2>
         <h2> {{homepage_style}} </h2>
          </div>


[cid:image001.jpg at 01D4FF5A.A7CD34D0]


But when I put this in layout3.html in the them directory nothing addition displays…. What is missing.




#####################
"hello World"
%%%%%%%%%%%%%%%%%%%

{% ckan_extends %}

{% block featured_group %}
  {{ h.recently_changed_packages_activity_stream(limit=4) }}
{% endblock %}

{% block featured_organization %}

  {# Show a list of the site's most popular groups. #}
  <h3>Most popular groups</h3>
  <ul>
    {% for group in h.example_theme_most_popular_groups() %}
      <li>{{ group.display_name }}</li>
    {% endfor %}
  </ul>

{% endblock %}
layout3.htm













From: ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] On Behalf Of Adrià Mercader
Sent: Monday, 29 April 2019 6:54 PM
To: CKAN Development Discussions <ckan-dev at lists.okfn.org>
Subject: POSSIBLY SPOOFED: Re: [ckan-dev] POSSIBLY SPOOFED: Re: most popular groups in our own theme

Hi Judith,

>   BUT what does   .format(homepage_style) do on the end of {% snippet "home/layout{0}.html".format(homepage_style) %}.

This is the standard Python notation for formatting strings with the value of a variable. It is essentially replacing the "{0}" bit with the value of homepage_style (1,2 or 3 as defined in the configuration)

If you have changed the home page design significantly you can definitely override all the default templates as you see fit.

As for logs, in a production setup they would probably be at /var/log/apache/ckan_default.log (assuming Ubuntu). But for development you should use the paster development server [1], which will output all logs including error tracebacks directly into the console.

Hope this helps,

Adrià

[1] https://docs.ckan.org/en/2.8/maintaining/installing/install-from-source.html?highlight=paster%20serve#you-re-done



On Mon, 29 Apr 2019 at 09:41, Judith Moran <Judith.Moran at nt.gov.au<mailto:Judith.Moran at nt.gov.au>> wrote:
HI,

Simple question in the src index.html am I correct in assuming layout(0) is layout1.html in the template/home directory.  BUT what does   .format(homepage_style) do on the end of {% snippet "home/layout{0}.html".format(homepage_style) %}.


We are thinking of removing the largely changed index.html in out theme and starting over.


{% block content %}
  <div class="homepage layout-{{ homepage_style }}">
    <div class="container">
      {{ self.flash() }}
    </div>
  </div>
    {% block primary_content %}
      {% snippet "home/layout{0}.html".format(homepage_style) %}
    {% endblock %}
  </div>


There is a lot to learn--- python, Jinja??
Judy


-----Original Message-----
From: ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org<mailto:ckan-dev-bounces at lists.okfn.org>] On Behalf Of Matthew Fullerton
Sent: Monday, 29 April 2019 4:13 PM
To: CKAN Development Discussions <ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>>
Subject: POSSIBLY SPOOFED: Re: [ckan-dev] most popular groups in our own theme

Hi Judith,
That's hard to say but one place might be /var/log/apache2/ckan_default.error.log or /var/log/httpd/ckan_default.error.log

Or assuming you're on linux you could try:
find /var/log/ -name '*ckan*'

-Matt

On Mon, 29 Apr 2019 at 01:33, Judith Moran <Judith.Moran at nt.gov.au<mailto:Judith.Moran at nt.gov.au>> wrote:
>
> Hi,
>
> Where do the internal server logs reside?  This is the directory I have been using /var/log/httpd/ but don't see any errors relating to server error.
>
> Is there a separate log for ckan that I am not finding?
>
>
>
> -----Original Message-----
> From: ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org<mailto:ckan-dev-bounces at lists.okfn.org>] On Behalf Of
> Matthew Fullerton
> Sent: Saturday, 27 April 2019 12:40 AM
> To: CKAN Development Discussions <ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>>
> Subject: Re: [ckan-dev] most popular groups in our own theme.
>
> Dear Judith,
>
> did you make any progress yet? It's been a while since I worked on
> this kind of stuff, but
>
> - do you have logs for the internal server error and
> - have you tried doing
> {% with groups = h.example_theme_most_popular_groups() %} {% for group in groups %}
>   <li>{{ group.display_name }}</li>
> {% endfor %}
>
> instead of trying to use the function directly with the for ... in
>
> Best,
> Matt
>
> On Fri, 26 Apr 2019 at 08:56, Judith Moran <Judith.Moran at nt.gov.au<mailto:Judith.Moran at nt.gov.au>> wrote:
> >
> > Hi,
> >
> >
> >
> > I am following the example in 2.8.2 guide for the above.
> >
> >
> >
> > https://docs.ckan.org/en/2.8/theming/templates.html?highlight=ckan.c
> > om
> > mon
> >
> >
> >
> > Adding your own template helper functions
> >
> >
> >
> >
> >
> > I have successfully updated the plugin.py with the additions….. some syntax errors on indents but fixed them from the error log.
> >
> >
> >
> > Now when I add the simple code below…..  I get “Server Error”
> >
> >
> >
> > The previous developer bypassed layout1.html and is using ONLY index.html to generate the home page.
> >
> > Does this make it any difference to adding the code into index.html instead of layout1.html??
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > {% block featured_organization %}
> >
> >
> >
> >   {# Show a list of the site's most popular groups. #}
> >
> >   <h3>Most popular groups</h3>
> >
> >   <ul>
> >
> >     {% for group in h.example_theme_most_popular_groups() %}
> >
> >       <li>{{ group.display_name }}</li>
> >
> >     {% endfor %}
> >
> >   </ul>
> >
> >
> >
> > {% endblock %}
> >
> >
> >
> > Anyone got any suggestions…
> >
> >
> >
> > Thx
> >
> >
> >
> > Judy.
> >
> >
> >
> > _______________________________________________
> > ckan-dev mailing list
> > ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>
> > https://lists.okfn.org/mailman/listinfo/ckan-dev
> > Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
_______________________________________________
ckan-dev mailing list
ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>
https://lists.okfn.org/mailman/listinfo/ckan-dev
Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
_______________________________________________
ckan-dev mailing list
ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>
https://lists.okfn.org/mailman/listinfo/ckan-dev
Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20190430/c558e663/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 6888 bytes
Desc: image001.jpg
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20190430/c558e663/attachment-0002.jpg>


More information about the ckan-dev mailing list