Ticket #9862 (closed Bug: fixed)

Opened 7 years ago

Last modified 7 years ago

Grok based viewlets won't work in Plone 4.0a1

Reported by: pingviini Owned by:
Priority: major Milestone: 4.0
Component: General Version:
Keywords: Cc: pingviini


I have made simple grok based viewlet in my dexterity content type which works fine in Plone 3.3.2, but when I try the same package in Plone 4 I get following error from the viewlet:

  Module zope.tales.tales, line 696, in evaluate
   - URL: /space/jutaojan/Programming/workspace/jyu.m3.media/jyu/m3/media/content/video_templates/view.pt
   - Line 65, Column 8
   - Expression: <StringExpr u'plone.belowcontentbody'>
   - Names:
      {'args': (),
       'container': <Video at /site/videot/video-1>,
       'context': <Video at /site/videot/video-1>,
       'default': <object object at 0x7f3969fafb30>,
       'here': <Video at /site/videot/video-1>,
       'loop': {},
       'nothing': None,
       'options': {},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x7eca4d0>,
       'request': <HTTPRequest, URL=http://localhost:8080/site/videot/video-1/view>,
       'root': <Application at >,
       'static': None,
       'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0x7592090>,
       'traverse_subpath': [],
       'user': <PropertiedUser 'admin'>,
       'view': <jyu.m3.media.content.video.View object at 0x85938d0>,
       'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0x7c53610>}
  Module zope.contentprovider.tales, line 77, in __call__
  Module zope.viewlet.manager, line 104, in update
  Module plone.app.viewletmanager.manager, line 44, in filter
AttributeError: 'OembedViewlet' object has no attribute '__of__'
> /space/jutaojan/Programs/Plone/Plone-4/moniviestin/eggs/plone.app.viewletmanager-2.0a1-py2.6.egg/plone/app/viewletmanager/manager.py(44)filter()
-> viewlet = viewlet.__of__(viewlet.context)

Getting in the debug mode reveals that indeed my grok.Viewlet based OembedViewlet doesn't indeed have this required of method as orginal viewlets based on ViewletBase (BrowserView).

I temporarily fixed this by setting try - except clause to plone.app.viewletmanagers manager.py (diff below), but I guess there is a good reason for this wrapping and this should be fixed.

<             viewlet = viewlet.__of__(viewlet.context)
>             try:
>                 viewlet = viewlet.__of__(viewlet.context)
>             except AttributeError:
>                 # grok.Viewlets based viewlets doesn't have __of__ method.
>                 pass

Change History

comment:1 Changed 7 years ago by pingviini

  • Cc pingviini added

comment:2 Changed 7 years ago by hannosch

  • Milestone changed from 4.x to 4.0

comment:3 Changed 7 years ago by hannosch

  • Status changed from new to closed
  • Resolution set to fixed

(In [32309]) Protect forced Acquisition wrapping by an interface check on IAcquirer. This closes #9862.

comment:4 Changed 4 years ago by davisagli

  • Component changed from Infrastructure to General
Note: See TracTickets for help on using tickets.