[ckan-dev] Override Core Functionalities
Denis Zgonjanin
deniszgonjanin at gmail.com
Tue Apr 7 13:43:01 UTC 2015
Well I can't help much without knowing exactly what's happening. It is also
a general programming question and a bit beyond the scope of this list.
But, it sounds like you're trying to override a whole module. Why not just
try to override the functions that you need changed? It's easier and can be
done from anywhere.
On Tue, Apr 7, 2015 at 9:30 AM, Kirstein, Fabian <
fabian.kirstein at fokus.fraunhofer.de> wrote:
> That’s was my idea too. I tried to override the sys.module in the
> __init__.py, but I wasn’t successful. So I thought it might be more
> complicated to do it. How would you “monkey-patch” it?
>
> Thanks!
>
>
>
>
>
> *Von:* ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] *Im Auftrag von *Denis
> Zgonjanin
> *Gesendet:* Dienstag, 7. April 2015 15:17
>
> *An:* CKAN Development Discussions
> *Betreff:* Re: [ckan-dev] Override Core Functionalities
>
>
>
> You can certainly monkey-patch any module you want. There is nothing
> special about CKAN you need to know, you just need Python
>
>
>
> On Tue, Apr 7, 2015 at 9:10 AM, Kirstein, Fabian <
> fabian.kirstein at fokus.fraunhofer.de> wrote:
>
> Hi,
>
> thanks for the fast response.
> I know you provide already a lot of hooks and they are sufficient for a
> lot of use cases. But still you cannot provide hooks for every possible
> case. So it would be great to a have a fallback solution when it is
> necessary to override some module. I just thought the dynamic nature of
> Python might support such things.
>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] Im Auftrag von
> Adrià Mercader
> Gesendet: Dienstag, 7. April 2015 14:43
> An: CKAN Development Discussions
> Betreff: Re: [ckan-dev] Override Core Functionalities
>
>
> Hi,
>
> The safest way is to use the available interfaces and hooks [1].
>
> Specifically you could look at before_index, that allows you to modify
> what gets indexed into Solr:
>
>
> http://docs.ckan.org/en/latest/extensions/plugin-interfaces.html#ckan.plugins.interfaces.IPackageController.before_index
>
> If the functionality you need is not exposed there we might need to add
> further extension points.
>
>
> Adrià
>
>
> [1] http://docs.ckan.org/en/latest/extensions/plugin-interfaces.html
>
> On 7 April 2015 at 13:04, Kirstein, Fabian <
> fabian.kirstein at fokus.fraunhofer.de> wrote:
> > Hello,
> >
> >
> >
> > I need to override some core functionalities. For example the
> > ckan.lib.search.index module. I was wondering if there is any way to
> > do that without forking CKAN and modifying it directly. Is it possible
> > to copy the module into an extension and modify the module loading in
> > a way to use the customized module. Any experiences with that?
> >
> >
> >
> > Thank you!
> >
> >
> >
> >
> > _______________________________________________
> > 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
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20150407/ffb0508b/attachment-0003.html>
More information about the ckan-dev
mailing list