[Zope] Exporting an URL with a file extension from a product

Dieter Maurer dieter@handshake.de
Wed, 29 Aug 2001 21:43:50 +0200 (CEST)


Gregory Popovitch writes:
 > How can I export an URL named "stylesheet.css" from a python product?
Usually you use:

	class XXXX:
	    .....
	    name= DTMLFile(....) # or something similar


If "name" is not a valid Python name, you can use:

        class XXXX:
	    ......

	# note the indentation! The class definition is complete!
	setattr(XXXX, name, DTMLFile(....))

In your case:

	setattr(XXXX, 'stylesheet.css', DTMLFile(....))


An alternative would be:

        class XXXX:
	    .....
	    locals()[name] = DTMLFile(....)
	    .....


Dieter