4teamwork / ftw.inflator

Plone site setup wizard with content creation and bundle system for predefined configurations.
3 stars 6 forks source link

Add Plone Site view breaks in Plone 5 #29

Closed gyst closed 5 years ago

gyst commented 8 years ago

Since https://github.com/plone/Products.CMFPlone/commit/838b9d8fc58fecae9db29a99f3dc4ff59eeab111#diff-838cfafa046576fec5f26b52732abae6 the superclass API has changed.

2016-08-12T14:31:00 ERROR Zope.SiteErrorLog 1471012260.620.92499878154 http://localhost:8080/@@inflate
Traceback (innermost last):
  Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 48, in call_object
  Module ftw.inflator.browser.views, line 32, in __call__
  Module Products.Five.browser.pagetemplatefile, line 125, in __call__
  Module Products.Five.browser.pagetemplatefile, line 59, in __call__
  Module zope.pagetemplate.pagetemplate, line 132, in pt_render
  Module five.pt.engine, line 93, in __call__
  Module z3c.pt.pagetemplate, line 163, in render
  Module chameleon.zpt.template, line 261, in render
  Module chameleon.template, line 191, in render
  Module chameleon.template, line 171, in render
  Module b092508cd3560076640e148f471ce5dc.py, line 570, in render
AttributeError: 'SimpleViewClass from /app/dev-src/ftw.inflator/ftw' object has no attribute 'languages'

 - Expression: "python:view.languages(browser_language)"
 - Filename:   /app/dev-src/ftw.inflator/ftw/inflator/browser/inflate.pt
 - Location:   (line 129: col 35)
 - Source:     ... 
                                 ^
 - Arguments:  repeat: {...} (0)
               template: <ViewPageTemplateFile - at 0x2abb41135a90>
               views: <ViewMapper - at 0x2abb3e89c2d0>
               modules: <instance - at 0x2abb2aff8758>
               args: <tuple - at 0x2abb238f4050>
               here: <ImplicitAcquisitionWrapper Zope at 0x2abb3336a550>
               user: <ImplicitAcquisitionWrapper - at 0x2abb3333c820>
               customization: <InflatorCustomization - at 0x2abb3f4f18d0>
               view: <SimpleViewClass from /app/dev-src/ftw.inflator/ftw/inflator/browser/inflate.pt inflate at 0x2abb412fcbd0>
               nothing: <NoneType - at 0x91a870>
               container: <ImplicitAcquisitionWrapper Zope at 0x2abb3336a550>
               request: <instance - at 0x2abb3f8c7908>
               wrapped_repeat: <SafeMapping - at 0x2abb31e5a578>
               traverse_subpath: <list - at 0x2abb3f8f6c20>
               default: <object - at 0x2abb239ee520>
               loop: {...} (0)
               context: <ImplicitAcquisitionWrapper Zope at 0x2abb3336a550>
               bundles: <list - at 0x2abb3cb1d290>
               browser_language: en
               translate: <function translate at 0x2abb418730c8>
               root: <ImplicitAcquisitionWrapper Zope at 0x2abb3336a550>
               options: {...} (0)
               target_language: <NoneType - at 0x91a870>
lukasgraf commented 8 years ago

@gyst thanks for the bug report and digging up that specific commit, that was very helpful indeed!

To summarize, the issue here is that the AddPloneSite view in Plone 5 now instead of languages() has a grouped_languages() method, which is used by the plone-addsite.pt to render them in a fancy dropdown grouped by country.

Just ripping out the relevant differences from the template working those into ftw.inflator's inflate.pt seemed to be enough to fix this issue for running on Plone 5.

A potential way to accomplish both Plone4/5 compatibility could be to update our inflate.pt with the changes from Plone 5, and "backport" necessary changes like the language grouping logic onto our own InflateView(AddPloneSite) (and apply them conditionally when we're on Plone 4).

Not sure how @jone feels about this though :wink:


There's at least a couple other things I spotted that would be needed to make the @@inflate view work on Plone 5:

That's probably not enough yet, those were just the obvious ones I saw.

gyst commented 8 years ago

I actually don't need ftw.inflator, I only tried to fix it because some ftw.blueprints recipes (but not the one I'm using) depend on it - see https://github.com/4teamwork/ftw.blueprints/pull/24

lukasgraf commented 8 years ago

@gyst ah, good to know, thank you for clarifying. I'll look into that one as well.

maethu commented 5 years ago

Well that took a while... @gyst We have now Plone 5.1 support included in ftw.inflator 1.10.0 😊