[Twisted-Python] Twisted newb I can't add a cred checker to a Factory class
adamjamesdrew same
theiklabs at gmail.com
Tue Jan 26 14:40:43 MST 2010
class ProxyIncomingProtocol(Protocol):
.....
class ProxyOutgoingProtocol(Protocol):
.....
class ProxyFactory(Factory):
protocol = ProxyIncomingProtocol
class SimplePerspective(pb.Avatar):
def perspective_echo(self, text):
print 'echoing',text
return text
def logout(self):
print self, "logged out"
class SimpleRealm:
implements(IRealm)
def requestAvatar(self, avatarId, mind, *interfaces):
if pb.IPerspective in interfaces:
avatar = SimplePerspective()
return pb.IPerspective, avatar, avatar.logout
else:
raise NotImplementedError("no interface")
portal = Portal(SimpleRealm())
checker = InMemoryUsernamePasswordDatabaseDontUse()
checker.addUser("guest", "password")
portal.registerChecker(checker)
proxy_factory = proxy.ProxyFactory()
# ??????? how can I add the portal to the factory?
internet.GenericServer(cometsession.Port, factory=proxy_factory,
resource=root_resource, childName="tcp",
interface=INTERFACE).setServiceParent(serviceCollection)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20100126/239412c6/attachment.html>
More information about the Twisted-Python
mailing list