[Zope] ZClasses and FTP/WebDAV

sean.upton@uniontrib.com sean.upton@uniontrib.com
Mon, 16 Dec 2002 16:08:58 -0800


One thing that is a pain about ZClasses is that when you want to call the
method of a particular superclass, you have to do some really nasty digging
with an external method to specify it, unlike in python products.  This
seems like it might be related to your problem.  You would want to simply
have your class call the manage_FTPget, manageFTP_list, manage_FTPstat, and
PUT() of the PageTemplate class.  In python, you would do this like:

class A:
	def manage_FTPlist(self,REQUEST):
		#do something here

class B(A):
	def manage_FTPlist(self,REQUEST):
		return A.manageFTPlist(self,REQUEST)

But, alas, you need to get a reference to the class A, which is very hard in
a ZClass.  You could do likely this with some very deep digging in an
external method (something resembling this):

def getPageTemplateClass(self):
	clist = self.___class__.__bases__ #get tuple of all base classes
	for superc in clist:
		if superc.__name__ == 'ZopePageTemplate':
			return superc #return the ZPT class
	return self.__class__ #fallback/default: return our own class

You would then need to create external methods for each of the 4 FTP methods
named above and call the appropriate method of the ZopePageTemplate class
returned by the above external method.  The said methods would use the above
method to get access to the superclass

A lot of this might be easier in a Python product. The Zope Bible is a
pretty good reference/tutorial for building products.  My guess is that
trying to do this as a ZClass would actually be harder than as a Python
Product.

Sean

You wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

My ZClass is based off Page Template and CatalogAware (vis a vis a
CatalogAware
wrapper for Page Templates! Is there any reason the developers are not
making
older types CatalogAware to save us this trouble and make the ZCatalog that
much
more usefull? I digress.)

I had hoped the inheritance from Page Templates would have handled the
required
functions, but it does not. I can see where I might begin to move towards a
solution in a Python Product, but not at all with a ZClass. It's a pity, as
I'm
so very close to being where I want with this. If anyone has any further
thoughts on manipularing the inner workings of a ZClass, I'd find that
tremendously helpful. In lieu of that, a primer on how to make a Python
Product
would be nice as it looks like I'll be working overtime...

But, for the time being, I'll work with the ancient patch mentioned
previously
to see if I can incorporate the features I desire into Zope 2.6

Ed