[Zope-dev] NASTY error. Why?
Dieter Maurer
dieter@handshake.de
Mon, 10 Jul 2000 20:09:52 +0200 (CEST)
Chris Withers writes:
> I'm trying to do a tree walk and copy with:
>
> <dtml-in objectValues>
> <dtml-call "REQUEST['where'][-1].manage_addFolder(id)">
> Created <dtml-var id> in <dtml-var "REQUEST['where'][-1].id"><BR>
> <dtml-if "meta_type=='Folder'">
> <dtml-call "REQUEST['where'].append(this())">
> <dtml-var iterate>
> <dtml-call "REQUEST['where'].pop()">
>
> ....etc...
>
> but I get the following truly horrible error from the manage_addFolder
>
> any ideas?
>
> Chris
>
> Error Type: TypeError
> Error Value: read-only character buffer, Python Method
"manage_addFolder" wants to have a string argument (that is
what "read-only character buffer" usually means).
Instead, it get a "Python Method".
Explanation:
"id" is often a method returning a string, not directly a string.
Sometimes, i.e. for some classes, it is the string itself.
You may use "_['id']". This is equivalent to "id()", if
"id" is callable and to "id", if it is not.
Dieter