-----Original Message----- From: Phil Harris [mailto:phil.harris@zope.co.uk] Sent: Sunday, December 19, 1999 5:58 PM To: Zope@zope.org Subject: [Zope] Part-time tracebacks
Hi all,
I have a problem.
I have a folder that contains file objects that contain text/xml. (I know I could have used XMLDocuments, but I found them too slow).
These documents are being rendered to html via xsl in an external method, using a java based xsl processor and this is pretty much working well, but.
Some of the documents cause the error below, any ideas?
Error Type: TypeError Error Value: argument 1: expected read-only character buffer, ImplicitAcquirerWrapper found
Most objects in Zope are wrapped up with special wrappers that allow the Acquisition machinery to work. Your code is looking for a string, but finding a wrapped object. Zope usualy handles all of these details for you, but when you drop down to python you have to be aware of them sometimes. if you wrapped object is called 'obj', then the *unwrapped* version of that exact same object can be gotten with 'obj.aq_self'. You can do a simple test in python: if hasattr(obj, 'aq_self'): # then it's wrapped obj = obj.aq_self This will unwrap the object for you. -Michel
Right..... But why would documents of exactly the same Zope type and content-type behave differently??? These were all File with a type of text/xml, so why the difference??? Phil phil.harris@zope.co.uk |>-----Original Message----- |>From: Michel Pelletier [mailto:michel@digicool.com] |>Sent: Tuesday, December 21, 1999 2:26 PM |>To: 'Phil Harris'; Zope@zope.org |>Subject: RE: [Zope] Part-time tracebacks |> |> |>> -----Original Message----- |>> From: Phil Harris [mailto:phil.harris@zope.co.uk] |>> Sent: Sunday, December 19, 1999 5:58 PM |>> To: Zope@zope.org |>> Subject: [Zope] Part-time tracebacks |>> |>> Hi all, |>> |>> I have a problem. |>> |>> I have a folder that contains file objects that contain |>> text/xml. (I know I |>> could have used XMLDocuments, but I found them too slow). |>> |>> These documents are being rendered to html via xsl in an |>> external method, |>> using a java based xsl processor and this is pretty much |>> working well, but. |>> |>> Some of the documents cause the error below, any ideas? |>> |>> Error Type: TypeError |>> Error Value: argument 1: expected read-only character buffer, |>> ImplicitAcquirerWrapper found |> |>Most objects in Zope are wrapped up with special wrappers that allow the |>Acquisition machinery to work. Your code is looking for a string, but |>finding a wrapped object. Zope usualy handles all of these details for |>you, but when you drop down to python you have to be aware of them |>sometimes. |> |>if you wrapped object is called 'obj', then the *unwrapped* version of |>that exact same object can be gotten with 'obj.aq_self'. You can do a |>simple test in python: |> |> if hasattr(obj, 'aq_self'): # then it's wrapped |> obj = obj.aq_self |> |>This will unwrap the object for you. |> |>-Michel |>
participants (2)
-
Michel Pelletier -
Phil Harris