summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlaniel <dlaniel@3ed937ae-f919-0410-9a43-8e6f19e4ba6e>2009-03-09 14:26:52 (GMT)
committerdlaniel <dlaniel@3ed937ae-f919-0410-9a43-8e6f19e4ba6e>2009-03-09 14:26:52 (GMT)
commitb606112554dbdad0d0eef37c0b57dc1296d19ccf (patch)
tree9dc0092544fad7ed6940c3dbf0e6689a97be86de
parent96e8fcf660178445a73f1452d29a9a8a37e0c92c (diff)
downloadlarpe-b606112554dbdad0d0eef37c0b57dc1296d19ccf.zip
larpe-b606112554dbdad0d0eef37c0b57dc1296d19ccf.tar.gz
larpe-b606112554dbdad0d0eef37c0b57dc1296d19ccf.tar.bz2
use soap_call and SOAPException from qommon
git-svn-id: svn+ssh://labs.libre-entreprise.org/svnroot/larpe@457 3ed937ae-f919-0410-9a43-8e6f19e4ba6e
-rw-r--r--larpe/trunk/larpe/liberty.ptl22
1 files changed, 1 insertions, 21 deletions
diff --git a/larpe/trunk/larpe/liberty.ptl b/larpe/trunk/larpe/liberty.ptl
index 98e0139..193dd19 100644
--- a/larpe/trunk/larpe/liberty.ptl
+++ b/larpe/trunk/larpe/liberty.ptl
@@ -14,6 +14,7 @@ import lasso
from qommon import get_logger
from qommon.form import *
from qommon.template import *
+from qommon.liberty import soap_call, SOAPException
import misc
from users import User
@@ -369,24 +370,3 @@ class Liberty(Directory):
get_response().set_content_type('text/plain')
public_key = open(host.public_key).read()
return public_key
-
-
-class SOAPException(Exception):
- pass
-
-
-def soap_call(url, msg):
- if url.startswith('http://'):
- host, query = urllib.splithost(url[5:])
- conn = httplib.HTTPConnection(host)
- else:
- host, query = urllib.splithost(url[6:])
- conn = httplib.HTTPSConnection(host)
- conn.request('POST', query, msg, {'Content-Type': 'text/xml'})
- response = conn.getresponse()
- data = response.read()
- conn.close()
- if response.status not in (200, 204): # 204 ok for federation termination
- get_logger().warn('SOAP error (%s) (on %s)' % (response.status, url))
- raise SOAPException()
- return data