Commit c04926c4 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 52cd371c
......@@ -22,7 +22,14 @@ from . import persistent_migration
from ZODB.POSException import ConflictError
import six
class ERP5BaseBroken(Broken, ERP5Base, PersistentBroken):
if six.PY2:
class ERP5BaseBroken_(Broken, ERP5Base, PersistentBroken):
pass
else:
class ERP5BaseBroken_(ERP5Base, PersistentBroken):
pass
class ERP5BaseBroken(ERP5BaseBroken_):
# PersistentBroken can't be reused directly
# 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