From 4b1c30b14addf7cabb733b71b15df9e1942da938 Mon Sep 17 00:00:00 2001 From: Jephte CLAIN Date: Thu, 24 Dec 2015 15:31:55 +0400 Subject: [PATCH 1/3] =?UTF-8?q?nouvelles=20fonctions=20pour=20le=20module?= =?UTF-8?q?=20cgi.=20cgilsxml,=20cgiupload=20et=20cgiparams=20sont=20rasse?= =?UTF-8?q?mbl=C3=A9s=20dans=20le=20module=20cgisupport?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ulib/cgi | 13 +++++++ lib/ulib/cgilsxml | 8 ----- lib/ulib/{cgiupload => cgisupport} | 6 ++-- lib/ulib/support/cgiparams.py | 54 ++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 10 deletions(-) delete mode 100644 lib/ulib/cgilsxml rename lib/ulib/{cgiupload => cgisupport} (51%) create mode 100755 lib/ulib/support/cgiparams.py diff --git a/lib/ulib/cgi b/lib/ulib/cgi index de86837..4c59d8f 100644 --- a/lib/ulib/cgi +++ b/lib/ulib/cgi @@ -32,6 +32,13 @@ function nocache_header() { echo "Expires: Thu, 01 Jan 1970 00:00:00 GMT" } +function cgiredirect() { + # Rediriger le client vers une autre page + echo "Status: 302 Found" + echo "Location: $1" + echo "" +} + function cgicontent() { # Générer les en-têtes nécessaire avant de servir le contenu. # $1(=text/html) est le type de contenu. S'il faut servir le contenu avec @@ -71,3 +78,9 @@ function cgicontent_nocache() { echo "" [ -f "$contentfile" ] && cat "$contentfile" } + +function cgierror() { + # Afficher un message d'erreur + cgicontent_nocache text/plain + echo "ERROR: $*" +} diff --git a/lib/ulib/cgilsxml b/lib/ulib/cgilsxml deleted file mode 100644 index 8e78929..0000000 --- a/lib/ulib/cgilsxml +++ /dev/null @@ -1,8 +0,0 @@ -##@cooked comments # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 -## Fonction de support pour cgilsxml -##@cooked nocomments -##@require ulib -uprovide cgilsxml -urequire ulib - -function cgilsxml() { "$ULIBDIR/support/cgilsxml.py" "$@"; } diff --git a/lib/ulib/cgiupload b/lib/ulib/cgisupport similarity index 51% rename from lib/ulib/cgiupload rename to lib/ulib/cgisupport index 3d6e4d9..21caa89 100644 --- a/lib/ulib/cgiupload +++ b/lib/ulib/cgisupport @@ -1,8 +1,10 @@ ##@cooked comments # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 -## Fonction de support pour cgiupload +## Fonction de support pour faire des scripts CGI ##@cooked nocomments ##@require ulib -uprovide cgiupload +uprovide cgisupport urequire ulib +function cgiparams() { "$ULIBDIR/support/cgiparams.py" "$@"; } +function cgilsxml() { "$ULIBDIR/support/cgilsxml.py" "$@"; } function cgiupload() { "$ULIBDIR/support/cgiupload.py" "$@"; } diff --git a/lib/ulib/support/cgiparams.py b/lib/ulib/support/cgiparams.py new file mode 100755 index 0000000..1087b89 --- /dev/null +++ b/lib/ulib/support/cgiparams.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python +# -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 + +u"""Ce script est prévu pour être utilisé dans un script CGI. + +Il permet de lister les paramètres du formulaire et d'y accéder depuis un script bash +""" + +import re, cgi + +RE_NAME_VALUE = re.compile(r'([a-zA-Z0-9_-]+)(?:=(.*))?$') + +def quote(value, q=False): + if value or q: + value = "'%s'" % value.replace("'", "'\\''") + value = re.sub(r"(? Date: Thu, 24 Dec 2015 15:39:22 +0400 Subject: [PATCH 2/3] Init changelog & version 3.0.0 --- CHANGES.txt | 4 ++++ VERSION.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 8515765..8ec3187 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,7 @@ +## Version 3.0.0 du 24/12/2015-15:39 + +4b1c30b nouvelles fonctions pour le module cgi. cgilsxml, cgiupload et cgiparams sont rassemblés dans le module cgisupport + ## Version 2.26.0 du 24/12/2015-12:17 d5a2cce cgilsxml.py: rajouter la variable env/query_vars diff --git a/VERSION.txt b/VERSION.txt index 7a25c70..4a36342 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -2.26.0 +3.0.0 From cfc782409b9b2f5eacac927ca94d3decaae001ae Mon Sep 17 00:00:00 2001 From: Jephte CLAIN Date: Thu, 24 Dec 2015 15:39:47 +0400 Subject: [PATCH 3/3] maj ulib --- lib/ulib/.ulibver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ulib/.ulibver b/lib/ulib/.ulibver index e24b6c4..6435415 100644 --- a/lib/ulib/.ulibver +++ b/lib/ulib/.ulibver @@ -1 +1 @@ -009011000 +010000000