Commit 6382ce60 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Jérome Perrin

lazy_class: remove Broken from the base classes of ERP5BaseBroken.

otherwise we will have an Exception in Python 3 while importing a Business Template,
if a new portal type and its documents exist in the same Business Template.

while importing a content file, like *.js...

(BusinessTemplate.py)
  try:
    setattr(obj, property_name, data)
  except BrokenModified:
    obj.__Broken_state__[property_name] = data # <-- !!!
    obj._p_changed = 1

obj.__Broken_state__ access here also raises BrokenModified.

while importing an XML file...

(ZODB/broken.py)
  def __new__(class_, *args):
    result = object.__new__(class_) # <-- !!!
    result.__dict__['__Broken_newargs__'] = args
    return result

we get an exception 'TypeError: object.__new__(Portal Type) is not safe, use Base.__new__()'
parent 62ae7df9
...@@ -12,7 +12,7 @@ from Products.ERP5Type.Core.CategoryProperty import CategoryProperty ...@@ -12,7 +12,7 @@ from Products.ERP5Type.Core.CategoryProperty import CategoryProperty
from ExtensionClass import ExtensionClass, pmc_init_of from ExtensionClass import ExtensionClass, pmc_init_of
from zope.interface import classImplements from zope.interface import classImplements
from ZODB.broken import Broken, PersistentBroken from ZODB.broken import PersistentBroken
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from zLOG import LOG, WARNING, BLATHER from zLOG import LOG, WARNING, BLATHER
...@@ -22,7 +22,7 @@ from . import persistent_migration ...@@ -22,7 +22,7 @@ from . import persistent_migration
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
import six import six
class ERP5BaseBroken(Broken, ERP5Base, PersistentBroken): class ERP5BaseBroken(ERP5Base, PersistentBroken):
# PersistentBroken can't be reused directly # PersistentBroken can't be reused directly
# because its « layout differs from 'GhostPortalType' » # because its « layout differs from 'GhostPortalType' »
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment