[Zope] converting spaces in dtml-var to something else

Mike Doanh Tran mtran@shufflemasterrd.com
Fri, 11 Jan 2002 12:23:20 -0700


The attribute that i was looking for was "url_quote_plus", I should have 
explained my situation in more details.

Thanks guys.  The Zope community have been really responsive and kind.
Thanks, I really appreciate that. 

I got an "empty pattern string" error when i tried
<dtml-var "_.string.replace(myVar, ' ', '+')"> 

Here's the traceback:

Error Type: ValueError
 Error Value: empty pattern string
Traceback (innermost last):
  File /var/Zope/lib/python/ZPublisher/Publish.py, line 223, in publish_module
  File /var/Zope/lib/python/ZPublisher/Publish.py, line 187, in publish
  File /var/Zope/lib/python/Zope/__init__.py, line 226, in 
zpublisher_exception_hook
    (Object: release_mgt)
  File /var/Zope/lib/python/ZPublisher/Publish.py, line 171, in publish
  File /var/Zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
    (Object: releaseInfo)
  File /var/Zope/lib/python/ZPublisher/Publish.py, line 112, in call_object
    (Object: releaseInfo)
  File /var/Zope/lib/python/OFS/DTMLDocument.py, line 199, in __call__
    (Object: releaseInfo)
  File /var/Zope/lib/python/DocumentTemplate/DT_String.py, line 546, in 
__call__
    (Object: releaseInfo)
  File /var/Zope/lib/python/DocumentTemplate/DT_In.py, line 770, in renderwob
    (Object: getReleaseInfo)
  File /var/Zope/lib/python/DocumentTemplate/DT_Util.py, line 231, in eval
    (Object: _.string.replace(product,'','+'))
    (Info: _)
  File <string>, line 2, in f
    (Object: guarded_getattr)
  File /var/Zope/lib/python2.1/string.py, line 369, in replace
ValueError: (see above)




On Friday 11 January 2002 11:38, you wrote:
> On Fri, Jan 11, 2002 at 11:21:35AM -0700, Mike Doanh Tran wrote:
> > What i want to do is to convert all spaces in a string to a "+" sign.
>
>    <dtml-var "_.string.replace(myVar, ' ', '+')">
>
> Oleg.

-- 
Mike Doanh Tran
Shufflemaster Gaming Inc.