[Product-Developers] [iw.fss] SystemError: Negative size passed to PyString_FromStringAndSize

Andreas Jung lists at zopyx.com
Sun Dec 20 17:35:09 UTC 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Anyone encountered the following error?

Plone 3.3 with a custom content-type using iw.fss for a FileField:

from zope.interface import implements, directlyProvides

from AccessControl import ClassSecurityInfo

from Products.Archetypes import atapi
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata

from Products.Archetypes.public import PrimaryFieldMarshaller

from iw.fss.config import PROJECTNAME
from iw.fss.FileSystemStorage import FileSystemStorage

from wsi.sara import saraMessageFactory as _
from wsi.sara.interfaces import ImzML
from wsi.sara.config import PROJECTNAME

mzMLSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((

  # -*- Your Archetypes field definitions here ... -*-

  atapi.FileField(
      'File',
#       storage=atapi.AnnotationStorage(),
      storage=FileSystemStorage(),
      default_content_type = "application/octet_stream",
      widget=atapi.FileWidget(
          label=_(u"mzML file"),
          description=_(u"raw mzML data"),
      ),
      validators=('isNonEmptyFile'),
  ),

 ),
 marshall=PrimaryFieldMarshaller(),
)

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

mzMLSchema['title'].storage = atapi.AnnotationStorage()
mzMLSchema['description'].storage = atapi.AnnotationStorage()

schemata.finalizeATCTSchema(mzMLSchema, moveDiscussion=False)

class mzML(base.ATCTContent):
  """mzML files"""
  implements(ImzML)

  meta_type = "mzML"
  schema = mzMLSchema

  title = atapi.ATFieldProperty('title')
  description = atapi.ATFieldProperty('description')

  # -*- Your ATSchema to Python Property Bridges Here ... -*-
  File = atapi.ATFieldProperty('File')

atapi.registerType(mzML, PROJECTNAME)

- ----------------



>>>

>>> 2009-12-10 10:26:27 ERROR Zope.SiteErrorLog
http://0.0.0.0:8140/Zope2/sara/data/probandendaten/testMedium.mzML/PUT
>>> Traceback (innermost last): Module ZPublisher.Publish, line
>>> 119, in publish Module ZPublisher.mapply, line 88, in mapply
>>> Module ZPublisher.Publish, line 42, in call_object Module
>>> webdav.NullResource, line 167, in PUT Module
>>> Products.Archetypes.WebDAVSupport, line 116, in PUT Module
>>> Products.Archetypes.utils, line 160, in mapply Module
>>> Products.Marshall.marshaller, line 102, in demarshall Module
>>> Products.Marshall.marshaller, line 85, in delegate -
>>> __traceback_info__:
(<Products.Archetypes.Marshall.RFC822Marshaller instance at
0xd1473b0>, 'demarshall', <ATDocument at
/sara/data/probandendaten/testMedium.mzML>, {'mimetype': None,
'REQUEST': <FTPRequest,
URL=http://0.0.0.0:8140/Zope2/sara/data/probandendaten/testMedium.mzML/PUT>,
'RESPONSE': FTPResponse(''), 'context': <ATDocument at
/sara/data/probandendaten/testMedium.mzML>, 'filename':
'testMedium.mzML'})
>>> Module Products.Archetypes.Marshall, line 239, in demarshall
>>> Module Products.ATContentTypes.content.document, line 176, in
>>> setText Module wicked.fieldevent, line 34, in store Module
>>> zope.event, line 23, in notify Module zope.component.event,
>>> line 26, in dispatch Module zope.component._api, line 130, in
>>> subscribers Module zope.component.registry, line 290, in
>>> subscribers Module zope.interface.adapter, line 535, in
>>> subscribers Module wicked.fieldevent, line 24, in
>>> notifyFieldEvent Module zope.component._api, line 130, in
>>> subscribers Module zope.component.registry, line 290, in
>>> subscribers Module zope.interface.adapter, line 539, in
>>> subscribers Module wicked.fieldevent.meta, line 83, in
>>> field_value_set Module Products.Archetypes.Field, line 1043, in
>>> set Module Products.Archetypes.Field, line 1342, in
>>> _process_input Module Products.Archetypes.BaseUnit, line 61, in
>>> update Module Products.MimetypesRegistry.MimeTypesRegistry,
>>> line 399, in
guess_encoding
>>> SystemError: Negative size passed to
>>> PyString_FromStringAndSize

The error within guess_encoding is triggered by this issue in Python 2.4:

http://bugs.python.org/issue7551

The more high-level issue is: is there something (stupid) in iw.fss
triggering
this issue? I could not find an obvious way for getting around this
problem.

Not using "marshall=PrimaryFieldMarshaller()," results in a different
error as described in this thread:

https://mail.zope.org/pipermail/zope/2009-December/175561.html

Also no idea why Archetype is calling setText() for a
BaseContent-derived type:

>>> Module Products.Archetypes.Marshall, line 239, in demarshall
>>> Module Products.ATContentTypes.content.document, line 176, in
>>> setText


Thoughts?

Andreas

- -- 
ZOPYX Ltd. & Co KG         \ zopyx group
Charlottenstr. 37/1         \ The full-service network for your
D-72070 Tübingen             \ Python, Zope and Plone projects
www.zopyx.com, info at zopyx.com \ www.zopyxgroup.com
- ------------------------------------------------------------------------
E-Publishing, Python, Zope & Plone development, Consulting


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksuYEwACgkQCJIWIbr9KYw40wCg5EEyDcwjRSKdXxRzzIl3SRrk
YCYAnjvzEXyW5cjmz6skMpEQkAv1LkG8
=YLnj
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lists.vcf
Type: text/x-vcard
Size: 316 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20091220/3d600e10/attachment.vcf>


More information about the Product-Developers mailing list