[Zope] Re: [Zope-CMF] Checking if...

Dieter Maurer dieter@handshake.de
Tue, 10 Jul 2001 20:07:28 +0200 (CEST)


James van der Veen writes:
 > ....
 > So now my question:
 >  How can I make the link change depending on if there already exists a
 > stylesheet_properties in custom 
 > (URL/custom/stylesheet_properties)and if not like them to the
 > stylesheet_properties of generic(URL/generic/stylesheet_properties)
The link goes to a Python script thats, whether "custom" has
the "stylesheet_properties" already. If not, it creates it first.
Then it modifies the object.

Checking is possible like this:

	 try:
	   style= context.custom['stylesheet_properties']
	   # it is already there
	 except KeyError:
	   # it is not yet there
	   ....


Dieter