Re: Plone 4.2->4.3.4 PicklingError saving Dexterity content with relationship

Simon Richardson <[email protected]>
Newsgroups gmane.comp.web.zope.plone.user
Message-ID <[email protected]>
I've been doing some digging and I think the problem may be down to the 
version of plone.directives.form in my existing 4.2 Plone site - see:

http://stackoverflow.com/questions/20290361/how-to-clean-up-old-interfaces-on-zc-relation-catalog

If anyone can offer any further insight or suggest a correct path to 
resolve my problem then I'd welcome your input.

Simon



On 23/01/2015 10:39, Simon Richardson wrote:
> Hi Plone Users
>
> 1) Using I recently created a new Plone 4.3.4 site and added some 
> existing custom Dexterity content types which were updated from my 4.2 
> build.  On this vanilla Plone 4.3.4 database these content types work 
> perfectly well.
>
> 2) I then replaced the Plone 4.3.4 var directory with one from my 4.2 
> site.  I started the new Plone 4.3.4 site and ran the upgrade routine 
> (as prompted in the overview control panel).  Again everything seemed 
> fine.  However, i do have a major issue with Dexterity content types 
> on this environment .... which causes me to question my upgrade approach.
>
> On my new 4.3.4 site (#2 above) I am able to create and edit my 
> Dexterity content items provided they don't have a relationship field 
> populated.  Even if it has a relationship field defined provided i 
> don't populate it then it saves without error.  The minute I try to 
> assign a relationship to the content I get a PicklingError as shown 
> below.  I've also included the source for my Dexterity class which has 
> the relationship (created using zopeskel) and my pinned versions.
>
> One post 
> <https://github.com/innocenceproject/collective.salesforce.fundraising/issues/63> 
> I read chose to included plone.app.kss in their build as a workaround, 
> but because I am of the opinion that the Plone 4.3 team had an 
> objective to remove the kss dependency I am reluctant to introduce it.
>
> I do question my 'upgrade approach' - is this the right way to do it?
>
> Any ideas what might be causing the PicklingError or how to fix it?
>
>
> Simon
>
> 2015-01-22 19:43:47 WARNING OFS.Uninstalled Could not import class 
> 'IPortalObject' from module 'plone.app.kss.interfaces'
> 2015-01-22 19:43:47 WARNING OFS.Uninstalled Could not import class 
> 'Schema' from module 'plone.directives.form.schema'
> 2015-01-22 19:43:48 ERROR Zope.SiteErrorLog 1421955828.30.904057612524 
> http://192.168.146.129:8080/Plone/myswimming-club/++add++myswimmingclub.content.swimmer
> Traceback (innermost last):
>   Module ZPublisher.Publish, line 146, in publish
>   Module Zope2.App.startup, line 301, in commit
>   Module transaction._manager, line 89, in commit
>   Module transaction._transaction, line 329, in commit
>   Module transaction._transaction, line 443, in _commitResources
>   Module ZODB.Connection, line 567, in commit
>   Module ZODB.Connection, line 623, in _commit
>   Module ZODB.Connection, line 658, in _store_objects
>   Module ZODB.serialize, line 422, in serialize
>   Module ZODB.serialize, line 431, in _dump
> PicklingError: Can't pickle <class 
> 'plone.app.kss.interfaces.IPortalObject'>: import of module 
> plone.app.kss.interfaces failed
> > 
> /home/plone/copsclub-plone4.3-dev/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/serialize.py(431)_dump()
> -> self._p.dump(state)
> (Pdb) pp state
> ((<InterfaceClass OFS.interfaces.IOrderedContainer>,
>   (<BTrees.Length.Length object at 0x2b72e72745f0>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e7273050>),
>   <InterfaceClass AccessControl.interfaces.IOwned>,
>   (<BTrees.Length.Length object at 0x2b72e7274668>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e72730d0>),
>   <InterfaceClass AccessControl.interfaces.IPermissionMappingSupport>,
>   (<BTrees.Length.Length object at 0x2b72e72746e0>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e7273150>),
>   <InterfaceClass persistent.interfaces.IPersistent>,
>   (<BTrees.Length.Length object at 0x2b72e7274758>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e72731d0>),
>   <InterfaceClass App.interfaces.IPersistentExtra>,
>   (<BTrees.Length.Length object at 0x2b72e72747d0>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e7273250>),
>   <class 'plone.app.kss.interfaces.IPortalObject'>,
>   (<BTrees.Length.Length object at 0x2b72e7274848>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e7273350>),
>   <InterfaceClass zope.component.interfaces.IPossibleSite>,
>   (<BTrees.Length.Length object at 0x2b72e72748c0>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e72732d0>),
>   <InterfaceClass OFS.interfaces.IPropertyManager>,
>   (<BTrees.Length.Length object at 0x2b72e7274938>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e72733d0>),
>   <InterfaceClass zope.container.interfaces.IReadContainer>,
>   (<BTrees.Length.Length object at 0x2b72e72749b0>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e7273450>),
>   <InterfaceClass zope.interface.common.mapping.IReadMapping>,
>   (<BTrees.Length.Length object at 0x2b72e7274a28>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e72734d0>),
>   <InterfaceClass 
> plone.app.referenceablebehavior.referenceable.IReferenceable>,
>   (<BTrees.Length.Length object at 0x2b72e7274aa0>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e7273550>),
>   <InterfaceClass AccessControl.interfaces.IRoleManager>,
>   (<BTrees.Length.Length object at 0x2b72e7274b18>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e72735d0>),
>   <InterfaceClass plone.contentrules.engine.interfaces.IRuleAssignable>,
>   (<BTrees.Length.Length object at 0x2b72e7274b90>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e7273650>),
>   <InterfaceClass 
> Products.CMFDynamicViewFTI.interfaces.ISelectableBrowserDefault>,
>   (<BTrees.Length.Length object at 0x2b72e7274c08>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e72736d0>),
>   <InterfaceClass OFS.interfaces.ISimpleItem>,
>   (<BTrees.Length.Length object at 0x2b72e7274c80>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e7273750>),
>   <InterfaceClass zope.container.interfaces.ISimpleReadContainer>,
>   (<BTrees.Length.Length object at 0x2b72e7274cf8>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e72737d0>),
>   <SchemaClass myswimmingclub.content.swimmer.ISwimmer>,
>   (<BTrees.Length.Length object at 0x2b72e727bde8>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e726a250>),
>   <SchemaClass copsclub.content.swimmingmeet.ISwimmingMeet>,
>   (<BTrees.Length.Length object at 0x2b72e7274d70>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e7273850>),
>   <InterfaceClass OFS.interfaces.ITraversable>,
>   (<BTrees.Length.Length object at 0x2b72e7274de8>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e72738d0>),
>   <InterfaceClass plone.uuid.interfaces.IUUIDAware>,
>   (<BTrees.Length.Length object at 0x2b72e7274e60>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e7273950>),
>   <InterfaceClass App.interfaces.IUndoSupport>,
>   (<BTrees.Length.Length object at 0x2b72e7274ed8>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e72739d0>),
>   <InterfaceClass Products.CMFCore.interfaces._content.IWorkflowAware>,
>   (<BTrees.Length.Length object at 0x2b72e7274f50>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e7273a50>),
>   <InterfaceClass zope.container.interfaces.IWriteContainer>,
>   (<BTrees.Length.Length object at 0x2b72e726d050>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e7273ad0>),
>   <InterfaceClass webdav.interfaces.IWriteLock>,
>   (<BTrees.Length.Length object at 0x2b72e726d0c8>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e7273b50>),
>   <InterfaceClass OFS.interfaces.IZopeObject>,
>   (<BTrees.Length.Length object at 0x2b72e726d140>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e7273bd0>),
>   <InterfaceClass zope.interface.Interface>,
>   (<BTrees.Length.Length object at 0x2b72e726d1b8>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e7273c50>),
>   <class 'plone.directives.form.schema.Schema'>,
>   (<BTrees.Length.Length object at 0x2b72e726d230>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e7273ed0>),
>   <SchemaClass plone.supermodel.model.Schema>,
>   (<BTrees.Length.Length object at 0x2b72e726d2a8>,
>    <BTrees.IFBTree.IFTreeSet object at 0x2b72e726a1d0>)),)
>
> (Pdb) pp self
> <ZODB.serialize.ObjectWriter instance at 0x2b72e7138248>
> (Pdb) pp classmeta
> <type 'BTrees.OOBTree.OOBucket'>
> (Pdb)
>
> ============================
> = swimmer.py
> ============================
>
> from five import grok
>
> from z3c.form import group, field
> from zope import schema
> from zope.interface import invariant, Invalid
> from zope.schema.interfaces import IContextSourceBinder
> from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
>
> from plone.dexterity.content import Item
>
> from plone.directives import dexterity, form
> from plone.app.textfield import RichText
> from plone.namedfile.field import NamedImage, NamedFile
> from plone.namedfile.field import NamedBlobImage, NamedBlobFile
> from plone.namedfile.interfaces import IImageScaleTraversable
>
> from z3c.relationfield.schema import RelationList, RelationChoice
> from plone.formwidget.contenttree import ObjPathSourceBinder
>
>
> from myswimmingclub.content import MessageFactory as _
>
> # imports for the schema
> from plone.app.textfield import RichText
> from plone.supermodel import model
> from zope import schema
> from z3c.relationfield.schema import RelationChoice
> from plone.formwidget.contenttree import ObjPathSourceBinder
> from myswimmingclub.content.training_squad import ITrainingSquad
>
> # imports for the view
> from Acquisition import aq_inner
> from Products.CMFCore.utils import getToolByName
> from Products.Five import BrowserView
>
> # Interface class; used to define content-type schema.
>
> class ISwimmer(model.Schema):
>     """
>     A swimmer in the swimming club
>     """
>
>     title = schema.TextLine(
>         title = _(u"Membership Number"),
>     )
>
>     description = schema.Text(
>         title=_(u"Full Name"),
>     )
>
>     squad = RelationChoice(
>         title=_(u"Traning Squad"),
> source=ObjPathSourceBinder(object_provides=ITrainingSquad.__identifier__),
>         required=False,
>     )
>
>
> # Custom content-type class; objects created for this content type will
> # be instances of this class. Use this class to add content-type specific
> # methods and properties. Put methods that are mainly useful for rendering
> # in separate view classes.
>
> class Swimmer(Item):
>     grok.implements(ISwimmer)
>
>     # Add your class methods and properties here
>     pass
>
>
> # View class
> # The view will automatically use a similarly named template in
> # swimmer_templates.
> # Template filenames should be all lower case.
> # The view will render when you request a content object with this
> # interface with "/@@sampleview" appended.
> # You may make this the default view for content objects
> # of this type by uncommenting the grok.name line below or by
> # changing the view class name and template filename to View / view.pt.
>
> class SampleView(grok.View):
>     """ sample view class """
>
>     grok.context(ISwimmer)
>     grok.require('zope2.View')
>
>     # grok.name('view')
>
>     # Add view methods here
>
> class TrainingSquadView(BrowserView):
>     """ sample view class """
>
>     # grok.name('view')
>
>     # Add view methods here
>
>
> # =============================
> # Project-specific version pins
> # =============================
>
> [versions]
> # Buildout
> Products.Doormat = 0.8
> collective.embedly = 2.2
>
> # Development tools
> bpython = 0.9.7.1
> pygments = 1.4
> Products.DocFinderTab = 1.0.4
> Products.PDBDebugMode = 1.3.1
> Products.PrintingMailHost = 0.7
> jarn.mkrelease = 3.0.9
> setuptools-git = 0.4.2
> setuptools-hg = 0.2
> plone.api = 1.0.0-rc.1
> Products.ImageEditor = 3.0.0
>
> # ZopeSkel
> ZopeSkel = 2.19
> Cheetah = 2.2.1
> Paste = 1.7.5.1
> PasteScript = 1.7.3
> PasteDeploy = 1.3.4
>
> [downloads]
> varnish = http://repo.varnish-cache.org/source/varnish-2.1.5.tar.gz
> pcre    = 
> http://downloads.sourceforge.net/project/pcre/pcre/8.01/pcre-8.01.tar.gz
>

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet

_______________________________________________
Plone-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plone-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.