Op 15-08-11 21:42, Dominik schreef:
Hi,

I'd like to create an addon that uses portraits that are not stored in
plone.
So far I found out that the portraits are managed by the MembershipTool.
So I guess I have to override the MembershipTool with one that has a custom
getPersonalPortrait() methode.
But I'm not sure how to do that. How do I tell plone to use my
MembershipTool instead of the on in PlonePAS? Especially it should only be
overridden if the addon is actually installed on a site.

Can somebody give me some direction?

This is untested pseudo code, but a patch in your package that is loaded on startup could work:


from somewhere import MembershipTool

def new_getPersonalPortrait(self, *args, **kwargs):
    if my package is installed in this Plone Site:
        return external portrait
    return self._orig_getPersonalPortrait(*args, **kwargs)

MembershipTool._orig_getPersonalPortrait = getPersonalPortrait
MembershipTool.getPersonalPortrait = new_getPersonalPortrait


In other words, if may be enough to not override the complete MembershipTool, but just this single method.


--
Maurits van Rees
Web App Programmer at Zest Software: http://zestsoftware.nl
Personal website: http://maurits.vanrees.org/

_______________________________________________
Product-Developers mailing list
[email protected]
https://lists.plone.org/mailman/listinfo/plone-product-developers

Reply via email to