[Twisted-web] [Nevow] new chapter about authentication

Manlio Perillo manlio_perillo at libero.it
Fri Aug 4 10:33:59 CDT 2006

Valentino Volonghi aka Dialtone ha scritto:

> [...]

>>> I can't think of this feature in a pluggable way. If you want it just
>>> code it in your Session object. It's fairly easy to do.
>> Yes, but you have to handle the initialization code by hand
>> (self.count = 0).
> You would anyway. I'm not going to have Componentized classes in Nevow
> anymore, it's a bad idea because the session is not really meant to
> store arbitrary objects (it would be a problem once you need to persist
> that kind
> of session later on). 

You are not fair ;-).
You *do* store some objects on your session (the guard and the
authenticatedAs attributes)...

Moreover I have said that you should follow the example of cred, and
cred is not componentized at all.

class SessionManager(object):
   def __init__(self):
       self.factories = {}

   def registerSessionFactory(self, sf, iface=ISession):
       self.factories[iface] = sf

   def getSession(self, iface=ISession):
       sf = self.factories[iface]
       return sf

> Also it would use the session as a storage for
> objects which is a bad way to program. Of course it is possible anyway,
> but at least it's not encouraged by the framework.

I'm really not sure if this is a bad way of program.

Regards  Manlio Perillo

More information about the Twisted-web mailing list