X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=manifoldapi%2Fmanifoldapi.py;h=796d0a52dfbe331ca7d03ed46da86267f82bcb48;hb=963600348f98d1c2c98d49b88084c094ff3ccb9b;hp=b105bf30c762c432a0a45d2772cb4834c0243dd8;hpb=31b87e762d7430afeb81cf45f0b8c086cda91095;p=unfold.git diff --git a/manifoldapi/manifoldapi.py b/manifoldapi/manifoldapi.py index b105bf30..796d0a52 100644 --- a/manifoldapi/manifoldapi.py +++ b/manifoldapi/manifoldapi.py @@ -1,9 +1,10 @@ # Manifold API Python interface -import copy, xmlrpclib +import copy, xmlrpclib, ssl from myslice.configengine import ConfigEngine from django.contrib import messages +from django.shortcuts import redirect from manifoldresult import ManifoldResult, ManifoldCode, ManifoldException from manifold.core.result_value import ResultValue @@ -40,7 +41,13 @@ class ManifoldAPI: self.calls = {} self.multicall = False self.url = ConfigEngine().manifold_url() - self.server = xmlrpclib.Server(self.url, verbose=False, allow_none=True) + + # Manifold uses a self signed certificate + # https://www.python.org/dev/peps/pep-0476/ + if hasattr(ssl, '_create_unverified_context'): + self.server = xmlrpclib.Server(self.url, verbose=False, allow_none=True, context=ssl._create_unverified_context()) + else : + self.server = xmlrpclib.Server(self.url, verbose=False, allow_none=True) def __repr__ (self): return "ManifoldAPI[%s]"%self.url @@ -154,7 +161,7 @@ def execute_query(request, query): request.session.flush() #raise Exception, "User not authenticated" host = request.get_host() - return redirect(host) + return redirect('/') manifold_api_session_auth = request.session['manifold']['auth'] return _execute_query(request, query, manifold_api_session_auth)