Efi Fogel
Efi Fogel

Reputation: 1395

Plone Error After Migration: KeyError('language',)

I have a Plone database compatible with version 3.2.2. I ran Plone version 4.3 in a docker image and upgraded (to 4.3). The migration completed successfully (or at least a message I got at the end claimed so). Then I attempted to visit the site and got the errors below. BW, when I tried version 6.0 nothing worked, so I used the oldest version of Plone I could find in a public docker image...

Is there a tool (or a mechanism) that applies fixes to the database so that it can be loaded, even in a partial way? (I have no experience dealing with the server and very little as a client...)

On the front end ():

KeyError('language',) (Also, the following error occurred while attempting to render the standard error message, please see the event log for full details: language)

On the server side:

  Module zope.tales.tales, line 696, in evaluate
   - URL: main_template
   - Line 5, Column 0
   - Expression: <PathExpr standard:u'language'>
   - Names:
      {'container': <PloneSite at /CGALtau>,
       'context': <ATDocument at /CGALtau/cgal-at-tel-aviv-university>,
       'default': <object object at 0x7f51ab8bd7e0>,
       'here': <ATDocument at /CGALtau/cgal-at-tel-aviv-university>,
       'loop': {},
       'nothing': None,
       'options': {'args': ()},
       'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x7f51a06679b0>,
       'request': <HTTPRequest, URL=http://localhost:8080/CGALtau/cgal-at-tel-aviv-university/document_view>,
       'root': <Application at >,
       'template': <FSPageTemplate at /CGALtau/document_view used for /CGALtau/cgal-at-tel-aviv-university>,
       'traverse_subpath': [],
       'user': <PropertiedUser 'admin'>}
  Module zope.tales.expressions, line 217, in __call__
  Module Products.PageTemplates.Expressions, line 147, in _eval
  Module zope.tales.expressions, line 118, in _eval
KeyError: 'language'

Upvotes: 4

Views: 167

Answers (1)

Ida
Ida

Reputation: 3965

With an uncustomized standard main_template and the base_view, no error should happen. Maybe there's an addon installed, which overrides the main_template.

As you write you want to merely access content, that would be also possible with an export via the GenericSetup tool: Call [SITE_URL]/portal_setup/manage_exportSteps in a browser, search for 'Content', check the box next to it, scroll down to the end of the page and click 'Export selected steps'.

Also you can access the site from the commandline, by adding a script in the ZOPE instance's directory (where buildout.cfg lives, too) and run it like that: ./bin/instance run yourscript.py, the Zope object (parent of the Plone site) is then available as the variable app[1], so if your site's id is 'Plone', you could access it with app['Plone']

It takes some time until the script finishes, because all modules are loaded. You can add a breakpoint in the script for an interactive inspection, to play around without the need to run the whole script after each change: from pdb import set_trace; set_trace()

For the records, here's a recipe on how to do it with even older versions: http://web.archive.org/web/20070302234456/http://zopelabs.com/cookbook/1054240694/1054240694

[1] https://zope.readthedocs.io/en/latest/operation.html#id4

Upvotes: 2

Related Questions