X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=auth%2Fmanifoldbackend.py;h=73ba446a030e9cb8dc7c5b5d854e10290f370e43;hb=7002ccffe21d8f40bc0ad363c775dc9cdac7635b;hp=dbaf863cf98fd36ef8c3736f56a91b66ceb10f2e;hpb=fcebef2a30c4061ef8b7e302ad9e88554ed6803a;p=myslice.git diff --git a/auth/manifoldbackend.py b/auth/manifoldbackend.py index dbaf863c..73ba446a 100644 --- a/auth/manifoldbackend.py +++ b/auth/manifoldbackend.py @@ -2,7 +2,7 @@ import time from django.contrib.auth.models import User -from engine.manifoldapi import ManifoldAPI +from manifold.manifoldapi import ManifoldAPI, ManifoldResult # Name my backend 'ManifoldBackend' class ManifoldBackend: @@ -21,10 +21,14 @@ class ManifoldBackend: auth = {'AuthMethod': 'password', 'Username': username, 'AuthString': password} api = ManifoldAPI(auth) # Authenticate user and get session key - session = api.GetSession() - if not session : - return None + # the new API would expect Get('local:session') instead + session_result = api.GetSession() + session = session_result.ok_value() + if not session: + print "GetSession failed",session_result.error() + return + print 'DEALING with session',session #self.session = session # Change GetSession() at some point to return expires as well expires = time.time() + (24 * 60 * 60) @@ -34,8 +38,13 @@ class ManifoldBackend: self.api = api # Get account details - person = api.GetPersons(auth)[0] - self.person = person + # the new API would expect Get('local:user') instead + persons_result = api.GetPersons(auth) + persons = persons_result.ok_value() + if not persons: + print "GetPersons failed",persons_result.error() + return + person = persons[0] request.session['manifold'] = {'auth': api.auth, 'person': person, 'expires': expires} except: