[Libreoffice] Extension-Repository: Need help to solve a Python error

Caolán McNamara caolanm at redhat.com
Mon Jul 11 09:27:09 PDT 2011


On Tue, 2011-07-05 at 21:14 +0200, Andreas Mantke wrote:
> I don't know yet, how to solve this Python error. I hope someone with Python 
> knowledge could help me at this point. The both files are listed here:
> http://amantke.de/libreoffice/blobstorage

It would have been better to put it up raw someplace really, or into a
pastebin so that matching the line numbers in the backtrace to the file
at that url was easier. And the indent is missing, which is real
important in python.

Anyway, to be sure we need to see the source of
plone.app.blob.field.BlobField

Looks like the local BlobField inherits from that BlobField, and given
the error and code like...
http://nullege.com/codes/show/src@p@l@plomino-HEAD@trunk@Plomino@Products@CMFPlomino@PlominoDocument.py/588/plone.app.blob.field.BlobWrapper
it might be that BlobField differs between plone versions as to taking
an argument or not, e.g. it might be a change of basically...
-BlobWrapper()
to
+BlobWrapper(contenttype)


given that a contenttype is required, some total guesswork suggests...

-blob = BlobWrapper()
-if isinstance(value, basestring):
-# make StringIO from string, because StringIO may be adapted to
-#Blobabble
-value = StringIO(value)
-if value is not None:
-blobbable = IBlobbable(value)
-blobbable.feed(blob.getBlob())
-blob.setContentType(blobbable.mimetype())

might need to become

+if isinstance(value, basestring):
+# make StringIO from string, because StringIO may be adapted to
+#Blobabble
+value = StringIO(value)
+if value is not None:
+blobbable = IBlobbable(value)
+#move blob ctor down to where we know the mimetype
+blob = BlobWrapper(blobbable.mimetype())
+blobbable.feed(blob.getBlob())
+blob.setContentType(blobbable.mimetype()) #maybe drop this then

or something of that nature, you get my drift anyway. That the
super-class BlobWrapper may take an additional argument in your plone
over the version that the template that you based the above on works
with.

C.



More information about the LibreOffice mailing list