[Zope] zope and python classes

Ted holden medved at fcc.net
Mon Oct 13 20:50:55 EDT 2003


If I could get the following to work, I'd have all the state maintenance I'd 
ever need.

I have a file called bearcl1.py with the lines:

class bearcl1:
	
	gstr = "a wet bird never flies at night"
	
	def getgstr(self):
		return self.gstr
		
	def setgstr( self, InputStr ):
		self.gstr =  InputStr


and a file called __init__.py with the lines:

from bearcl1 import bearcl1

def initialize(context):
        """
        Register base class

        """
        context.registerBaseClass(


both saved in a subdir called: 

/home/bear/zope/lib/python/Products/bearclxpt1/


and have created a product called bcl1 with a zclass called bzcl1 which 
subclasses bearcl1 and CatalogAware.  

Moreover, the class bzcl1 now shows up on my ADD list when constructing web 
pages so that I can have an object called bz1 of the class bzcl1 and a dtml 
page in the same folder and the dtml page contain a line like:

<dtml-var bz1.getgstr >

which looks like it ought to work ( and produce 'a wet biord never flies at 
night' on the resulting page ) but doesn't.

Again, if I could get that much to work I'd basically be home free.  I'd 
appreciate any suggestions.


Ted Holden




















More information about the Zope mailing list