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

Curtis Maloney curtis@cardgate.net
Wed, 28 Feb 2001 14:40:18 +1100


On Wed, 28 Feb 2001 14:19, Joel Burton wrote:

Hey, there...

> For ZSQL methods, I'd rather there appear to be a default method.
>
> So, searching staff_by_id for #17, instead of
>
I'm going to assume you meant 15.. (o8

>    /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)
>

Just a wild stab in the dark, but have you tried:

def index_html(self, REQUEST, RESPONSE)
	"Return a default method for this staff person."
	return self.viewFull.__call__(self, REQUEST, RESPONSE)

>
> This works fine -- unless my DTML Method viewFull wants to look at
> PARENTS[], AUTHENTICATED_USER, or a whole other slew of things.
>
> Instead, trying
>
> 		return self.viewFull(self)
>
> doesn't help instead.
>
> What am I missing?
>
> Thanks for any help!
> --
> Joel Burton, Director of Information Systems -*- jburton@scw.org
> Support Center of Washington (www.scw.org)
>

Have a better one,
	Curtis Maloney