[Twisted-Python] HTTP Authentication Example for review

David McCurley David.McCurley at technologist.com
Wed Jul 16 16:46:46 EDT 2003

But MyGuard doesn't have isLeaf=True because its not a leaf.  Its at the
top of some resource tree/subtree that it guards.  

I thought I had some type of problem with setting isLeaf=True in MyGuard
and it not giving me the behavior I wanted (maybe only if it was the
root resource).  That is, if I'm remembering the other night correctly
:)  Maybe I'll read through the source again so I can figure out again
why I don't have isLeaf.  I'm almost sure there is/was a reason.


On Wed, 2003-07-16 at 15:52, Christopher Armstrong wrote:
> On Wed, Jul 16, 2003 at 03:00:26PM -0400, David McCurley wrote:
> > The one thing so far that I don't like (ref MyGuard) is that it looks
> > like I have to do checks in the following methods (at least):
> > 
> > render()
> > getChild()
> > getChildWithDefault()
> > getChildForRequest()
> No, you only need to override render and
> getChildWithDefault. getChildForRequest will call getChildWithDefault,
> and getChildWithDefault is responsible for calling getChild. So as
> long as you have isLeaf=True, getChildWithDefault will catch any
> getChild.
> > class MyAuth(baseRes):
> >     isLeaf = True

More information about the Twisted-Python mailing list