[Zope] dtml-lesson learned...

Paul Winkler pw_lists@slinkp.com
Tue, 20 Aug 2002 07:28:38 -0700


On Tue, Aug 20, 2002 at 07:01:02AM -0700, Paul Winkler wrote:
> return context.title.split('#')[1]


... and to follow up on your latest discovery - 
always do error checking - I'd do it like this:

try:
    title_parts = context.title.split('#', maxsplit=1)[1]
    return title_parts[1]

except IndexError:   # there is no '#' in the title
    return title

--

Paul Winkler
"Welcome to Muppet Labs, where the future is made - today!"