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

Jim Cain jec@mgmt-inc.com
Sat, 09 Oct 1999 23:44:33 -0400


--On Sat, Oct 9, 1999 23:28 -0400 Oscar Picasso <picasso@videotron.ca>
wrote:

> Try this, I think it should work:
> <dtml-with "_.namespace(var1=_.string.split(_['category_list_cookie'],
> ':'))">

Wish I had thought of that. :-)
Thanks very much; it worked.

Jim

> At 21:04 99-10-09 -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
>> 
>> 
>> Even with something like this:
>> 
>> <dtml-with "_.namespace(var1=category_list_cookie)">
>> <dtml-call "REQUEST.set('var2', _.string.split(var1, ':'))">
>> 
>> the split method gives the same error. Is var1 in the second example
>> merely a reference to category_list_cookie, so that I get the same
>> error? Whether or not this is the case, what does the error mean and how
>> do I fix it?
>> 
>> 
>> Cheers,
>> Jim
>> 
> 
> 
> ******************************************************
> Oscar Picasso
> picasso@videotron.ca
> ******************************************************
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 
> (Related lists - please, no cross posts or HTML encoding!
> 
> To receive general Zope announcements, see:
> http://www.zope.org/mailman/listinfo/zope-announce
> 
> For developer-specific issues, zope-dev@zope.org -
> http://www.zope.org/mailman/listinfo/zope-dev )



    ____________       Jim Cain, System Administrator     ___
   /  ________  \         http://jec.mgmt-inc.com        /  /
  /  / ______ \  \   _________   _______   _________  __/  /__
 /  / /  __  \ \  \ /  _   _  \ /  ___  \ /  _   _  \/_   ___/
/  / /  /_/  / /  //  //  //  //  /__/  //  //  //  / /  /___
\  \ \___,_  \/  //__//__//__/ \____   //__//__//__/  \_____/, inc.
 \  \______\____/             _____/  /
  \_______/                   \______/  http://www.mgmt-inc.com