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

Jeff Peterson jpeterso@rangebroadband.com
Fri, 11 Jan 2002 13:41:07 -0600


You used '' as your search pattern rather than ' ', there is a difference.

'' is "empty" (hence the error message) where ' ' is a space.

Good luck.

--
Jeffrey D. Peterson
Webmaster
Range TV Cable & Broadband
1818 E. 3rd Ave.  Hibbing, MN 55746
jpeterso@rangebroadband.com


> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Mike
> Doanh Tran
> Sent: Friday, January 11, 2002 1:23 PM
> To: Oleg Broytmann; aaron@spvi.com
> Cc: zope@zope.org; lazug@lazug.org
> Subject: Re: [Zope] converting spaces in dtml-var to something else
>
>
> 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.
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>