[Twisted-Python] Store an instance of a connection - twisted.web
How I store an instance of a connection in twisted.web? I have seen request.getSession() but I searched and there are very few examples of how it is stored and retrieved later. I want to store the ldap connection in a session for retrieve later. Thanks. def render_POST(self, request): command = request.path[1:] session = request.getSession() if command == "authentication": Connect = LdapConnection(request.args['host'][0],request.args['user'][0],request.args['password'][0]) session.addComponent(LdapConnection, Connect) if command == "users": Connect = session.getComponent(LdapConnection) u = Users(Connect, request.args['name'][0],request.args['employeeNumber']) return
On 08:42 am, manuito@gmail.com wrote:
How I store an instance of a connection in twisted.web? I have seen request.getSession() but I searched and there are very few examples of how it is stored and retrieved later.
I want to store the ldap connection in a session for retrieve later. Thanks.
def render_POST(self, request):
command = request.path[1:] session = request.getSession()
if command == "authentication": Connect = LdapConnection(request.args['host'][0],request.args['user'][0],request.args['password'][0]) session.addComponent(LdapConnection, Connect)
if command == "users": Connect = session.getComponent(LdapConnection) u = Users(Connect, request.args['name'][0],request.args['employeeNumber'])
return
How about the answer here? http://stackoverflow.com/questions/4936994/store-an-instance-of-a -connection-twisted-web Jean-Paul
participants (2)
-
exarkun@twistedmatrix.com
-
Manu