Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dexterity Schema unaccessible after update to 5.1b4 #2093

Closed
tomgross opened this issue Jul 5, 2017 · 13 comments
Closed

Dexterity Schema unaccessible after update to 5.1b4 #2093

tomgross opened this issue Jul 5, 2017 · 13 comments

Comments

@tomgross
Copy link
Member

tomgross commented Jul 5, 2017

BUG/PROBLEM REPORT (OR OTHER COMMON ISSUE)

What I did:

I updated a Plone site from 5.1b3 to 5.1b4 pending.
The site has PAM installed with three languages de (default), en, fr.
The site did NOT use combinded languages.

What I expect to happen:

Schema editing in control panel works.
http://localhost:8080/Plone/dexterity-types/Document/@@fields

What actually happened:

An error was raised:

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 plone.z3cform.layout, line 68, in __call__
  Module plone.z3cform.layout, line 47, in update
  Module plone.z3cform.fieldsets.extensible, line 65, in update
  Module plone.z3cform.patch, line 30, in GroupForm_update
  Module z3c.form.group, line 141, in update
  Module z3c.form.group, line 52, in update
  Module z3c.form.group, line 48, in updateWidgets
  Module z3c.form.field, line 277, in update
  Module z3c.form.browser.select, line 51, in update
  Module z3c.form.browser.widget, line 171, in update
  Module z3c.form.widget, line 234, in update
  Module Products.CMFPlone.patches.z3c_form, line 47, in _wrapped
  Module z3c.form.widget, line 115, in update
  Module zope.schema._bootstrapfields, line 78, in __get__
  Module zope.schema._bootstrapfields, line 183, in validate
  Module zope.schema._field, line 338, in _validate
ConstraintNotSatisfied: ('en-us', 'language')

Also the combined language flag changed with the update. I reset it manually but the error persists.

What version of Plone/ Addons I am using:

Plone 5.1b4 with PAM

@hvelarde
Copy link
Member

hvelarde commented Jul 5, 2017

this is happening also in Plone 4.3.11 with latest plone.app.contenttypes 1.1.1 installed:

2017-07-05 10:44:15 ERROR Zope.SiteErrorLog 1499262255.680.314348439049 http://localhost:8080/Plone/news/++add++News%20Item
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 plone.z3cform.layout, line 66, in __call__
  Module plone.z3cform.layout, line 50, in update
  Module plone.dexterity.browser.add, line 118, in update
  Module plone.z3cform.fieldsets.extensible, line 59, in update
  Module plone.z3cform.patch, line 30, in GroupForm_update
  Module z3c.form.group, line 141, in update
  Module z3c.form.group, line 52, in update
  Module z3c.form.group, line 48, in updateWidgets
  Module z3c.form.field, line 277, in update
  Module z3c.form.browser.select, line 51, in update
  Module z3c.form.browser.widget, line 171, in update
  Module z3c.form.widget, line 234, in update
  Module z3c.form.widget, line 115, in update
  Module zope.schema._bootstrapfields, line 78, in __get__
  Module zope.schema._bootstrapfields, line 182, in validate
  Module zope.schema._field, line 389, in _validate
ConstraintNotSatisfied: pt-br

@thet
Copy link
Member

thet commented Jul 5, 2017

That might be related to: plone/plone.app.dexterity#251

@hvelarde are you using plone.app.dexterity 2.4.4 instead 2.0.18?

The easiest fix would be to revert that change. I'm wondering where the language en-us comes from, in case of @tomgross problem.

/cc @jensens @mauritsvanrees opinions on how to fix this?

@tomgross
Copy link
Member Author

tomgross commented Jul 5, 2017

I downgraded to plone.app.dextertiy 2.4.3 but the error still persists.

@hvelarde
Copy link
Member

hvelarde commented Jul 5, 2017

this is what I have:

$ grep dexterity bin/instance 
    '/home/hvelarde/.buildout/eggs/plone.dexterity-2.2.7-py2.7.egg',
    '/home/hvelarde/.buildout/eggs/plone.app.dexterity-2.0.18-py2.7.egg',

@thet
Copy link
Member

thet commented Jul 5, 2017

@hvelarde @tomgross to be able to reproduce your problems, can you please provide me with the following info:

  • what are the values for these plone.registry settings: plone.default_language and plone.available_languages (both from the Products.CMFPlone.interfaces.controlpanel.ILanguageSchema controlpanel)
  • @hvelarde what's your version of plone.app.vocabularies
  • @hvelarde what's your version of plone.app.dexterity

@thet
Copy link
Member

thet commented Jul 5, 2017

@tomgross @hvelarde - just saw your comments regarding versions - looks like the errors are not related to my PRs:

Also, it's unlikely anyways, as they should not affect the schemaeditor...

@agitator
Copy link
Member

agitator commented Jul 6, 2017

Updated a 5.1b2 multilingual (de, fr, it, en) site to 5.1b4

http://localhost:8080/Plone/dexterity-types/Document/@@fields works for me

plone.dexterity-2.5.2-py2.7.egg
plone.app.dexterity-2.4.4-py2.7.egg

@tomgross
Copy link
Member Author

tomgross commented Jul 6, 2017

I have a suspect. We set the language programmatically. This was a string until Plone 5.1b3. With Plone 5.1b4 the script complained about an unicode issue for new sites. I'll try to change the language settings to unicode on our existing site and report.

@tomgross
Copy link
Member Author

tomgross commented Jul 6, 2017

Yeah, this did the trick for me:

    language_tool = api.portal.get_tool(name='portal_languages')
    for lang in [u'de', u'en', u'fr']:
        language_tool.addSupportedLanguage(lang)

    portal = api.portal.get()
    ml_setup_tool = SetupMultilingualSite()
    ml_setup_tool.setupSite(portal)

@tomgross
Copy link
Member Author

tomgross commented Jul 6, 2017

I'm unsure wheter this issue should be closed. Ideally an upgrade step takes care for the transition but setting the language programmatically is probably not a common use case.

@thet
Copy link
Member

thet commented Jul 6, 2017

Sounds like an upgrade step among a note/warning in the incompatibilities section of the CMFPlone changelog is needed.

I'm curious what caused the problem. Must be some common package which Plone 4.3.x ( @hvelarde problem) and 5.1.x uses.

@pbauer
Copy link
Sponsor Member

pbauer commented Jul 14, 2017

I just has a related problem with 5.1b4. For me the issue was that the value for plone.available_languages was empty since since I was setting it wrong in my registry.xml. That was no issue before but now the value for 'language' in schemas gets validated against the vocabulary.

api.portal.get_registry_record('plone.available_languages') returned [] instead of ['de'] which it does in a newly created site.

My error was to set it using::

<record name="plone.available_languages" interface="Products.CMFPlone.interfaces.controlpanel.ILanguageSchema" field="available_languages">
  <value>['de']</value>
</record>

instead of

<record name="plone.available_languages" interface="Products.CMFPlone.interfaces.controlpanel.ILanguageSchema" field="available_languages">
  <value>
    <element>de</element>
  </value>
</record>

@tomgross
Copy link
Member Author

I'm closing this now. The special cases for programmatically setting of languages and profile requirements are documented here for further reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants