Re: [Zope] Truncating strings with DTML

2005-09-06 Thread Chris Withers

Peter Bengtsson wrote:

easy:

You don't need to use _.string.legacy() functions. Just put your
python expression inside the quotation marks. If you're new to python,
don't let DTML be your place to learn python. Use a nice editor like
IDLE.


Just to emphasise what Peter is saying: do this in ZPT and put the logic 
in a python script. You'll suffer a lot less in the long run as a result ;-)


cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Truncating strings with DTML

2005-09-05 Thread Peter Bengtsson
easy:

You don't need to use _.string.legacy() functions. Just put your
python expression inside the quotation marks. If you're new to python,
don't let DTML be your place to learn python. Use a nice editor like
IDLE.

PS. Which scripting language did you work with before you came to Zope?

On 9/5/05, Aaron Gillette <[EMAIL PROTECTED]> wrote:
> Hi All,
> 
> I'd like to take a string like:
> 
> /Computers/Data_Formats/Almost_Every_File_Format_in_the_World
> 
> and cut it down to:
> 
> /Computers/Data_Formats
> 
> using DTML.
> 
> I've tried to count to the last "/", and then truncate the string with
> ljust, like so:
> 
> 
> 
> 
> However, ljust/rjust won't truncate the string.
> 
> In the case above, I know that I want to truncate the string to 23
> characters (/Computers/Data_Formats). Is there a way to accomplish this
> in DTML? If not, any suggestions?
> 
> Thanks in advance,
> Aaron
> ___
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
> 


-- 
Peter Bengtsson, 
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )