[Zope] Using string.split() on a DTML method

Michel Pelletier michel@digicool.com
Sun, 10 Oct 1999 17:45:22 -0400


Jim Cain wrote:
> 
> I have a DTML method, category_list_cookie, which returns a string of
> colon-separated values I use elsewhere. I would like to split this into a
> list so I can use something like phred.count('whatever') to see if this
> value is present.
> 
> However, when I do something like:
> 
> <dtml-with "_.namespace(var1=_.string.split(category_list_cookie, ':'))">
> 
> I get this error:
> 
> Error Type: TypeError
> Error Value: argument 1: expected read-only character buffer,
> ImplicitAcquirerWrapper found

So category_list_cookie is not a string.  I'm not sure if cookies are
meant to be strings, or if your variable is actually a cookie.  Try:

<dtml-var "_.repr(category_list_cookie)">

to find out what it is.  Sounds alot from your traceback like it's a
Zope object.  In that case:

<dtml-with category_list_cookie>
  <dtml-var absolute_url>
</dtml-with>

Will tell you what it is.  This could point out any possible logic
errors in your assignment.

-Michel