• Kazuhiko Shiozaki's avatar
    WIP: py2/py3: store file content as it is in Business Template for PathTemplateItem. · 64981cf7
    Kazuhiko Shiozaki authored
    If we have a portal_type definition and its instances in the same Business Template,
    _importFile() creates broken objects in PathTemplateItem._objects for such instances and
    they will be 'fixed' in install() timing. But in Python 3, it does not work because :
    
    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__()'
    64981cf7
BusinessTemplate.py 282 KB