[Zope] expected string or Unicode object, ImplicitAcquirerWrapper found

Marc Lindahl marc at bowery.com
Tue Mar 23 21:21:03 EST 2004


On Tuesday, March 23, 2004, at 03:25  PM, Dieter Maurer wrote:

> Marc Lindahl wrote at 2004-3-22 12:57 -0500:
>> I have a python script called logoName.py, as follows:
>>
>> return 'logo.jpg'
>>
>> then I'm trying to use that in a DTML method.  This works fine:
>>
>> &dtml-portal_url;/&dtml-logoName;
>>
>> Whereas this gives me an error:
>>
>> <dtml-var "_[logoName].getURL">
>> ...
>>       __traceback_info__: logoName
>>     * Module <string>, line 2, in f
>>     * Module AccessControl.DTML, line 32, in guarded_getitem
>>     * Module AccessControl.ZopeGuards, line 90, in guarded_getitem
>>
>> TypeError: expected string or Unicode object, ImplicitAcquirerWrapper
>> found
>
> "logoName" is an "ImplicitAcquirerWrapper" wrapping your Python Script.
> Thus, you should call it to get "logo.jpg".
>
> I expect that you somehow want to get the object with id "logo.jpg".
> This would look like:
>
>      "_.getitem(logoName())".


got it...  that works...  also looks like no way to get something that 
behaves like a variable or property but is really a python script 
returning something :(

>
> I do not know "getURL".
> The name suggests it is a method,
> then "_.getitem(logoName()).getURL" would be wrong.
> Instead, you would need to use "_.getitem(logoName()).getURL()".
> However, I expect, "getURL" is not the correct method...
>

yes, it's the wrong one - it's for catalogs.  I meant absolute_url(). 
Anyway....




More information about the Zope mailing list