[Zope] Applying fmt rules to variables

Casey Duncan cduncan@kaivo.com
Tue, 27 Feb 2001 08:56:37 -0700


Paz wrote:
> 
> Hi all,
> 
> I have an old system Im migrating that makes use of images that are kept in
> numbered directories. The mehtod they were saved before required that the
> whitespace in the names had a +.
> 
> In other words, something like <dtml-var name url_quote_plus>
> 
> BUT,
> 
> I need to actually save these files, and the above formatting rule only
> seems to be applyable to output. How can I do something like
> 
> <dtml-call "REQUEST.set('name', lname fmt=url_quote_plus)">
> 
> I know thats obviously NOT how to do it, but Im wondering at this point if
> it is at all, or do I have to rename all 600 files to not use +?
> 
> I guess, first would be to do a string search and replace, but Im not sure
> where to start....
> 
> Cheers,
> Paz

I would suggest using an external python method. The python module
urllib contains a quote_plus() function that does what you want. Trying
to do this with DTML would be cumbersome.

-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>