summaryrefslogtreecommitdiffstats
path: root/swig
diff options
context:
space:
mode:
authorEmmanuel Raviart <eraviart@entrouvert.com>2004-10-02 21:49:38 +0000
committerEmmanuel Raviart <eraviart@entrouvert.com>2004-10-02 21:49:38 +0000
commitfccd418c36034c39aa8d1890e49bc161a3c65777 (patch)
treebf01ef2dd5d88c2d5e5a94e2ccf1b81c262e0ed3 /swig
parentca8633b291b5e5de07db23c35e1ff82fc4576325 (diff)
downloadlasso-fccd418c36034c39aa8d1890e49bc161a3c65777.tar.gz
lasso-fccd418c36034c39aa8d1890e49bc161a3c65777.tar.xz
lasso-fccd418c36034c39aa8d1890e49bc161a3c65777.zip
Integrated scalp_is_liberty_query into Lasso. Consequently,
LASSO_PROFILE_ERROR_INVALID_QUERY is now a negative error code and a critical message is displayed when this error occurs.
Diffstat (limited to 'swig')
-rw-r--r--swig/Lasso.i56
1 files changed, 29 insertions, 27 deletions
diff --git a/swig/Lasso.i b/swig/Lasso.i
index 04d186e8..2d8379e8 100644
--- a/swig/Lasso.i
+++ b/swig/Lasso.i
@@ -98,7 +98,7 @@
#ifdef SWIGPYTHON
%{
PyObject *lassoError;
- PyObject *lassoSyntaxError;
+ PyObject *lassoWarning;
%}
%init %{
@@ -106,16 +106,16 @@
Py_INCREF(lassoError);
PyModule_AddObject(m, "Error", lassoError);
- lassoSyntaxError = PyErr_NewException("_lasso.SyntaxError", lassoError, NULL);
- Py_INCREF(lassoSyntaxError);
- PyModule_AddObject(m, "SyntaxError", lassoSyntaxError);
+ lassoWarning = PyErr_NewException("_lasso.Warning", lassoError, NULL);
+ Py_INCREF(lassoWarning);
+ PyModule_AddObject(m, "Warning", lassoWarning);
lasso_init();
%}
%pythoncode %{
Error = _lasso.Error
-SyntaxError = _lasso.SyntaxError
+Warning = _lasso.Warning
%}
#else
@@ -478,7 +478,7 @@ typedef enum {
%rename(PROFILE_ERROR_INVALID_HTTP_METHOD) LASSO_PROFILE_ERROR_INVALID_HTTP_METHOD;
%rename(PROFILE_ERROR_INVALID_PROTOCOLPROFILE) LASSO_PROFILE_ERROR_INVALID_PROTOCOLPROFILE;
#endif
-#define LASSO_PROFILE_ERROR_INVALID_QUERY 401
+#define LASSO_PROFILE_ERROR_INVALID_QUERY -401
#define LASSO_PROFILE_ERROR_INVALID_POST_MSG -402
#define LASSO_PROFILE_ERROR_INVALID_SOAP_MSG -403
#define LASSO_PROFILE_ERROR_MISSING_REQUEST -404
@@ -524,17 +524,15 @@ typedef enum {
void lasso_exception(int errorCode) {
PyObject *errorTuple;
- switch(errorCode) {
- case LASSO_PROFILE_ERROR_INVALID_QUERY:
- errorTuple = Py_BuildValue("(is)", errorCode, "Lasso Syntax Error");
- PyErr_SetObject(lassoSyntaxError, errorTuple);
+ if (errorCode > 0) {
+ errorTuple = Py_BuildValue("(is)", errorCode, "Lasso Warning");
+ PyErr_SetObject(lassoWarning, errorTuple);
Py_DECREF(errorTuple);
- break;
- default:
+ }
+ else {
errorTuple = Py_BuildValue("(is)", errorCode, "Lasso Error");
PyErr_SetObject(lassoError, errorTuple);
Py_DECREF(errorTuple);
- break;
}
}
@@ -555,18 +553,15 @@ void lasso_exception(int errorCode) {
%{
+void build_exception_msg(int errorCode, char *errorMsg) {
+ if (errorCode > 0)
+ sprintf(errorMsg, "%d / Lasso Warning", errorCode);
+ else
+ sprintf(errorMsg, "%d / Lasso Error", errorCode);
+}
+
int get_exception_type(int errorCode) {
- int exceptionType;
-
- switch(errorCode) {
- case LASSO_PROFILE_ERROR_INVALID_QUERY:
- exceptionType = SWIG_SyntaxError;
- break;
- default:
- exceptionType = SWIG_UnknownError;
- break;
- }
- return exceptionType;
+ return errorCode > 0 ? SWIG_Warning : SWIG_UnknownError;
}
%}
@@ -576,9 +571,9 @@ int get_exception_type(int errorCode) {
int errorCode;
errorCode = $action
if (errorCode) {
- char errorMessage[256];
- sprintf(errorMessage, "%d / Lasso Error", errorCode);
- SWIG_exception(get_exception_type(errorCode), errorMessage);
+ char errorMsg[256];
+ SWIG_exception(get_exception_type(errorCode),
+ build_exception_msg(errorCode, errorMsg));
}
}
%enddef
@@ -1274,6 +1269,13 @@ LassoProviderIds *LassoSession_providerIds_get(LassoSession *self) {
#endif
lassoRequestType lasso_profile_get_request_type_from_soap_msg(gchar *soap);
+#ifdef SWIGPHP4
+%rename(lasso_isLibertyQuery) lasso_profile_is_liberty_query;
+#else
+%rename(isLibertyQuery) lasso_profile_is_liberty_query;
+#endif
+gboolean lasso_profile_is_liberty_query(gchar *query);
+
/***********************************************************************
* Defederation