1. 07 Mar, 2016 1 commit
    • Sebastien Robin's avatar
      ERP5Type: avoid PicklingError with ERP5 broken objects · 5abbc5a7
      Sebastien Robin authored
      Following code, with foo having portal type Foo which is
      not installed yet (thus it is broken) :
      connection = self.getConnection(portal)
      foo = connection.importFile(file_obj) => this does a savepoint
      foo._p_changed = 1
      
      Then next savepoint was raising :
      PicklingError: Can't pickle <class 'erp5.portal_type.Foo'>: it's not the same object as erp5.portal_type.Foo )
      
      This was because we had :
      foo.__class__.mro() : (<class 'erp5.portal_type.Foo'>, <class 'ZODB.broken.PersistentBroken'>,
       <class 'ZODB.broken.Broken'>, <type 'persistent.Persistent'>, <class 'erp5.portal_type.Foo'>,
       <class 'Products.ERP5Type.dynamic.lazy_class.GhostBase'>,
       <class 'Products.ERP5Type.dynamic.lazy_class.ERP5BaseBroken'>, <class 'Products.ERP5Type.Base.Base'>, *TAIL)
      
      and
      
      erp5.portal_type.__getattribute__("Foo").mro() :
      (<class 'erp5.portal_type.Foo'>, <class 'Products.ERP5Type.dynamic.lazy_class.ERP5BaseBroken'>,
        <class 'ZODB.broken.Broken'>, <class 'Products.ERP5Type.Base.Base'>, *TAIL)
      
      Classes where different because new class with new inheritance was created by
      ZODB.serialize.ObjecReader.load_persistent which does :
      
      if issubclass(klass, Broken):
          # We got a broken class. We might need to make it
          # PersistentBroken
          if not issubclass(klass, broken.PersistentBroken):
              klass = broken.persistentBroken(klass)
      
      Since ERP5BaseBroken is patched to mostly be like a PersistentBroken,
      make sure we allow serialization to identify ERP5BaseBroken as a
      PersistenBroken class.
      5abbc5a7
  2. 04 Mar, 2016 6 commits
  3. 03 Mar, 2016 3 commits
  4. 02 Mar, 2016 12 commits
  5. 01 Mar, 2016 2 commits
  6. 29 Feb, 2016 2 commits
  7. 26 Feb, 2016 1 commit
  8. 25 Feb, 2016 8 commits
  9. 24 Feb, 2016 1 commit
  10. 23 Feb, 2016 4 commits