[ckan-dev] Changing site title on extension

Pedro G Silva pedro.gracio at deimos.com.pt
Fri Mar 4 15:16:21 UTC 2016


The problem was the method I was using. I changed it to IConfigurable and
now it works as I want it to. Thansk for the help.

    plugins.implements(plugins.IConfigurable)


    def configure(self,config):
        config._process_configs[1]['ckan.site_title'] = 'DEIMOS' #this one
goes to update site title
        config._process_configs[1]['ckan.site_logo'] =
'/base/images/logo_deimos.png'

On Fri, Mar 4, 2016 at 2:08 PM, Ross Jones <ross at servercode.co.uk> wrote:

> Hi,
>
> Sorry I missed your first email, I might have saved you some time.
>
> Does config_option_update at
> https://github.com/ckan/ckan/blob/master/ckan/logic/action/update.py#L1165
> help? It's used by the admin controller when you edit config at
> http://mysite/ckan-admin
>
> It's CKAN >= 2.4 but nobody should be running less than 2.4 now (I know
> people do, but please don't).
>
> Ross
>
>
> > On 4 Mar 2016, at 13:53, Pedro G Silva <pedro.gracio at deimos.com.pt>
> wrote:
> >
> > Hi All
> > I noticed I should edit the config file from the param, instead of
> importing from pylos, so now, on the same method, I have:
> >
> > config_._process_configs[1]['ckan.site_logo'] =
> '/base/images/deimos_logo.png'
> >
> > Still, this does not work. Debugging a litle showed that on
> https://github.com/ckan/ckan/blob/887b8514ce23e54100f894391495047410e8d821/ckan/config/environment.py#L265
> , the update config is called prior to the config file is read by ckan, so
> no matter what I do, I will never be able to update the logo except on the
> config file itself. Any thoughts on how should I do this? I prefer not to
> hack ckan internally for this to work.
> >
> > Thanks
> >
> > On Thu, Mar 3, 2016 at 3:16 PM, Pedro G Silva <
> pedro.gracio at deimos.com.pt> wrote:
> > Hi All
> > I'm trying to make a theming extension and I want to automatically set
> the site title and logo, but I'm failing to do that. Can someone help me?
> Perhaps I'm using the wrong method?
> >
> > This is what I'm trying:
> >
> >     def update_config(self, config_):
> >         toolkit.add_template_directory(config_, 'templates')
> >         toolkit.add_public_directory(config_, 'public')
> >         toolkit.add_resource('fanstatic', 'snimartheme')
> >
> >         config['ckan.site_title'] = 'CHANGED'
> >
> >
> > --
> >
> >
> >
> > Pedro Gracio Silva
> > Aerospace Systems / Production Center
> >
> > Av. D. Joao II, Lt 1.17.01, 10 • 1998-023 Lisboa, Portugal
> > Ph: +351 21 893 3020 • Fax: +351 21 896 9099
> >
> >
> >
> >
> > --
> >
> >
> >
> > Pedro Gracio Silva
> > Aerospace Systems / Production Center
> >
> > Av. D. Joao II, Lt 1.17.01, 10 • 1998-023 Lisboa, Portugal
> > Ph: +351 21 893 3020 • Fax: +351 21 896 9099
> >
> > _______________________________________________
> > ckan-dev mailing list
> > 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
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>



-- 


[image: DEIMOS Engenharia, SA] <http://www.deimos.pt>
*Pedro Gracio Silva*
Aerospace Systems / Production Center

*Av. D. Joao II, Lt 1.17.01, 10 • 1998-023 Lisboa, Portugal*
Ph: +351 21 893 3020 • Fax: +351 21 896 9099
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20160304/ad9daf4c/attachment-0003.html>


More information about the ckan-dev mailing list