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

Judith Moran Judith.Moran at nt.gov.au
Mon Apr 29 23:30:00 UTC 2019


Hi,

Thanks for the response.  So I did a grep on homepage_style and it appears it is set in app_globals.py.  Is that correct?  Do I have to add a setting in the production.ini?


app_globals_from_config_details = {
    'ckan.site_title': {},
    'ckan.site_logo': {},
    'ckan.site_url': {},
    'ckan.site_description': {},
    'ckan.site_about': {},
    'ckan.site_intro_text': {},
    'ckan.site_custom_css': {},
    'ckan.favicon': {}, # default gets set in config.environment.py
    'ckan.template_head_end': {},
    'ckan.template_footer_end': {},
        # has been setup in load_environment():
    'ckan.site_id': {},
    'ckan.recaptcha.publickey': {'name': 'recaptcha_publickey'},
    'ckan.template_title_deliminater': {'default': '-'},
    'ckan.template_head_end': {},
    'ckan.template_footer_end': {},
    'ckan.dumps_url': {},
    'ckan.dumps_format': {},
    'ofs.impl': {'name': 'ofs_impl'},
    'ckan.homepage_style': {'default': '1'},

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/20190429/01da73db/attachment-0002.html>


More information about the ckan-dev mailing list