summaryrefslogtreecommitdiffstats
path: root/bindings/python
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2008-09-12 15:06:58 +0000
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2008-09-12 15:06:58 +0000
commit9ed0670e48665f590eda685e0cfebf8c4cadb8fb (patch)
treea3f909876ca336256b304de9a350ab526d16abea /bindings/python
parent73d9c98f92b9664c6d78843c4110b71520fa3f67 (diff)
downloadlasso-9ed0670e48665f590eda685e0cfebf8c4cadb8fb.tar.gz
lasso-9ed0670e48665f590eda685e0cfebf8c4cadb8fb.tar.xz
lasso-9ed0670e48665f590eda685e0cfebf8c4cadb8fb.zip
* Remove ending blanks
Diffstat (limited to 'bindings/python')
-rw-r--r--bindings/python/lang.py8
-rw-r--r--bindings/python/tests/XmlTestRunner.py6
-rwxr-xr-xbindings/python/tests/binding_tests.py4
-rwxr-xr-xbindings/python/tests/idwsf1_tests.py18
-rwxr-xr-xbindings/python/tests/idwsf2_tests.py26
-rwxr-xr-xbindings/python/tests/profiles_tests.py6
-rwxr-xr-xbindings/python/tests/tests.py10
-rw-r--r--bindings/python/wrapper_top.c42
8 files changed, 60 insertions, 60 deletions
diff --git a/bindings/python/lang.py b/bindings/python/lang.py
index 26d86d53..8fdd4385 100644
--- a/bindings/python/lang.py
+++ b/bindings/python/lang.py
@@ -1,5 +1,5 @@
# Lasso - A free implementation of the Liberty Alliance specifications.
-#
+#
# Copyright (C) 2004-2007 Entr'ouvert
# http://lasso.entrouvert.org
#
@@ -33,7 +33,7 @@ class Binding:
def is_pygobject(self, t):
if t:
m = re.match(r'(?:const\s*)?(.*)',t) # Remove const modifier
- t = m.group(1)
+ t = m.group(1)
return t not in ['char*', 'gchar*',
'GList*', 'GHashTable*',
'int', 'gint', 'gboolean', 'xmlNode*'] + self.binding_data.enums
@@ -106,7 +106,7 @@ class frozendict(dict):
print >> fd, '''\
class Error(Exception):
code = None
-
+
@staticmethod
def raise_on_rc(rc):
global exceptions_dict
@@ -270,7 +270,7 @@ if WSF_SUPPORT:
c_args.append('%s._cptr' % arg_name)
else:
c_args.append(arg_name)
-
+
c_args = ', '.join(c_args)
py_args = ', ' + ', '.join(py_args)
print >> fd, ' def __init__(self%s):' % py_args
diff --git a/bindings/python/tests/XmlTestRunner.py b/bindings/python/tests/XmlTestRunner.py
index 152dc8b2..3fa8a239 100644
--- a/bindings/python/tests/XmlTestRunner.py
+++ b/bindings/python/tests/XmlTestRunner.py
@@ -5,19 +5,19 @@
# XmlTestRunner
#
# Copyright (C) 2004-2007 Entr'ouvert
-#
+#
# Authors: Frederic Peters <fpeters@entrouvert.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
diff --git a/bindings/python/tests/binding_tests.py b/bindings/python/tests/binding_tests.py
index d86d519b..872d2f3c 100755
--- a/bindings/python/tests/binding_tests.py
+++ b/bindings/python/tests/binding_tests.py
@@ -14,12 +14,12 @@
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
diff --git a/bindings/python/tests/idwsf1_tests.py b/bindings/python/tests/idwsf1_tests.py
index 3dc5cf86..a2f26b83 100755
--- a/bindings/python/tests/idwsf1_tests.py
+++ b/bindings/python/tests/idwsf1_tests.py
@@ -12,12 +12,12 @@
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -98,7 +98,7 @@ class IdWsf1TestCase(unittest.TestCase):
sp_login.request.nameIdPolicy = lasso.LIB_NAMEID_POLICY_TYPE_FEDERATED
sp_login.request.protocolProfile = lasso.LIB_PROTOCOL_PROFILE_BRWS_POST
sp_login.buildAuthnRequestMsg()
-
+
idp_login = lasso.Login(idp)
idp_login.processAuthnRequestMsg(sp_login.msgBody)
idp_login.validateRequestMsg(True, True)
@@ -182,7 +182,7 @@ class DiscoveryModifyTestCase(IdWsf1TestCase):
# Process Modify
request_type = lasso.getRequestTypeFromSoapMsg(wsp_disco.msgBody)
- self.failUnless(request_type == lasso.REQUEST_TYPE_DISCO_MODIFY)
+ self.failUnless(request_type == lasso.REQUEST_TYPE_DISCO_MODIFY)
idp_disco = lasso.Discovery(self.idp)
idp_disco.processModifyMsg(wsp_disco.msgBody)
idp_disco.setIdentityFromDump(idp_identity_dump)
@@ -216,7 +216,7 @@ class DiscoveryRemoveTestCase(IdWsf1TestCase):
# Process Modify
request_type = lasso.getRequestTypeFromSoapMsg(wsp_disco.msgBody)
- self.failUnless(request_type == lasso.REQUEST_TYPE_DISCO_MODIFY)
+ self.failUnless(request_type == lasso.REQUEST_TYPE_DISCO_MODIFY)
idp_disco = lasso.Discovery(self.idp)
idp_disco.processModifyMsg(wsp_disco.msgBody)
idp_disco.setIdentityFromDump(idp_identity_dump)
@@ -274,7 +274,7 @@ class DataServiceModifyTestCase(IdWsf1TestCase):
wsc_service.buildRequestMsg()
request_type = lasso.getRequestTypeFromSoapMsg(wsc_service.msgBody)
- self.failUnless(request_type == lasso.REQUEST_TYPE_DST_MODIFY)
+ self.failUnless(request_type == lasso.REQUEST_TYPE_DST_MODIFY)
self.wsp = self.get_wsp_server()
wsp_service = lasso.DataService(self.wsp)
@@ -313,9 +313,9 @@ class DataServiceModifyTestCase(IdWsf1TestCase):
wsc_service = self.get_pp_service()
wsc_service.initModify(xpath, new_data)
wsc_service.buildRequestMsg()
-
+
request_type = lasso.getRequestTypeFromSoapMsg(wsc_service.msgBody)
- self.failUnless(request_type == lasso.REQUEST_TYPE_DST_MODIFY)
+ self.failUnless(request_type == lasso.REQUEST_TYPE_DST_MODIFY)
self.wsp = self.get_wsp_server()
wsp_service = lasso.DataService(self.wsp)
@@ -347,7 +347,7 @@ class DataServiceModifyTestCase(IdWsf1TestCase):
wsc_service.buildRequestMsg()
request_type = lasso.getRequestTypeFromSoapMsg(wsc_service.msgBody)
- self.failUnless(request_type == lasso.REQUEST_TYPE_DST_MODIFY)
+ self.failUnless(request_type == lasso.REQUEST_TYPE_DST_MODIFY)
self.wsp = self.get_wsp_server()
wsp_service = lasso.DataService(self.wsp)
diff --git a/bindings/python/tests/idwsf2_tests.py b/bindings/python/tests/idwsf2_tests.py
index 0c52a321..7500ab25 100755
--- a/bindings/python/tests/idwsf2_tests.py
+++ b/bindings/python/tests/idwsf2_tests.py
@@ -14,12 +14,12 @@
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -79,7 +79,7 @@ class IdWsf2TestCase(unittest.TestCase):
server.getProvider(server.providerIds[0]).setEncryptionMode(lasso.ENCRYPTION_MODE_NAMEID);
server.addProvider(lasso.PROVIDER_ROLE_SP, wsc_metadata, None, None)
self.idp_server_dump = server.dump()
-
+
return server
def idpRegisterSelf(self, idp_server):
@@ -131,7 +131,7 @@ class IdWsf2TestCase(unittest.TestCase):
idp_identity_dump = idp_login.identity.dump()
if idp_login.isSessionDirty:
idp_session_dump = idp_login.session.dump()
-
+
sp_login = lasso.Login(sp)
query = idp_login.msgUrl.split('?')[1]
query = query.replace("%3D", "=")
@@ -416,9 +416,9 @@ class MetadataAssociationAddTestCase(IdWsf2TestCase):
wsp_disco.setSessionFromDump(wsp_session_dump)
wsp_disco.initMetadataAssociationAdd(svcMDID)
wsp_disco.buildRequestMsg()
-
+
self.failUnless(wsp_disco.msgBody, 'missing msgBody')
-
+
def test05(self):
"""Process metadata association add request"""
idp = self.getIdpServer()
@@ -436,7 +436,7 @@ class MetadataAssociationAddTestCase(IdWsf2TestCase):
wsp_disco.buildRequestMsg()
idp_disco = lasso.IdWsf2Discovery(idp)
-
+
try:
idp_disco.processMetadataAssociationAddMsg(wsp_disco.msgBody)
except lasso.Error, e:
@@ -1217,7 +1217,7 @@ class DataServiceQueryTestCase(IdWsf2TestCase):
service, wsp = self.getProfileService()
lasso.registerIdWsf2DstService('pp2', 'urn:liberty:id-sis-pp:2005-05')
service.initQuery()
-
+
try:
service.addQueryItem('/pp2:PP/pp2:InformalName', 'name')
except lasso.Error, e:
@@ -1230,7 +1230,7 @@ class DataServiceQueryTestCase(IdWsf2TestCase):
service.initQuery()
service.addQueryItem('/pp2:PP/pp2:InformalName', 'name')
service.buildRequestMsg()
-
+
self.failUnless(service.msgBody, 'missing msgBody')
def test05(self):
@@ -1242,7 +1242,7 @@ class DataServiceQueryTestCase(IdWsf2TestCase):
service.addQueryItem('not existing attribute', 'not existing attribute')
service.addQueryItem('/pp2:PP/pp2:MsgContact', 'email')
service.buildRequestMsg()
-
+
self.failUnless(service.msgBody, 'missing msgBody')
def test06(self):
@@ -1589,7 +1589,7 @@ class DataServiceQueryTestCase(IdWsf2TestCase):
service.processQueryResponseMsg(wsp_service.msgBody)
informal_name = service.getAttributeNode()
-
+
self.failUnlessEqual(informal_name, """<pp2:InformalName xmlns="urn:liberty:id-sis-pp:2005-05" xmlns:pp2="urn:liberty:id-sis-pp:2005-05">User name</pp2:InformalName>""", 'first attribute node is wrong')
def test21(self):
@@ -1617,7 +1617,7 @@ class DataServiceQueryTestCase(IdWsf2TestCase):
service.processQueryResponseMsg(wsp_service.msgBody)
informal_name = service.getAttributeString('name')
-
+
self.failUnlessEqual(informal_name, 'User name', 'attribute string is wrong')
def test22(self):
@@ -1645,7 +1645,7 @@ class DataServiceQueryTestCase(IdWsf2TestCase):
service.processQueryResponseMsg(wsp_service.msgBody)
email = service.getAttributeNode('email')
-
+
expected_result = """<pp2:MsgContact xmlns="urn:liberty:id-sis-pp:2005-05" xmlns:pp2="urn:liberty:id-sis-pp:2005-05">.*?<pp2:MsgAccount>Email account</pp2:MsgAccount>.*?<pp2:MsgProvider>Email server</pp2:MsgProvider>.*?</pp2:MsgContact>"""
import re
diff --git a/bindings/python/tests/profiles_tests.py b/bindings/python/tests/profiles_tests.py
index 84647b21..b1dd0442 100755
--- a/bindings/python/tests/profiles_tests.py
+++ b/bindings/python/tests/profiles_tests.py
@@ -14,12 +14,12 @@
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -207,7 +207,7 @@ class LoginTestCase(unittest.TestCase):
self.failUnless('<action>do</action>' in extensionsList[0])
self.failUnless('<action2>do action 2</action2>' in extensionsList[0])
self.failUnless('<action3>do action 3</action3>' in extensionsList[0])
-
+
class LogoutTestCase(unittest.TestCase):
def test01(self):
diff --git a/bindings/python/tests/tests.py b/bindings/python/tests/tests.py
index 9915a64e..14c8c864 100755
--- a/bindings/python/tests/tests.py
+++ b/bindings/python/tests/tests.py
@@ -14,12 +14,12 @@
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -68,13 +68,13 @@ if options.xmlMode:
print """<testsuites xmlns="http://check.sourceforge.net/ns">"""
print """ <title>Python Bindings</title>"""
print """ <datetime>%s</datetime>""" % time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
-
+
success = True
for testSuite in testSuites:
fp, pathname, description = imp.find_module(testSuite)
- try:
+ try:
module = imp.load_module(testSuite, fp, pathname, description)
- finally:
+ finally:
if fp:
fp.close()
if not module:
diff --git a/bindings/python/wrapper_top.c b/bindings/python/wrapper_top.c
index 3e65393e..3a710ab7 100644
--- a/bindings/python/wrapper_top.c
+++ b/bindings/python/wrapper_top.c
@@ -50,7 +50,7 @@ get_dict_from_hashtable_of_objects(GHashTable *value)
item_value = g_hash_table_lookup(value, keys->data);
if (item_value) {
item = PyGObjectPtr_New(G_OBJECT(item_value));
- PyDict_SetItemString(dict, (char*)keys->data, item);
+ PyDict_SetItemString(dict, (char*)keys->data, item);
Py_DECREF(item);
} else {
PyErr_Warn(PyExc_RuntimeWarning, "hashtable contains a null value");
@@ -108,12 +108,12 @@ free_list(GList **a_list, GFunc free_help) {
}
/** Remove all elements from a_hash and replace them with
- * the key-values pairs from the python dict.
+ * the key-values pairs from the python dict.
* Increase reference of new values before removeing
* values from the hash, so if there are somme common
* values with RefCoun = 1 they won't be deallocated.
* */
-static void
+static void
set_hashtable_of_pygobject(GHashTable *a_hash, PyObject *dict) {
PyObject *key, *value;
int i;
@@ -132,7 +132,7 @@ set_hashtable_of_pygobject(GHashTable *a_hash, PyObject *dict) {
while (PyDict_Next(dict, &i, &key, &value)) {
if (! PyString_Check(key) || ! PyObject_TypeCheck(value, &PyGObjectPtrType))
{
- PyErr_SetString(PyExc_TypeError,
+ PyErr_SetString(PyExc_TypeError,
"value should be a dict,"
"with string keys"
"and GObjectPtr values");
@@ -155,7 +155,7 @@ failure:
}
}
-/** Set the GList* pointer, pointed by a_list, to a pointer on a new GList
+/** Set the GList* pointer, pointed by a_list, to a pointer on a new GList
* created by converting the python seq into a GList of char*.
*/
static void
@@ -170,7 +170,7 @@ set_list_of_strings(GList **a_list, PyObject *seq) {
for (i=0; i<l; i++) {
PyObject *pystr = PySequence_Fast_GET_ITEM(seq, i);
if (! PyString_Check(pystr)) {
- PyErr_SetString(PyExc_TypeError,
+ PyErr_SetString(PyExc_TypeError,
"value should be a tuple of strings");
goto failure;
}
@@ -183,7 +183,7 @@ failure:
free_list(&list, (GFunc)g_free);
}
-/** Set the GList* pointer, pointed by a_list, to a pointer on a new GList
+/** Set the GList* pointer, pointed by a_list, to a pointer on a new GList
* created by converting the python seq into a GList of xmlNode*.
*/
static void
@@ -199,7 +199,7 @@ set_list_of_xml_nodes(GList **a_list, PyObject *seq) {
PyObject *item = PySequence_Fast_GET_ITEM(seq, i);
xmlNode *item_node;
if (! PyString_Check(item)) {
- PyErr_SetString(PyExc_TypeError,
+ PyErr_SetString(PyExc_TypeError,
"value should be a tuple of strings");
goto failure;
}
@@ -213,7 +213,7 @@ failure:
free_list(&list, (GFunc)xmlFreeNode);
}
-/** Set the GList* pointer, pointed by a_list, to a pointer on a new GList
+/** Set the GList* pointer, pointed by a_list, to a pointer on a new GList
* created by converting the python seq into a GList of GObject*.
*/
static void
@@ -229,7 +229,7 @@ set_list_of_pygobject(GList **a_list, PyObject *seq) {
PyObject *item = PySequence_Fast_GET_ITEM(seq, i);
GObject *gobject;
if (! PyObject_TypeCheck(item, &PyGObjectPtrType)) {
- PyErr_SetString(PyExc_TypeError,
+ PyErr_SetString(PyExc_TypeError,
"value should be a tuple of PyGobject");
goto failure;
}
@@ -279,7 +279,7 @@ get_list_of_strings(const GList *a_list) {
PyTuple_SetItem(a_tuple, i, str);
i++;
} else {
- PyErr_Warn(PyExc_RuntimeWarning,
+ PyErr_Warn(PyExc_RuntimeWarning,
"list contains a NULL value");
}
a_list = a_list->next;
@@ -289,7 +289,7 @@ get_list_of_strings(const GList *a_list) {
return a_tuple;
failure:
PyErr_SetString(PyExc_TypeError, "Allocation problem in get_list_of_strings");
- Py_XDECREF(a_tuple);
+ Py_XDECREF(a_tuple);
return noneRef();
}
@@ -312,11 +312,11 @@ get_list_of_xml_nodes(const GList *a_list) {
PyTuple_SetItem(a_tuple, i, str);
i++;
} else {
- PyErr_Warn(PyExc_RuntimeWarning,
+ PyErr_Warn(PyExc_RuntimeWarning,
"could not convert an xmlNode to a string");
}
} else {
- PyErr_Warn(PyExc_RuntimeWarning,
+ PyErr_Warn(PyExc_RuntimeWarning,
"list contains a NULL value");
}
a_list = a_list->next;
@@ -326,7 +326,7 @@ get_list_of_xml_nodes(const GList *a_list) {
return a_tuple;
failure:
PyErr_SetString(PyExc_TypeError, "Allocation problem in get_list_of_strings");
- Py_XDECREF(a_tuple);
+ Py_XDECREF(a_tuple);
return noneRef();
}
@@ -350,11 +350,11 @@ get_list_of_pygobject(const GList *a_list) {
PyTuple_SetItem(a_tuple, i, pygobject);
i++;
} else {
- PyErr_Warn(PyExc_RuntimeWarning,
+ PyErr_Warn(PyExc_RuntimeWarning,
"could not convert a GObject to a PyGobject");
}
} else {
- PyErr_Warn(PyExc_RuntimeWarning,
+ PyErr_Warn(PyExc_RuntimeWarning,
"list contains a NULL value");
}
a_list = a_list->next;
@@ -364,7 +364,7 @@ get_list_of_pygobject(const GList *a_list) {
return a_tuple;
failure:
PyErr_SetString(PyExc_TypeError, "Allocation problem in get_list_of_strings");
- Py_XDECREF(a_tuple);
+ Py_XDECREF(a_tuple);
return noneRef();
}
@@ -390,7 +390,7 @@ PyGObjectPtr_dealloc(PyGObjectPtr *self)
static int
startswith(const char *string, const char *prefix)
{
- return strncmp(string, prefix, strlen(prefix)) == 0;
+ return strncmp(string, prefix, strlen(prefix)) == 0;
}
static PyObject*
@@ -438,7 +438,7 @@ static PyMemberDef PyGObjectPtr_members[] = {
{NULL}
};
-static PyObject*
+static PyObject*
PyGObjectPtr_get_refcount(PyGObjectPtr *self, G_GNUC_UNUSED void *closure)
{
PyObject *refcount;
@@ -495,7 +495,7 @@ set_object_field(GObject **a_gobject_ptr, PyGObjectPtr *a_pygobject) {
g_object_unref(*a_gobject_ptr);
}
if ((PyObject*)a_pygobject == Py_None) {
- *a_gobject_ptr = NULL;
+ *a_gobject_ptr = NULL;
} else {
*a_gobject_ptr = g_object_ref(a_pygobject->obj);
}