Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


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.


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.