[Zope] Using ZPT with options/radio/checkboxes

Paul Winkler pw_lists at slinkp.com
Thu Aug 7 17:08:32 EDT 2003


On Thu, Aug 07, 2003 at 03:44:30PM -0400, Ron Bickers wrote:
> I remember now why I used the path() function with a nested python
> expression instead of the get method...
> 
> If you're using a variable other than 'request' (which we know will exist),
> you'll get an exception if that variable doesn't exist.  The path() function
> handles this gracefully and returns nothing.
> 
> So, how would you write the following more elegantly to handle when
> 'somevar' doesn't exist?
> 
> "python:test('A' in path('somevar/letters' | python:[]'), 'checked',
> nothing)"

I'd make sure it exists :-\
Seriously, when is this a problem? If somevar is at the top level,
you've either defined it somewhere or it's one of the built-in names.
If it's not either one, it must be a mistake.  What am I missing?

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's UNGODLY FIST CAPTAIN!
(random hero from isometric.spaceninja.com)



More information about the Zope mailing list