logo       

Re: PrimaryFieldMarshaller doesn't work?: msg#00082

web.zope.plone.archetypes.devel

Subject: Re: PrimaryFieldMarshaller doesn't work?

My schema is :

schema = BaseSchema + Schema((
StringField('description'
, searchable=1
, required=0
, widget=TextAreaWidget
)
,
TextField('docfile',
searchable=1,
primary = 1,
required=0,
widget=FileWidget,
),
), marshall=PrimaryFieldMarshaller())

when I copy the content to local disk via webdav, I found a error. I
debugged and found problem lies in marshall:

def marshall(self, instance, **kwargs):
p = instance.getPrimaryField()
data = p.get(instance)
content_type = length = None
# Gather/Guess content type
if IBaseUnit.isImplementedBy(data):
content_type = data.getContentType()
length = data.get_size()
data = data.getRaw()

condition 'if IBaseUnit.isImplementedBy(data):' returns false so it returns
null.

----- Original Message -----
From: "Sylvain Thénault"
<Sylvain.Thenault-yG1kfhx/C0lGWvitb5QawA@xxxxxxxxxxxxxxxx>
To: "??????\(panjunyong\)"
<panjy-Bh8ToZc4Kb5K0L5L5B6ESdi2O/JbrIOy@xxxxxxxxxxxxxxxx>
Cc: <archetypes-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx>
Sent: Wednesday, June 18, 2003 11:38 PM
Subject: Re: [Archetypes-devel] PrimaryFieldMarshaller doesn't work?


> On Wednesday 18 June à 23:25, ??????\(panjunyong\) wrote:
> > I tested PrimaryFieldMarshaller just now. And found it doesn't work with
the
> > new TransformsTool.
> >
> > I found following lines are commented in Marshall.py:
> >
> > #XXX no transform tool
> > #else:
> > # ## Use instance to get the transform tool
> > # transformer = getToolByName(instance, 'transform_tool')
> > # content_type = str(transformer.classify(data))
> > # length = len(data)
> >
> > And I tried to change it to:
> >
> > else:
> > ## Use instance to get the transform tool
> > from Products.CMFCore.utils import getToolByName
> > transformer = getToolByName(instance, 'portal_transforms')
> > content_type = str(transformer.classify(data))
> > length = len(data)
> >
> > It still doesn't work :-(
>
> could you tell us more about your problem ? At which step does your
problem
> occurs ? Some context information and a traceback may really help us
finding
> the problem...
>
> --
> Sylvain Thénault LOGILAB, Paris (France).
>
> http://www.logilab.com http://www.logilab.fr http://www.logilab.org



-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise