collective / pas.plugins.ldap

Zope (and Plone) PAS Plugin providing users and groups from LDAP directory
http://pypi.python.org/pypi/pas.plugins.ldap
Other
13 stars 20 forks source link

portrait traverser error #68

Open kingel opened 5 years ago

kingel commented 5 years ago

I added portrait to the User Property-Sheet Attributes

Name on Sheet | LDAP Attribute
portrait | jpegPhoto

but when I view the user author page I get this error:

File "/Users/kingel/Projects/melexis/eggs/pas.plugins.ldap-1.5.3-py2.7.egg/pas/plugins/ldap/monkey.py", line 56, in traverse
    return getPortraitFromSheet(self.context, userid).__of__(self.context)
TypeError: attempt to wrap extension method using an object that is not an extension class instance.
ipdb> self.context
<Products.Five.metaclass.SimpleViewClass from /Users/kingel/Projects/melexis/eggs/Products.CMFPlone-5.1.5-py2.7.egg/Products/CMFPlone/browser/templates/author.pt object at 0x10ef9d2d0>

In the debugger I wrote the raw data to a jpeg and was able to view it.

Searching for the error doesn't yield useful results.

And now I am stuck here, did anyone work with portraits from ldap before? Did you also encounter this problems?

kingel commented 5 years ago

Apparently it has to do with calling it on that view, I have overriden the author template

 <img src=""
         alt="User portrait picture"
         i18n:attributes="alt"
         class="userinfo__image"
         tal:attributes="src python:'%s/%s' % (portal_url, portrait.absolute_url())" />

and like this it does work