[Twisted-web] is there needless complexity in the nevow userdb example?

Dan Aronson dan+twisted at catolabs.org
Tue Jun 20 13:16:18 CDT 2006

I'm boldly taking the step into Nevow, lots of concepts, but I'm
beginning to grok them.

Could someone be kind enough to explain to me what I see as needless
complexity in the userdb example.

I don't understand why the user and userdb need to be stored in the
session attribute.

Since they are passed in from the portal, why can't the portal just use
them directly in the childFactory of UserBrowsePage

    def childFactory(self, ctx, name):

        #make sure our child nodes have access to these session objects


        # name == the username of the user in the database.

        user = self.userManager.findUser(name)

        if user is None:

            return None

        #return page for a particular user object

        return UserPage(user)

since the UserPage instance being created has the user being passed, it
seems to me that it can also be passed the userdb and then that instance
wouldn't need to look of the user and db from the session, since it
would already have it as instance variables.

What am I missing?


More information about the Twisted-web mailing list