[Twisted-Python] Patch for dbauth.tac in examples

Steve Waterbury steve.waterbury at gsfc.nasa.gov
Tue Jul 30 11:12:49 EDT 2002


Since I want to implement a PB-based app with db authorization, I 
was tinkering with the dbauth.tac example in an effort to educate 
myself.  Changed "passport" to "cred" and set the database explicitly 
(created the dbcred tables in the "twisted" database that bugs uses).  

"Create an Identity", "remove", and "[change] password" work; there 
seems to be a problem with gotPerspectives' call to dbgadgets.py, but 
I haven't messed with gadgets (don't need them yet), so I won't be 
looking at that.  (A gadgets cognoscente could fix it in seconds, 
anyway, I'm sure!  ;^)  

Cheers,
-- Steve.

Stephen C. Waterbury  http://misspiggy.gsfc.nasa.gov/people/waterbug.html
-------------- next part --------------
*** dbauth.tac	Tue Jul 30 10:25:04 2002
--- dbauth-new.tac	Tue Jul 30 09:50:37 2002
***************
*** 1,18 ****
  #!python
  
  from twisted.internet.app import Application
- from twisted.internet import passport
  from twisted.words import service, ircservice
! from twisted.enterprise import adbapi, dbpassport, dbgadgets
  from twisted.web import server
  
! auth = dbpassport.DatabaseAuthorizer(adbapi.ConnectionPool("pyPgSQL.PgSQL"))
  a = Application("db-auth", authorizer=auth)
  ws = service.Service("twisted.words", a)
  
  gdgt = dbgadgets.IdentitiesGadget(auth)
  
! a.listenOn(8486, server.Site(gdgt))
  
  a.listenTCP(6667, ircservice.IRCGateway(ws))
  
--- 1,17 ----
  #!python
  
  from twisted.internet.app import Application
  from twisted.words import service, ircservice
! from twisted.enterprise import adbapi, dbcred, dbgadgets
  from twisted.web import server
  
! auth = dbcred.DatabaseAuthorizer(adbapi.ConnectionPool("pyPgSQL.PgSQL", database="twisted"))
  a = Application("db-auth", authorizer=auth)
  ws = service.Service("twisted.words", a)
  
  gdgt = dbgadgets.IdentitiesGadget(auth)
  
! a.listenTCP(8486, server.Site(gdgt))
  
  a.listenTCP(6667, ircservice.IRCGateway(ws))
  


More information about the Twisted-Python mailing list