[Zope] Faking default method for ZSQL w/pluggable brain

Dieter Maurer dieter@handshake.de
Wed, 28 Feb 2001 21:04:04 +0100 (CET)


Joel Burton writes:
 > For ZSQL methods, I'd rather there appear to be a default method.
 > 
 > So, searching staff_by_id for #17, instead of
 > 
 >    /staff_by_id/15/viewFull
 > 
 > you could search for 
 > 
 >    /staff_by_id/15
 > 
 > and get the same thing (this maps better to our previous, non-Zope 
 > directory structure.)
 > 
 > So, I wrote a Pluggable Brain for staff_by_id:
 > 
 > class Staff:
 > 	"""Pluggable brain for SCW Staff"""
 > 		
 > 	def index_html(self):
 > 		"Return a default method for this staff person."
 > 		return self.viewFull.__call__(self)
 > 
 > 
 > This works fine -- unless my DTML Method viewFull wants to look at 
 > PARENTS[], AUTHENTICATED_USER, or a whole other slew of things.
Try:

  		return self.viewFull.__call__(self,self.REQUEST)