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

Erro ao adicionar uma tradução de compromisso com data diferente da agenda diária (plone.app.multilingual) #159

Open
idgserpro opened this issue May 30, 2019 · 1 comment

Comments

@idgserpro
Copy link
Member

Apesar de plonegovbr/brasil.gov.portal#188 (plone.app.multilingual) não ter sido atendido oficialmente, é possível instalar e utilizar o componente e ser usado normalmente para a grande maioria dos tipos.

No processo normal, no Compromisso, quando é criado um objeto e sua data é diferente daquela da Agenda Diária pai, isso é "consertado" por um subscriber que organiza corretamente para que o compromisso fique como filho de uma agenda diária de mesma data:

def move_compromisso_para_agendadiaria(obj, event):

Com a instalação do plone.app.multilingual, se, durante a tradução de um compromisso, essa data for alterada, ocorre o erro:

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.app.multilingual.browser.add, line 163, 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 145, in update
  Module plone.app.z3cform.csrf, line 21, in execute
  Module z3c.form.action, line 98, in execute
  Module z3c.form.button, line 315, in __call__
  Module z3c.form.button, line 170, in __call__
  Module plone.dexterity.browser.add, line 101, in handleAdd
  Module z3c.form.form, line 265, in createAndAdd
  Module plone.dexterity.browser.add, line 76, in add
  Module plone.dexterity.utils, line 180, in addContentToContainer
  Module Products.BTreeFolder2.BTreeFolder2, line 455, in _setObject
  Module zope.event, line 31, in notify
  Module zope.component.event, line 24, in dispatch
  Module zope.component._api, line 136, in subscribers
  Module zope.component.registry, line 321, in subscribers
  Module zope.interface.adapter, line 585, in subscribers
  Module zope.component.event, line 32, in objectEventNotify
  Module zope.component._api, line 136, in subscribers
  Module zope.component.registry, line 321, in subscribers
  Module zope.interface.adapter, line 585, in subscribers
  Module plone.app.multilingual.subscriber, line 172, in createdEvent
  Module zope.lifecycleevent, line 101, in modified
  Module zope.event, line 31, in notify
  Module zope.component.event, line 24, in dispatch
  Module zope.component._api, line 136, in subscribers
  Module zope.component.registry, line 321, in subscribers
  Module zope.interface.adapter, line 585, in subscribers
  Module zope.component.event, line 32, in objectEventNotify
  Module zope.component._api, line 136, in subscribers
  Module zope.component.registry, line 321, in subscribers
  Module zope.interface.adapter, line 585, in subscribers
  Module brasil.gov.agenda.subscribers.compromisso, line 141, in move_compromisso_para_agendadiaria
  Module Products.BTreeFolder2.BTreeFolder2, line 466, in _delObject
  Module plone.folder.ordered, line 58, in _getOb
AttributeError: 'dfgsdfgsdfg'

Isso ocorre porque como o subscriber do Compromisso notifica outros eventos (

notify(ObjectMovedEvent(obj, origin, old_id, destination, new_id))
), um subscriber do próprio plone.app.multilingual é chamado(https://github.com/plone/plone.app.multilingual/blob/2.0.4/src/plone/app/multilingual/subscriber.py#L124) que por sua vez chama o evento de modified chamando novamente move_compromisso_para_agendadiaria.

Talvez o ideal seja definir esses campos como ILanguageIndependentField https://docs.plone.org/develop/plone/i18n/translating_content.html#id2.

@felipe-L-C
Copy link

Como faço para instalar o multilingual no plonegovbr?

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

2 participants