Note that there are some explanatory texts on larger screens.

plurals
  1. POAdd "tag" method to ATEvent
    primarykey
    data
    text
    <p>I use archetypes.schemaextender to extend the schema of ATEvent in order to add an ImageField.</p> <p>That works.</p> <p>Now, I want to add the "tag" method to the ATEvent in order to use the "new" way of scaling images.</p> <p>So I do this : In a file extender.py :</p> <pre><code>from Products.CMFCore.permissions import View from AccessControl import ClassSecurityInfo from zope.interface import Interface class IImageExtender(Interface): """ """ def tag(): """ """ class ImageExtender(object): """ """ implements(IImageExtender) security = ClassSecurityInfo() def __init__(self, context): self.context = context security.declareProtected(View, 'tag') def tag(self, **kwargs): """Generate image tag using the api of the ImageField """ return self.getField('image').tag(self, **kwargs) </code></pre> <p>After that in the configure.zcml:</p> <pre><code>&lt;adapter for="Products.ATContentTypes.interface.IATEvent" provides=".extender.IImageExtender" factory=".extender.ImageExtender" /&gt; </code></pre> <p>But it doesn't work. I get those errors :</p> <pre><code>Module zope.tales.pythonexpr, line 59, in __call__ - __traceback_info__: ( path('nocall:item_object/tag')(scale=size, css_class='tileImage')) Module &lt;string&gt;, line 1, in &lt;module&gt; Module zope.tales.pythonexpr, line 77, in __call__ Module zope.tales.expressions, line 217, in __call__ Module zope.tales.expressions, line 194, in _eval Module zope.tales.expressions, line 217, in __call__ Module zope.tales.expressions, line 194, in _eval Module zope.tales.expressions, line 124, in _eval Module zope.pagetemplate.engine, line 66, in __call__ Module zope.traversing.adapters, line 136, in traversePathElement - __traceback_info__: (&lt;ATEvent at /Plone/manifestations/visites-conferences/conf&gt;, 'tag') Module zope.traversing.adapters, line 50, in traverse - __traceback_info__: (&lt;ATEvent at /Plone/manifestations/visites-conferences/conf&gt;, 'tag', []) LocationError: (&lt;ATEvent at /Plone/manifestations/visites-conferences/conf&gt;, 'tag') </code></pre> <p>Any clues ? Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload