diff --git a/SKvm b/SKvm index 1259a64..cb88d5f 100755 --- a/SKvm +++ b/SKvm @@ -131,7 +131,7 @@ if [ "$action" == list ]; then fi echo "$avm$state" done - + elif [ "$action" == start ]; then if [ -z "$vm" -a -n "${svms[*]}" ]; then [ -n "${rvms[*]}" ] && diff --git a/SVirtualBox b/SVirtualBox index a621168..8f16855 100755 --- a/SVirtualBox +++ b/SVirtualBox @@ -99,7 +99,7 @@ if [ "$action" == list ]; then fi echo "$avm$state" done - + elif [ "$action" == start ]; then if [ -z "$vm" -a -n "${svms[*]}" ]; then [ -n "${rvms[*]}" ] && diff --git a/apacheconfig b/apacheconfig index f7af26a..37ce7cf 100755 --- a/apacheconfig +++ b/apacheconfig @@ -167,7 +167,7 @@ function parent_apacheconfig() { # chercher à partir du répertoire courant si un des répertoires parents # s'appelle apacheconfig local dir="$(pwd)" dirname - + while true; do setx dirname=basename -- "$dir" if [ "$dir" == / ]; then diff --git a/caturl b/caturl index ec10a19..ca40c6e 100755 --- a/caturl +++ b/caturl @@ -58,7 +58,7 @@ else fi fi fi - + if [ -n "$URLFILE" ]; then # lire l'url dans un fichier if [ "${URLFILE%.url}" != "$URL" ]; then diff --git a/compileAndGo b/compileAndGo index ccf34d4..d11cb4d 100755 --- a/compileAndGo +++ b/compileAndGo @@ -2,7 +2,7 @@ # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 # See notice of copyright and license at end. -# If you use this program for a #! script, please include the following +# If you use this program for a #! script, please include the following # as the second line of the script: # See http://Yost.com/computers/compileAndGo @@ -149,7 +149,7 @@ ls-linux() { # 11742 2005-07-28 11:54:01.000000000 ( ls -dl --full-time --time-style=full-iso "$1" \ - | sed 's,.*[0-9] \([12][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\) \([0-9][0-9]\):\([0-9][0-9]\):\([0-9][0-9]\).[0-9]* .*,\1.\2-\3-\4,' + | sed 's,.*[0-9] \([12][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\) \([0-9][0-9]\):\([0-9][0-9]\):\([0-9][0-9]\).[0-9]* .*,\1.\2-\3-\4,' ) 2> /dev/null } @@ -507,12 +507,12 @@ cachedExecutable=$cacheDir/$executableFilename # * Only the user or root can chmod a file or folder owned by him. # * Only the user or root can write into a file or folder that is 700. # * Only root can chown a file or folder to the user. -# so only the user or root can construct a suitable file in the suitable +# so only the user or root can construct a suitable file in the suitable # folder. No one else can. That's about as good as it can get on unix. # The attack would be limited to finding some existing folder containing -# an executable of the correct name, both owned by the user and 700, +# an executable of the correct name, both owned by the user and 700, # then moving the folder into the appropriate path. -# The implementation should be expanded to require that all folders from +# The implementation should be expanded to require that all folders from # $cacheDir through $cacheDirParent must be owned by user and be 700. if [[ ! -O $cachedExecutable ]] ; then if [[ -e $cachedExecutable ]] ; then @@ -536,9 +536,9 @@ if [[ ! -O $cachedExecutable ]] ; then mkdir -p $cacheDirParent echo > $cacheDirParent/../README "See http://Yost.com/computers/compileAndGo" fi - + mkdir -p $cacheDir - + # Compile the source. if (( 0$verbose == 1 )) ; then echo 1>&2 "[ $commandName: compiling. ]" @@ -549,7 +549,7 @@ if [[ ! -O $cachedExecutable ]] ; then fi echo "$sourceCode" > $cacheDir/$sourceFilename eval $compileCmd - + # Make a canonical name we can look at to determine access time. ln -f $cachedExecutable $cacheDir/.executable fi @@ -604,22 +604,22 @@ exit $status # compileAndGo 5.0 2010-11-06 # which at time of this publication can be found at: # http://Yost.com/computers/compileAndGo -# Redistribution and use in the form of source code or derivative data built -# from the source code, with or without modification, are permitted provided +# Redistribution and use in the form of source code or derivative data built +# from the source code, with or without modification, are permitted provided # that the following conditions are met: # 1. THE USER AGREES THAT THERE IS NO WARRANTY. -# 2. If and only if appropriate, the above phrase "This version is" must be -# followed by the phrase "a modified form of" or "extracted from" or +# 2. If and only if appropriate, the above phrase "This version is" must be +# followed by the phrase "a modified form of" or "extracted from" or # "extracted and modified from". # 3. Redistributions of source code must retain this notice intact. -# 4. Redistributions in the form of derivative data built from the source -# code must reproduce this notice intact in the documentation and/or other -# materials provided with the distribution, and each file in the derivative +# 4. Redistributions in the form of derivative data built from the source +# code must reproduce this notice intact in the documentation and/or other +# materials provided with the distribution, and each file in the derivative # data must reproduce any Yost.com URI included in the original distribution. -# 5. Neither the name of Dave Yost nor the names of its contributors may be -# used to endorse or promote products derived from this software without +# 5. Neither the name of Dave Yost nor the names of its contributors may be +# used to endorse or promote products derived from this software without # specific prior written permission. -# 6. Written permission by the author is required for redistribution as part +# 6. Written permission by the author is required for redistribution as part # of a commercial product. -# This notice comprises all text from "Copyright" above through the end of +# This notice comprises all text from "Copyright" above through the end of # this sentence. diff --git a/doc/DefaultTiddlers.twp b/doc/DefaultTiddlers.twp index 976ae39..cac184d 100644 --- a/doc/DefaultTiddlers.twp +++ b/doc/DefaultTiddlers.twp @@ -19,7 +19,7 @@ ##@created: 09/03/2012 05:08 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: DefaultTiddlers [[Main]] diff --git a/doc/EnsureVM.twp b/doc/EnsureVM.twp index 85493f8..cda2f7d 100644 --- a/doc/EnsureVM.twp +++ b/doc/EnsureVM.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:19 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: EnsureVM {{{ diff --git a/doc/Main.twp b/doc/Main.twp index 4628491..470bda7 100644 --- a/doc/Main.twp +++ b/doc/Main.twp @@ -19,7 +19,7 @@ ##@created: 09/03/2012 05:08 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: Main !Présentation diff --git a/doc/MainMenu.twp b/doc/MainMenu.twp index 79a4dfa..935032c 100644 --- a/doc/MainMenu.twp +++ b/doc/MainMenu.twp @@ -19,7 +19,7 @@ ##@created: 09/03/2012 05:08 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: MainMenu [[GettingStarted]] diff --git a/doc/SKvm.twp b/doc/SKvm.twp index ab0de5d..f51b308 100644 --- a/doc/SKvm.twp +++ b/doc/SKvm.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: SKvm {{{ diff --git a/doc/SVirtualBox.twp b/doc/SVirtualBox.twp index 07db3f8..3d7def5 100644 --- a/doc/SVirtualBox.twp +++ b/doc/SVirtualBox.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: SVirtualBox {{{ diff --git a/doc/SiteSubtitle.twp b/doc/SiteSubtitle.twp index 5b102c4..54da2b3 100644 --- a/doc/SiteSubtitle.twp +++ b/doc/SiteSubtitle.twp @@ -19,7 +19,7 @@ ##@created: 09/03/2012 05:08 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: SiteSubtitle Outils divers pour linux/macosx, et librairies pour bash diff --git a/doc/SiteTitle.twp b/doc/SiteTitle.twp index f1c9067..ed1c759 100644 --- a/doc/SiteTitle.twp +++ b/doc/SiteTitle.twp @@ -19,7 +19,7 @@ ##@created: 09/03/2012 05:08 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: SiteTitle nutools diff --git a/doc/SiteUrl.twp b/doc/SiteUrl.twp index dfdad8b..bef6314 100644 --- a/doc/SiteUrl.twp +++ b/doc/SiteUrl.twp @@ -19,7 +19,7 @@ ##@created: 09/03/2012 05:08 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: SiteUrl diff --git a/doc/_root.twp b/doc/_root.twp index 46689b7..8d9dad4 100644 --- a/doc/_root.twp +++ b/doc/_root.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: _root {{{ diff --git a/doc/authftp.twp b/doc/authftp.twp index b752caa..b383b5c 100644 --- a/doc/authftp.twp +++ b/doc/authftp.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:19 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: authftp {{{ diff --git a/doc/caturl.twp b/doc/caturl.twp index 02f23d0..006fd4c 100644 --- a/doc/caturl.twp +++ b/doc/caturl.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:19 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: caturl {{{ diff --git a/doc/compileAndGo.twp b/doc/compileAndGo.twp index 152d884..0a401cf 100644 --- a/doc/compileAndGo.twp +++ b/doc/compileAndGo.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:19 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: compileAndGo {{{ diff --git a/doc/fconv.twp b/doc/fconv.twp index dfd1174..827c105 100644 --- a/doc/fconv.twp +++ b/doc/fconv.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:19 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: fconv {{{ diff --git a/doc/fnconv.twp b/doc/fnconv.twp index 9f573c4..ad7bbc3 100644 --- a/doc/fnconv.twp +++ b/doc/fnconv.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:19 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: fnconv {{{ diff --git a/doc/geturl.twp b/doc/geturl.twp index 45a2b65..1ec3d76 100644 --- a/doc/geturl.twp +++ b/doc/geturl.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:19 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: geturl {{{ diff --git a/doc/mkRewriteRules.twp b/doc/mkRewriteRules.twp index b6b32bf..2b1c35c 100644 --- a/doc/mkRewriteRules.twp +++ b/doc/mkRewriteRules.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:19 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: mkRewriteRules {{{ diff --git a/doc/mkiso.twp b/doc/mkiso.twp index 38ac6ae..0c07c0a 100644 --- a/doc/mkiso.twp +++ b/doc/mkiso.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:19 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: mkiso {{{ diff --git a/doc/mkurl.twp b/doc/mkurl.twp index ea356bd..660d3a3 100644 --- a/doc/mkurl.twp +++ b/doc/mkurl.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: mkurl {{{ diff --git a/doc/mkusfx.twp b/doc/mkusfx.twp index 4972d56..6da2c22 100644 --- a/doc/mkusfx.twp +++ b/doc/mkusfx.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: mkusfx {{{ diff --git a/doc/openurl.twp b/doc/openurl.twp index 72eeb5a..ec66ae0 100644 --- a/doc/openurl.twp +++ b/doc/openurl.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: openurl {{{ diff --git a/doc/rmtildes.twp b/doc/rmtildes.twp index 448e3e3..b9d56a5 100644 --- a/doc/rmtildes.twp +++ b/doc/rmtildes.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: rmtildes {{{ diff --git a/doc/rruns.twp b/doc/rruns.twp index 3c1f328..a485afe 100644 --- a/doc/rruns.twp +++ b/doc/rruns.twp @@ -3,7 +3,7 @@ ##@created: 30/03/2012 04:42 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: rruns {{{ diff --git a/doc/ruinst.twp b/doc/ruinst.twp index 506cbce..5d87d04 100644 --- a/doc/ruinst.twp +++ b/doc/ruinst.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ruinst {{{ diff --git a/doc/runs.twp b/doc/runs.twp index 6d5b297..171dde0 100644 --- a/doc/runs.twp +++ b/doc/runs.twp @@ -3,7 +3,7 @@ ##@created: 30/03/2012 04:42 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: runs {{{ diff --git a/doc/rwoinst.twp b/doc/rwoinst.twp index b789c56..0415fac 100644 --- a/doc/rwoinst.twp +++ b/doc/rwoinst.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: rwoinst {{{ diff --git a/doc/twsync.twp b/doc/twsync.twp index 90883be..c867f77 100644 --- a/doc/twsync.twp +++ b/doc/twsync.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: twsync {{{ diff --git a/doc/ubackup.twp b/doc/ubackup.twp index f6ae035..90510bb 100644 --- a/doc/ubackup.twp +++ b/doc/ubackup.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ubackup {{{ diff --git a/doc/uconf.twp b/doc/uconf.twp index 2272ed8..eea3882 100644 --- a/doc/uconf.twp +++ b/doc/uconf.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: uconf {{{ diff --git a/doc/ucrontab.twp b/doc/ucrontab.twp index d1867ba..a077fa1 100644 --- a/doc/ucrontab.twp +++ b/doc/ucrontab.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ucrontab {{{ diff --git a/doc/udir.twp b/doc/udir.twp index 563f815..04af398 100644 --- a/doc/udir.twp +++ b/doc/udir.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: udir {{{ diff --git a/doc/uenv.twp b/doc/uenv.twp index c5d155e..81e012d 100644 --- a/doc/uenv.twp +++ b/doc/uenv.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: uenv {{{ diff --git a/doc/uinc.sh.twp b/doc/uinc.sh.twp index 8e9a0bd..f46b82d 100644 --- a/doc/uinc.sh.twp +++ b/doc/uinc.sh.twp @@ -3,12 +3,12 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: uinc.sh {{{ uinc.py: Plier/déplier des inclusions dans un fichier - + USAGE uinc.py [[options] dest...] diff --git a/doc/uinc.twp b/doc/uinc.twp index 19fac72..1bec21e 100644 --- a/doc/uinc.twp +++ b/doc/uinc.twp @@ -3,12 +3,12 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: uinc {{{ uinc.py: Plier/déplier des inclusions dans un fichier - + USAGE uinc.py [[options] dest...] diff --git a/doc/uinst.sh.twp b/doc/uinst.sh.twp index 28d8f24..9fa8d2a 100644 --- a/doc/uinst.sh.twp +++ b/doc/uinst.sh.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: uinst.sh {{{ diff --git a/doc/uinst.twp b/doc/uinst.twp index e72975c..5ac8655 100644 --- a/doc/uinst.twp +++ b/doc/uinst.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: uinst {{{ diff --git a/doc/ujava.twp b/doc/ujava.twp index 9437a88..c4f0cbe 100644 --- a/doc/ujava.twp +++ b/doc/ujava.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ujava {{{ diff --git a/doc/uldap.twp b/doc/uldap.twp index 75889a0..a4c0b96 100644 --- a/doc/uldap.twp +++ b/doc/uldap.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: uldap {{{ diff --git a/doc/ulib.twp b/doc/ulib.twp index acd7da3..498060d 100644 --- a/doc/ulib.twp +++ b/doc/ulib.twp @@ -3,7 +3,7 @@ ##@created: 02/06/2012 09:54 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib !Liste des librairies de ulib diff --git a/doc/ulib_DEFAULTS.twp b/doc/ulib_DEFAULTS.twp index bc140b0..efe61bd 100644 --- a/doc/ulib_DEFAULTS.twp +++ b/doc/ulib_DEFAULTS.twp @@ -3,6 +3,6 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/DEFAULTS diff --git a/doc/ulib_apache.twp b/doc/ulib_apache.twp index 061cffc..059e25f 100644 --- a/doc/ulib_apache.twp +++ b/doc/ulib_apache.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/apache !! {{{get_default_apachebin_prefix}}} diff --git a/doc/ulib_base.twp b/doc/ulib_base.twp index 3c46913..c8fbf6d 100644 --- a/doc/ulib_base.twp +++ b/doc/ulib_base.twp @@ -3,7 +3,7 @@ ##@created: 02/06/2012 09:54 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/base !! {{{isnum}}} diff --git a/doc/ulib_bash.twp b/doc/ulib_bash.twp index fc36bce..a1e3fe7 100644 --- a/doc/ulib_bash.twp +++ b/doc/ulib_bash.twp @@ -3,6 +3,6 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/bash diff --git a/doc/ulib_compat.twp b/doc/ulib_compat.twp index b3d310b..aa9f721 100644 --- a/doc/ulib_compat.twp +++ b/doc/ulib_compat.twp @@ -3,6 +3,6 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/compat diff --git a/doc/ulib_conf.twp b/doc/ulib_conf.twp index aca5c2b..a801678 100644 --- a/doc/ulib_conf.twp +++ b/doc/ulib_conf.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/conf !! {{{conf_enable}}} diff --git a/doc/ulib_crontab.twp b/doc/ulib_crontab.twp index df1132d..7fe7d5c 100644 --- a/doc/ulib_crontab.twp +++ b/doc/ulib_crontab.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/crontab !! {{{add_to_crontab}}} diff --git a/doc/ulib_debian.twp b/doc/ulib_debian.twp index e10032c..1e8816b 100644 --- a/doc/ulib_debian.twp +++ b/doc/ulib_debian.twp @@ -3,7 +3,7 @@ ##@created: 30/03/2012 04:43 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/debian !! {{{pkg_check}}} diff --git a/doc/ulib_install.twp b/doc/ulib_install.twp index b1d58f0..7faaa12 100644 --- a/doc/ulib_install.twp +++ b/doc/ulib_install.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/install !! {{{ensure_exists}}} diff --git a/doc/ulib_ipcalc.twp b/doc/ulib_ipcalc.twp index 6257a2e..9414ee7 100644 --- a/doc/ulib_ipcalc.twp +++ b/doc/ulib_ipcalc.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/ipcalc !! {{{get_random_kvm_macaddr}}} @@ -50,5 +50,5 @@ suffixe sont invalides ou non supportés. Vérifier si l'adresse $1 correspond au modèle $2, e.g.: ipcalc_match 10.75.0.23 10/8 --> TRUE ipcalc_match 10.75.0.23 10.75.0.0/24 --> TRUE -ipcalc_match 10.75.0.23 10.75.0.28 --> FALSE +ipcalc_match 10.75.0.23 10.75.0.28 --> FALSE }}} diff --git a/doc/ulib_java.twp b/doc/ulib_java.twp index 3091073..9c58dc6 100644 --- a/doc/ulib_java.twp +++ b/doc/ulib_java.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/java !! {{{select_java}}} diff --git a/doc/ulib_javaproperties.twp b/doc/ulib_javaproperties.twp index 1c4f64b..8b87417 100644 --- a/doc/ulib_javaproperties.twp +++ b/doc/ulib_javaproperties.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/javaproperties !! {{{read_property}}} diff --git a/doc/ulib_ldap.twp b/doc/ulib_ldap.twp index 6fdb9e4..ad2ca5a 100644 --- a/doc/ulib_ldap.twp +++ b/doc/ulib_ldap.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/ldap !! {{{get_default_ldapconfdir_prefix}}} diff --git a/doc/ulib_ldif.twp b/doc/ulib_ldif.twp index 1465c90..4d10f8f 100644 --- a/doc/ulib_ldif.twp +++ b/doc/ulib_ldif.twp @@ -3,7 +3,7 @@ ##@created: 02/06/2012 09:54 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/ldif !! {{{def_match_attr}}} diff --git a/doc/ulib_legacy.twp b/doc/ulib_legacy.twp index 8dd339c..d190e06 100644 --- a/doc/ulib_legacy.twp +++ b/doc/ulib_legacy.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/legacy !! {{{file_get_vars}}} diff --git a/doc/ulib_macosx.twp b/doc/ulib_macosx.twp index 65af8d0..a110d1d 100644 --- a/doc/ulib_macosx.twp +++ b/doc/ulib_macosx.twp @@ -3,7 +3,7 @@ ##@created: 02/06/2012 09:54 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/macosx !! {{{local_shellfix}}} diff --git a/doc/ulib_mkcrypt.twp b/doc/ulib_mkcrypt.twp index 08ca3af..66d9a19 100644 --- a/doc/ulib_mkcrypt.twp +++ b/doc/ulib_mkcrypt.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/mkcrypt !! {{{mkcrypt}}} diff --git a/doc/ulib_modeline.twp b/doc/ulib_modeline.twp index 11b55d1..c250911 100644 --- a/doc/ulib_modeline.twp +++ b/doc/ulib_modeline.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/modeline !! {{{printml}}} diff --git a/doc/ulib_network-manager-service.twp b/doc/ulib_network-manager-service.twp index 9add42b..fdb9199 100644 --- a/doc/ulib_network-manager-service.twp +++ b/doc/ulib_network-manager-service.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/network-manager-service !! {{{SERVICE_OVERRIDE_network_manager_stopx}}} diff --git a/doc/ulib_pkg.twp b/doc/ulib_pkg.twp index acb04ac..af586c9 100644 --- a/doc/ulib_pkg.twp +++ b/doc/ulib_pkg.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/pkg !! {{{pkg_check}}} diff --git a/doc/ulib_prefixes.twp b/doc/ulib_prefixes.twp index 197a9fa..0e59fc1 100644 --- a/doc/ulib_prefixes.twp +++ b/doc/ulib_prefixes.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/prefixes !! {{{get_USER_prefix}}} diff --git a/doc/ulib_pretty.twp b/doc/ulib_pretty.twp index 9e6f08d..4e6ec94 100644 --- a/doc/ulib_pretty.twp +++ b/doc/ulib_pretty.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/pretty !! {{{get_color}}} diff --git a/doc/ulib_runs.twp b/doc/ulib_runs.twp index 3fb1b1d..84da791 100644 --- a/doc/ulib_runs.twp +++ b/doc/ulib_runs.twp @@ -3,7 +3,7 @@ ##@created: 02/06/2012 09:54 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/runs !! {{{runs_initdir}}} diff --git a/doc/ulib_service.twp b/doc/ulib_service.twp index 8e839fa..aac011e 100644 --- a/doc/ulib_service.twp +++ b/doc/ulib_service.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/service !! {{{service}}} diff --git a/doc/ulib_sysinfos.twp b/doc/ulib_sysinfos.twp index ee85b1c..0f8d379 100644 --- a/doc/ulib_sysinfos.twp +++ b/doc/ulib_sysinfos.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/sysinfos !! {{{ensure_sysinfos}}} diff --git a/doc/ulib_tiddlywiki.twp b/doc/ulib_tiddlywiki.twp index b935b06..db55550 100644 --- a/doc/ulib_tiddlywiki.twp +++ b/doc/ulib_tiddlywiki.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/tiddlywiki !! {{{twget_version}}} diff --git a/doc/ulib_udir.twp b/doc/ulib_udir.twp index 7dcd544..b722924 100644 --- a/doc/ulib_udir.twp +++ b/doc/ulib_udir.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/udir !! {{{udir_check}}} diff --git a/doc/ulib_uenv.twp b/doc/ulib_uenv.twp index 32af1a1..6254f29 100644 --- a/doc/ulib_uenv.twp +++ b/doc/ulib_uenv.twp @@ -3,6 +3,6 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/uenv diff --git a/doc/ulib_uenv_update.twp b/doc/ulib_uenv_update.twp index b681b93..c85a44d 100644 --- a/doc/ulib_uenv_update.twp +++ b/doc/ulib_uenv_update.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/uenv_update !! {{{uenv_update_dir}}} diff --git a/doc/ulib_uinc.twp b/doc/ulib_uinc.twp index f0fceae..79106f5 100644 --- a/doc/ulib_uinc.twp +++ b/doc/ulib_uinc.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/uinc !! {{{uinc}}} diff --git a/doc/ulib_uinst.twp b/doc/ulib_uinst.twp index 8e9f018..a514ce2 100644 --- a/doc/ulib_uinst.twp +++ b/doc/ulib_uinst.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/uinst !! {{{uinst}}} diff --git a/doc/ulib_ulib.twp b/doc/ulib_ulib.twp index 94b004f..d20e5c8 100644 --- a/doc/ulib_ulib.twp +++ b/doc/ulib_ulib.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/ulib !! {{{eerror}}} diff --git a/doc/ulib_ulibsh.twp b/doc/ulib_ulibsh.twp index 3f674b2..7253c50 100644 --- a/doc/ulib_ulibsh.twp +++ b/doc/ulib_ulibsh.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/ulibsh !! {{{eerror}}} diff --git a/doc/ulib_vcs.twp b/doc/ulib_vcs.twp index 2489f11..42c8ab6 100644 --- a/doc/ulib_vcs.twp +++ b/doc/ulib_vcs.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/vcs !! {{{vcs_getvcs_help}}} diff --git a/doc/ulib_virsh.twp b/doc/ulib_virsh.twp index d37a4e1..e852823 100644 --- a/doc/ulib_virsh.twp +++ b/doc/ulib_virsh.twp @@ -3,7 +3,7 @@ ##@created: 30/03/2012 04:43 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/virsh !! {{{virsh_filter}}} diff --git a/doc/ulib_webobjects.twp b/doc/ulib_webobjects.twp index c1b9e25..f8aa045 100644 --- a/doc/ulib_webobjects.twp +++ b/doc/ulib_webobjects.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/webobjects !! {{{compute_webobjects_prefixes}}} diff --git a/doc/ulib_woinst.twp b/doc/ulib_woinst.twp index a13d240..4d5fa0e 100644 --- a/doc/ulib_woinst.twp +++ b/doc/ulib_woinst.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/woinst !! {{{date2version}}} diff --git a/doc/ulib_wondermonitor.twp b/doc/ulib_wondermonitor.twp index 9c18728..54aac8b 100644 --- a/doc/ulib_wondermonitor.twp +++ b/doc/ulib_wondermonitor.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/wondermonitor !! {{{wom__statistics}}} diff --git a/doc/ulib_wosign.twp b/doc/ulib_wosign.twp index 34cce91..692f067 100644 --- a/doc/ulib_wosign.twp +++ b/doc/ulib_wosign.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/wosign !! {{{wosign_setup_maybe}}} diff --git a/doc/ulib_wotaskd.twp b/doc/ulib_wotaskd.twp index 0d32155..be9dcc8 100644 --- a/doc/ulib_wotaskd.twp +++ b/doc/ulib_wotaskd.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:15 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulib/wotaskd !! {{{wot_config}}} diff --git a/doc/ulibshell.twp b/doc/ulibshell.twp index 65f9002..6b5e3ce 100644 --- a/doc/ulibshell.twp +++ b/doc/ulibshell.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulibshell {{{ diff --git a/doc/ulibsync.twp b/doc/ulibsync.twp index d4b6811..b8b8fa6 100644 --- a/doc/ulibsync.twp +++ b/doc/ulibsync.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: ulibsync {{{ diff --git a/doc/umatch.twp b/doc/umatch.twp index dac891a..49add79 100644 --- a/doc/umatch.twp +++ b/doc/umatch.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: umatch {{{ diff --git a/doc/umirror.twp b/doc/umirror.twp index 9ea757c..82014d2 100644 --- a/doc/umirror.twp +++ b/doc/umirror.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: umirror {{{ diff --git a/doc/update.sh b/doc/update.sh index f8ae7a6..c7ade4c 100755 --- a/doc/update.sh +++ b/doc/update.sh @@ -37,7 +37,7 @@ function write_twpage() { ##@created: $created ##@modifier: $USER ##@changecount: 1 -##@tags: +##@tags: ##@title: $title" >"$twpage" cat "$newcontent" >>"$twpage" fi @@ -71,7 +71,7 @@ if [ -n "$tools" ]; then else array_lsfiles cmds .. fi - + for cmd in "${cmds[@]}"; do cmdname="$(basename "$cmd")" twpage="$cmdname.twp" @@ -83,7 +83,7 @@ if [ -n "$tools" ]; then {{{ $("$cmd" --help) }}}" >"$newcontent" - + write_twpage "$oldcontent" "$cmdname" "$newcontent" "$twpage" done fi diff --git a/doc/uprefix.twp b/doc/uprefix.twp index 494dd1a..89b1fc1 100644 --- a/doc/uprefix.twp +++ b/doc/uprefix.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: uprefix {{{ diff --git a/doc/uproject.twp b/doc/uproject.twp index 9ac0e91..86c4b11 100644 --- a/doc/uproject.twp +++ b/doc/uproject.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: uproject {{{ diff --git a/doc/usysinfos.twp b/doc/usysinfos.twp index 8cb9907..2502411 100644 --- a/doc/usysinfos.twp +++ b/doc/usysinfos.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: usysinfos {{{ diff --git a/doc/vzusage.twp b/doc/vzusage.twp index 582a37a..f39b7cd 100644 --- a/doc/vzusage.twp +++ b/doc/vzusage.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: vzusage {{{ diff --git a/doc/woArchive.twp b/doc/woArchive.twp index 6a80b50..0285875 100644 --- a/doc/woArchive.twp +++ b/doc/woArchive.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: woArchive {{{ diff --git a/doc/woSwitch.twp b/doc/woSwitch.twp index 03f8665..75c42c1 100644 --- a/doc/woSwitch.twp +++ b/doc/woSwitch.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: woSwitch {{{ diff --git a/doc/woctl.twp b/doc/woctl.twp index b599f74..46d7cbc 100644 --- a/doc/woctl.twp +++ b/doc/woctl.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: woctl {{{ diff --git a/doc/woinst.twp b/doc/woinst.twp index 0692c0a..3795a83 100644 --- a/doc/woinst.twp +++ b/doc/woinst.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: woinst {{{ diff --git a/doc/wosign.twp b/doc/wosign.twp index cebfb75..3ad2a2b 100644 --- a/doc/wosign.twp +++ b/doc/wosign.twp @@ -3,7 +3,7 @@ ##@created: 15/03/2012 22:20 ##@modifier: jclain ##@changecount: 1 -##@tags: +##@tags: ##@title: wosign {{{ diff --git a/geturl b/geturl index 6b2dbd4..ac1fe89 100755 --- a/geturl +++ b/geturl @@ -34,7 +34,7 @@ elif progexists curl; then curl -C - -o "$filename" "$@" "$url" else curl -o "$filename" "$@" "$url" - fi + fi else die "Aucune méthode de téléchargement n'a été détectée" fi diff --git a/legacy/instinc/envsetup b/legacy/instinc/envsetup index e30b7a8..c1849b5 100644 --- a/legacy/instinc/envsetup +++ b/legacy/instinc/envsetup @@ -16,25 +16,25 @@ function __envsetup_check_file() { # ignorer les fichiers qui ont l'extension .ignore [ "${file%%.ignore}" != "$file" ] && return 1 - + # tester si le fichier est spécifique à une plateforme system="$(expr "$file" : ".*\\.\\[\\([^.]*\\)\\]")" [ -n "$system" -a "$system" != "$SYSTEM_NAME" ] && return 1 system="$(expr "$file" : ".*\\.\\[-\\([^.]*\\)\\]")" [ -n "$system" -a "$system" == "$SYSTEM_NAME" ] && return 1 - + # tester si le fichier est spécifique à une machine host="$(expr "$file" : ".*\\.on_\\([^.]*\\)")" [ -n "$host" -a "$host" != "$BASEHOST" ] && return 1 host="$(expr "$file" : ".*\\.noton_\\([^.]*\\)")" [ -n "$host" -a "$host" == "$BASEHOST" ] && return 1 - + # tester si le fichier est spécifique à un utilisateur user="$(expr "$file" : ".*\\.for_\\([^.]*\\)")" [ -n "$user" -a "$user" != "$USER" ] && return 1 user="$(expr "$file" : ".*\\.notfor_\\([^.]*\\)")" [ -n "$user" -a "$user" == "$USER" ] && return 1 - + return 0 } diff --git a/legacy/instinc/woconf b/legacy/instinc/woconf index ac25880..8541b03 100644 --- a/legacy/instinc/woconf +++ b/legacy/instinc/woconf @@ -29,7 +29,7 @@ function set_config_property() { if is_wofwdir "$bundir"; then srvresdir="$FW_SRVRESDIR" fi - + if [ "$prop" == "-" ]; then if beginswith "$value" ">"; then # choix d'un fichier de configuration par défaut @@ -147,13 +147,13 @@ function woconf() { if is_wosrcdir "$tagdir"; then srcdir="$tagdir" set_wobindir "$srcdir" bundir desc - + elif is_woappdir "$tagdir"; then bundir="$tagdir" - + elif is_wofwdir "$tagdir"; then bundir="$tagdir" - + else die "Le bundle doit être un framework ou une application" fi diff --git a/legacy/instinc/womonitor b/legacy/instinc/womonitor index f8d086b..e80c943 100644 --- a/legacy/instinc/womonitor +++ b/legacy/instinc/womonitor @@ -157,7 +157,7 @@ function get_instances_for_woa() { local appname="$(basename "$app" .woa)" local appscript="$path/$appname" - siteconf_dump_applications | uawk -v appscript="$appscript" '$4 == appscript { print $1 }' + siteconf_dump_applications | uawk -v appscript="$appscript" '$4 == appscript { print $1 }' } function get_instances_for_framework() { diff --git a/legacy/instinc/worestart b/legacy/instinc/worestart index 1736ee3..5ab727f 100644 --- a/legacy/instinc/worestart +++ b/legacy/instinc/worestart @@ -42,7 +42,7 @@ function start_instances() { outputfile="$(mktempf)" siteconf_get_instance_data_for_commandWotaskd "$@" | wotaskd_command_instances_from_stdin -h "$host" -P "$password" -o "$outputfile" START - + local status=0 if [ $(grep 'success.*YES' "$outputfile" | wc -l) -ne $# ]; then #eerror "Une erreur s'est produite:" diff --git a/legacy/instinc/wosign b/legacy/instinc/wosign index 2f3a035..5d3d4ca 100644 --- a/legacy/instinc/wosign +++ b/legacy/instinc/wosign @@ -65,7 +65,7 @@ function wosign_jar() { rm -rf * jar xf "$jar" rm -f META-INF/*.{SF,RSA,DSA} - + jar cf "$cjar" * if [ -n "$unsign" ]; then cp "$cjar" "$jar" @@ -153,7 +153,7 @@ function wosign() { elif endswith "$1" .framework; then srcdir="$srcdir/$FW_CLTJAVADIR" fi - + if [ -d "$srcdir" ]; then array_from_lines candidates "$(list_files "$srcdir" "*.jar")" jars=() diff --git a/legacy/instinc/wotag b/legacy/instinc/wotag index dbbce62..3e834d1 100644 --- a/legacy/instinc/wotag +++ b/legacy/instinc/wotag @@ -54,18 +54,18 @@ function wotag() { if is_wosrcdir "$tagdir"; then srcdir="$tagdir" set_wobindir "$srcdir" bundir desc - + elif is_woappdir "$tagdir"; then bundir="$tagdir" - + elif is_wofwdir "$tagdir"; then bundir="$tagdir" - + else [ "$action" == "show" ] && return 1 die "Le bundle doit être un framework ou une application" fi - + bundir="${bundir%/}" if endswith "$bundir" .woa; then local srvresdir="$APP_SRVRESDIR" @@ -75,7 +75,7 @@ function wotag() { local infosfile="$(get_jawotools_properties_path "$bundir")" local infosfile2="$bundir/jawotools.properties" local versionfile="$(get_version_txt_path "$bundir/$srvresdir")" - + if [ "$action" == "check" ]; then if [ -f "$infosfile" ]; then # vérifier la présence de description, version, releaseDate, developmentSnapshot @@ -85,7 +85,7 @@ function wotag() { fi fi return 1 - + elif [ "$action" == "show" ]; then if [ -f "$infosfile" ]; then read_jawotools_properties "$infosfile" @@ -102,14 +102,14 @@ function wotag() { einfo "${message:-$(basename "$bundir")}: ?" fi return 0 - + elif [ "$action" == "tag" ]; then developmentSnapshot= - + if [ -z "$description" -a -f "$infosfile" ]; then read_jawotools_properties "$infosfile" fi - + if [ -f "$versionfile" ]; then # si le fichier de version existe... version="$(awk <"$versionfile" '{ @@ -128,12 +128,12 @@ function wotag() { if [ -n "$srcdir" -a -x "$scriptdir/reldiff" ]; then "$scriptdir/reldiff" -p "$srcdir" -c && developmentSnapshot=1 fi - + else # pas de fichier de version. il faut saisir les valeurs à la main version_or_date_flag=-i [ \( -z "$version" -o "$version" == "-" \) -a -z "$releaseDate" ] && version_or_date_flag=-c - + read_value -i "Entrez la description" description "$description" N if [ "$version" == "-" ]; then version= @@ -147,16 +147,16 @@ function wotag() { fi read_value $version_or_date_flag "Entrez la date de release" releaseDate "$releaseDate" N [ "$releaseDate" == "-" ] && releaseDate= - + if [ -z "$version" -a -z "$releaseDate" ]; then die "Il faut avoir un numéro de version et/ou une date de release" fi fi - + einfo "${message:-$(basename "$bundir")}: Version${version:+ $version}${releaseDate:+ du $releaseDate}${developmentSnapshot:+ (developmentSnapshot)}" [ "$infosfile" != "$infosfile2" ] && rm -f "$infosfile" file_set_properties -c "$infosfile2" description "$description" version "$version" releaseDate "$releaseDate" developmentSnapshot "$developmentSnapshot" - + else die "Action inconnue: $action" fi diff --git a/legacy/sysinc/base b/legacy/sysinc/base index f00898d..1edbaad 100644 --- a/legacy/sysinc/base +++ b/legacy/sysinc/base @@ -176,11 +176,11 @@ $name = $value" $name = \"$(quote_awk "$value")\"" fi ;; - + -*) #ewarn "option non reconnue: $1" ;; - + *) done=1 ;; @@ -852,7 +852,7 @@ function estepn() { echo_ "${COULEUR_BLANCHE}*${COULEUR_NORMALE} " tooenc_ "$*" } - + function ebegin() { # Le début d'une opération eval `check_verbosity --action "$1" 2` @@ -941,7 +941,7 @@ function ewait() { local action status action="$(check_verbosity --action "$1" 2)" status=$? # le status de check_verbosity - if [ "$action" == "return" ]; then # + if [ "$action" == "return" ]; then # # ne rien afficher, mais attendre quand même que le processus s'arrête [ $status -eq 1 ] && shift @@ -961,7 +961,7 @@ function ewait() { local pid="$1" local count=2 # attendre 2 secondes avant de commencer à afficher des "+" [ -z "$pid" ] && return - + little_sleep # certains processus retournent tout de suite while is_running "$pid"; do sleep 1 diff --git a/legacy/sysinc/functions b/legacy/sysinc/functions index 097f517..4b756fe 100644 --- a/legacy/sysinc/functions +++ b/legacy/sysinc/functions @@ -330,10 +330,10 @@ function simple_menu() { else echo "$i_ - $option_" fi - i_=$(($i_ + 1)) + i_=$(($i_ + 1)) done fi - + # Afficher les choix if [ -n "$votre_choix_" ]; then tooenc_ "$votre_choix_" @@ -487,7 +487,7 @@ function actions_menu() { fi fi fi - + # Afficher les choix tooenc_ " Actions disponibles: " "$UTF8" @@ -499,7 +499,7 @@ Actions disponibles: " "$UTF8" fi echo_ ": " read choice_ - + # vérifier la saisie choice_option_="$(expr "$choice_" : "\([0-9]*\)")" if [ -n "$choice_option_" ]; then @@ -1272,7 +1272,7 @@ function deref() { # lien relatif file="$basedir/$link" fi - + max_deref=$(($max_deref - 1)) [ $max_deref -eq 0 ] && die "Plus de 50 indirection. Le lien $file est-il récursif?" done @@ -1393,7 +1393,7 @@ function array_isempty() { # tester si un tableau est vide test $(array_count "$1") -eq 0 } - + function array_new() { # créer un tableau vide dont le nom est $1 eval "$1=()" @@ -1765,11 +1765,11 @@ function dumpurl() { -X) no_proxy=1 ;; - + -*) #ewarn "option non reconnue: $1" ;; - + *) done=1 ;; @@ -1798,7 +1798,7 @@ function dumpurl() { curl="$curl -f -s \"$(quote_arg "$url")\"" eval "$curl" - + elif [ "$dumpurl_method" == "wget" ]; then wget="wget${no_proxy:+ --no-proxy}" for header in "${headers[@]}"; do @@ -1815,7 +1815,7 @@ function dumpurl() { wget="$wget -q -O - \"$(quote_arg "$url")\"" eval "$wget" - + # XXX pas encore implémenté #elif [ "$dumpurl_method" == "telnet" ]; then # return 1 diff --git a/legacy/sysinc/system_caps b/legacy/sysinc/system_caps index 1e2a4e4..89df6d8 100644 --- a/legacy/sysinc/system_caps +++ b/legacy/sysinc/system_caps @@ -40,7 +40,7 @@ if [ -z "$__SYSTEM_CAPS_COMPUTED__" ]; then function __get_which_caps__() { [ "$SYSTEM_NAME" = "Linux" ] && return - + # Obtenir les capacités de which: certaines implémentations affichent "no x # in ..." sur stdout au lieu de l'afficher sur stderr local OENC="$UTF8" @@ -56,7 +56,7 @@ if [ -z "$__SYSTEM_CAPS_COMPUTED__" ]; then fi /bin/rm -f "$tmpout" /bin/rm -f "$tmperr" - + if [ "$__legacy_which__" == 1 ]; then local grep="${grep:-`which grep 2>&1`}" if [ -x "$grep" ]; then @@ -90,28 +90,28 @@ if [ -z "$__SYSTEM_CAPS_COMPUTED__" ]; then local OENC="$UTF8" local prog="$1"; shift local req="$1"; shift - + if [ -z "$prog" ]; then die "USAGE: __set_prog_func__ prog_func req? path [paths...]" fi - + if [ -n "${!prog}" ]; then # Si une variable de ce nom est deja definie, on assume qu'il # s'agit du chemin vers le programme __define_and_eval__ 'function '"$prog"'() { '"${!prog}"' "$@"; }' return 0 fi - + local found= while [ -n "$1" ]; do local path="$1"; shift - + if [ "$path" = "--legacy" ]; then # Declarer que les programmes qui suivent sont "legacy" __define_and_eval__ 'export __legacy_'"$prog"'__=1' continue fi - + if [ "${path#/}" = "$path" ] && progexists "$path"; then # Si on donne un nom de programme, et que ce programme se # trouve dans le path, l'adopter avec son chemin absolu @@ -122,24 +122,24 @@ if [ -z "$__SYSTEM_CAPS_COMPUTED__" ]; then found=1 break fi - + if [ "$path" = "-" ] && progexists "$prog"; then # pas la peine de creer une fonction, la commande existe # deja avec ce nom-la dans le path found=1 break fi - + if [ -d "$path" ]; then path="$path/$prog"; fi if [ -d "$path" ]; then continue; fi - + if [ -x "$path" ]; then __define_and_eval__ 'function '"$prog"'() { "'"$path"'" "$@"; }' found=1 break fi done - + if [ -z "$found" -a -n "$req" ]; then if [ "$req" = "-" ]; then req="$prog"; fi die "Ce script requière $req @@ -150,20 +150,20 @@ et relancez ce script" test -n "$found" } - + function __get_tools_path_and_caps__() { [ "$SYSTEM_NAME" = "Linux" ] && return - + # Obtenir l'emplacement d'outils standards, tels que: # cp, awk, grep, diff, tar, ps, date local system - + # cp for system in SunOS Darwin; do [ "$SYSTEM_NAME" = "$system" ] && __define_and_eval__ 'export __legacy_cp__=1' done [ -n "$__legacy_cp__" ] && __define_and_eval__ 'function cp_a() { /bin/cp -pR "$@"; }' - + # awk if [ "$SYSTEM_NAME" = "SunOS" ]; then __set_prog_func__ awk "gawk or nawk" \ @@ -172,7 +172,7 @@ et relancez ce script" /opt/sfw/bin/gawk \ --legacy nawk \ /usr/bin/nawk - + elif [ "$SYSTEM_NAME" = "Darwin" ]; then # note: gensub() n'est supporté que sur gnuawk # si __legacy_awk__ est défini, on sait que cette fonction n'est pas @@ -183,7 +183,7 @@ et relancez ce script" /sw/bin/awk \ --legacy /usr/bin/awk fi - + # grep if [ "$SYSTEM_NAME" = "SunOS" ]; then __set_prog_func__ grep - \ @@ -195,7 +195,7 @@ et relancez ce script" if [ -n "$__legacy_grep__" ]; then __define_and_eval__ 'function quietgrep() { grep "$@" >&/dev/null; }' fi - + # diff if [ "$SYSTEM_NAME" = "SunOS" ]; then __set_prog_func__ diff - \ @@ -207,7 +207,7 @@ et relancez ce script" if [ -n "$__legacy_diff__" ]; then __define_and_eval__ 'function quietdiff() { diff "$@" >&/dev/null; }' fi - + # tar if [ "$SYSTEM_NAME" = "SunOS" ]; then __set_prog_func__ tar - \ @@ -215,14 +215,14 @@ et relancez ce script" /usr/sfw/bin/gtar \ /opt/sfw/bin/gtar \ --legacy /usr/bin/tar - + elif [ "$SYSTEM_NAME" = "Darwin" ]; then __set_prog_func__ tar - \ gnutar gtar \ /sw/bin/gtar \ --legacy /usr/bin/tar fi - + # ps if [ "$SYSTEM_NAME" = "SunOS" ]; then __set_prog_func__ ps - \ @@ -235,12 +235,12 @@ et relancez ce script" if [ -n "$__legacy_ps__" ]; then __define_and_eval__ 'function ps_all() { ps -ef; }' fi - + # sleep if [ "$SYSTEM_NAME" = "SunOS" -o "$SYSTEM_NAME" = "Darwin" ]; then __define_and_eval__ 'function little_sleep() { n=1000; while [ $n -gt 0 ]; do n=$(($n - 1)); done; }' fi - + # date if [ "$SYSTEM_NAME" = "SunOS" ]; then __set_prog_func__ date - \ @@ -248,7 +248,7 @@ et relancez ce script" /usr/sfw/bin/gdate \ /opt/sfw/bin/gdate \ --legacy /usr/bin/date - + elif [ "$SYSTEM_NAME" = "Darwin" ]; then __set_prog_func__ date - \ --legacy /bin/date @@ -283,7 +283,7 @@ et relancez ce script" # is_root if [ "$SYSTEM_NAME" = "SunOS" ]; then __define_and_eval__ 'function is_root() { id | quietgrep "uid=0"; }' - + elif [ "$SYSTEM_NAME" = "Cygwin" -o "$SYSTEM_NAME" = "Mingw" ]; then # on assume que sur ces systèmes, l'utilisateur est maitre à bord. __define_and_eval__ 'function is_root() { true; }' @@ -334,7 +334,7 @@ function sedi() { if [ "$SYSTEM_NAME" = "Darwin" ]; then function __pd_isleap() { # tester si l'année $1 est bissextile - [ $(($1 % 4)) -eq 0 -a \( $(($1 % 100)) -ne 0 -o $(($1 % 400)) -eq 0 \) ] + [ $(($1 % 4)) -eq 0 -a \( $(($1 % 100)) -ne 0 -o $(($1 % 400)) -eq 0 \) ] } function __pd_fix_month() { # soit $1 le nom d'une variable contenant une année, et $2 le nom d'une diff --git a/legacy/twinc/TODO.html b/legacy/twinc/TODO.html index 797df58..87dd1ed 100644 --- a/legacy/twinc/TODO.html +++ b/legacy/twinc/TODO.html @@ -507,7 +507,7 @@ config.formatters = [ }, { - name: "wikifyCommentForPlugin", + name: "wikifyCommentForPlugin", match: "^/\\*\\*\\*\\n", terminator: "^\\*\\*\\*/\\n", handler: function(w) @@ -2483,7 +2483,7 @@ function saveChanges() alert(config.messages.emptyFailed); } // Save new file - var revised = original.substr(0,posOpeningDiv + startSaveArea.length) + + var revised = original.substr(0,posOpeningDiv + startSaveArea.length) + convertUnicodeToUTF8(allTiddlersAsHtml()) + "\n\t\t" + original.substr(posClosingDiv); var newSiteTitle = convertUnicodeToUTF8((getElementText("siteTitle") + " - " + getElementText("siteSubtitle")).htmlEncode()); @@ -2801,7 +2801,7 @@ function detectPlugin() var numFound = 0; for(namesCounter=0; namesCounter < daPlugins.length; namesCounter++) { - if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) || + if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) || (navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) numFound++; } @@ -3636,7 +3636,7 @@ Date.convertFromYYYYMMDDHHMM = function(d) } // --------------------------------------------------------------------------------- -// DOM utilities - many derived from www.quirksmode.org +// DOM utilities - many derived from www.quirksmode.org // --------------------------------------------------------------------------------- function drawGradient(place,horiz,colours) @@ -4008,7 +4008,7 @@ function setStylesheet(s,id) diff --git a/legacy/twinc/TODO.js b/legacy/twinc/TODO.js index 57eb274..32dd11e 100644 --- a/legacy/twinc/TODO.js +++ b/legacy/twinc/TODO.js @@ -29,13 +29,13 @@ function getAllTodos(types, expectedTags) { } if (!allTagsOk) continue; } - + result.push(tiddlers[i]); } - + if (!sortBy) sortBy = "title"; result.sortBy(sortBy, reverse); - + return result; } @@ -362,7 +362,7 @@ config.formatters.push({ var onClick = function(e) { e = ClickHandler.getEvent(e); - if (!readOnly) { + if (!readOnly) { // lire les infos sur le tiddler var body = store.getTiddlerText(title); var tags = Tiddlers.getTags(title); @@ -381,17 +381,17 @@ config.formatters.push({ if (mo) { var done = mo[0] == "[]"; body = body.substr(0, mo.index) + (done? "[x]": "[]") + body.substr(mo.index + mo[0].length); - + lastTodoId = 0; store.saveTiddler(title, title, body, config.options.txtUserName, new Date(), tags); if (config.options.chkAutoSave) saveChanges(); refreshTiddler(title); } } - + return ClickHandler.end(e); }; - + var span = createTiddlyElement(place, "span"); var cb = createTiddlyElement(span, "input"); cb.type = "checkbox"; diff --git a/legacy/twinc/base.js b/legacy/twinc/base.js index 5cce6eb..23649d4 100644 --- a/legacy/twinc/base.js +++ b/legacy/twinc/base.js @@ -42,7 +42,7 @@ String.prototype.expandVars = function(vars, recursive) { // remplacer les éléments de date var now = vars && vars["now"]? Dat.valueOf(vars["now"]): new Date(); text = now.expandVars(text); - + if (vars) { // remplacer la valeurs des variables var pos = 0; @@ -68,7 +68,7 @@ String.prototype.expandVars = function(vars, recursive) { } } while(mo); } - + return text; } @@ -364,7 +364,7 @@ window.closeTiddler = function(title, slowly) { displayTiddlers_patchedByBase = window.displayTiddlers; window.displayTiddlers = function(src, titles, state, highlightText, highlightCaseSensitive, animate, slowly) { // patcher displayTiddlers pour permettre l'affichage d'une liste de tiddlers générés par une macro. - // La macro doit implémenter textHandler pour être reconnue + // La macro doit implémenter textHandler pour être reconnue if (titles.indexOf("<<") != -1) { var pos = 0; var re_macro = new RegExp("<<([^>\\s]+)(?:\\s*)([^>]*)>>", "mg"); @@ -417,15 +417,15 @@ createTiddlerToolbar = function(title, isEditor) { var lingo = config.views; if (isEditor) lingo = lingo.editor; else lingo = lingo.wikified; - + removeChildren(theToolbar); insertSpacer(theToolbar); var toolbarButtons = lingo.toolbarButtons; for (var i = 0; i < toolbarButtons.length; i++) { var toolbarButton = toolbarButtons[i]; - + if (i > 0) insertSpacer(theToolbar); - if (!readOnly || !toolbarButton.notReadOnly) { + if (!readOnly || !toolbarButton.notReadOnly) { createTiddlyButton(theToolbar, toolbarButton.text, toolbarButton.tooltip, toolbarButton.onClick); } } @@ -437,7 +437,7 @@ function installToolbarButton(toolbarButton, editor, before) { var lingo = config.views; if (editor) lingo = lingo.editor; else lingo = lingo.wikified; - + var pos = -1; if (before) { pos = lingo.toolbarButtons.indexOfItem(before); @@ -453,7 +453,7 @@ function removeToolbarButton(toolbarButton, editor) { var lingo = config.views; if (editor) lingo = lingo.editor; else lingo = lingo.wikified; - + var pos = lingo.toolbarButtons.indexOfItem(toolbarButton); if (pos != -1) { lingo.toolbarButtons.splice(pos, 1); @@ -509,7 +509,7 @@ Options.prototype.get = function(name, def) { // obtenir la valeur d'une option, avec une valeur par défaut if (this[name]) return this[name]; return def; -} +} Options.prototype.getArg = function(index, def) { // obtenir la valeur d'un argument, avec une valeur par défaut if (this.args[index]) return this.args[index]; @@ -559,7 +559,7 @@ config.macros.newTiddler.handler = function(place, macroName, params) { var tooltip = options.get("tooltip", "Create a new tiddler named " + title); var text = options.get("text", "new " + (tags? "tagged ": "") + "tiddler"); } - + var onClick = function() { displayTiddler(null, title, 2, null, null, false, false); var tagsBox = document.getElementById("editorTags" + title); @@ -594,7 +594,7 @@ config.macros.event.getRemainingDays = function(remaining) { else if (remaining == -1) remainingDays = this.YESTERDAY; else if (remaining < 0) remainingDays = this.PAST_EVENT; else remainingDays = this.FUTURE_EVENT; - + return remainingDays; } config.macros.event.textHandler = function(params) { @@ -627,13 +627,13 @@ config.macros.showEvents.textHandler = function(params) { var noEventsFormat = options.get("noEventsFormat", this.NO_EVENTS_FORMAT); var headerFormat = options.get("headerFormat", this.HEADER_FORMAT); var format = options.get("format", this.FORMAT); - + var vars = {} var tiddlers = store.reverseLookup("tags", "event", true, "title"); - + if (tiddlers && tiddlers.length) { var text = expandVars(headerFormat, vars) + "\n"; - + for (var i = 0; i < tiddlers.length; i++) { var tags = tiddlers[i].getTags(); var re_date = new RegExp("\\s?@([0-9]+/[0-9]+/[0-9]+)\\s?", "g"); @@ -643,7 +643,7 @@ config.macros.showEvents.textHandler = function(params) { var title = tiddlers[i].title; var remaining = new Date().diffDays(date); var remainingDays = config.macros.event.getRemainingDays(remaining); - + var vars = {remaining: remaining, remainingDays: remainingDays, title: title, date: date.formatFr()}; text += expandVars(format, vars, true) + "\n"; } @@ -651,7 +651,7 @@ config.macros.showEvents.textHandler = function(params) { } else { var text = expandVars(noEventsFormat, vars); } - + return text; } config.macros.showEvents.handler = function(place, macroName, params) { @@ -688,12 +688,12 @@ config.macros.calendar.handler = function(place, macroName, params) { var firstCalDay = firstDay.getMonday(); var table, tr, td; - + buildModifiedTiddlers(); table = createTiddlyElement(place, "table"); table.setAttribute("class", "calendar"); - + var onClickPreviousMonth = function(e) { currentFirstDay = currentFirstDay.addMonths(-1); config.macros.calendar.refresh(e); @@ -711,17 +711,17 @@ config.macros.calendar.handler = function(place, macroName, params) { td = createTiddlyElement(tr, "td"); createTiddlyButton(td, "<", "mois précédent", onClickPreviousMonth); - + td = createTiddlyElement(tr, "td"); td.colSpan = 5; createTiddlyText(td, MMMM[firstDay.getMonth()] + " " + firstDay.getFullYear()); - + td = createTiddlyElement(tr, "td"); createTiddlyButton(td, ">", "mois suivant", onClickNextMonth); tr = createTiddlyElement(table, "tr"); tr.setAttribute("class", "hdrRow"); - + for (var i = 0; i < D.length; i++) { td = createTiddlyElement(tr, "td"); createTiddlyText(td, D[i]); @@ -733,10 +733,10 @@ config.macros.calendar.handler = function(place, macroName, params) { function createCal(table, now, firstCalDay, firstDay) { var td, tr; - + var lastDay = firstDay.getLastDay(); var day = firstCalDay; - + do { tr = createTiddlyElement(table, "tr"); tr.setAttribute("class", "calRow"); @@ -769,12 +769,12 @@ function createCalDay(td, day, firstDay, now, lastDay) { td.onclick = function(e) { e = ClickHandler.getEvent(e); var popup = Popup.create(resolveTarget(e)); - + if (!readOnly) { var tags = "event @" + day.formatFr(); wikify("<>", popup); } - + var addLinks = function(tiddlers, title, field) { if (tiddlers && tiddlers.length) { if (field) tiddlers.sortBy(field); @@ -788,14 +788,14 @@ function createCalDay(td, day, firstDay, now, lastDay) { } } } - + addLinks(events, "événements:"); addLinks(modified, "modifiés:", "title"); - + Popup.show(); return ClickHandler.end(e); } - + createTiddlyText(td, day.getDate()); } @@ -898,7 +898,7 @@ toolbarKeep.onClick = function(e) { if(this.parentNode.id) { keepTiddler(this.parentNode.id.substr(7)); } - + return ClickHandler.end(e); } diff --git a/legacy/twinc/old.js b/legacy/twinc/old.js index 06b7600..0fcb863 100644 --- a/legacy/twinc/old.js +++ b/legacy/twinc/old.js @@ -32,7 +32,7 @@ config.macros.todo.handler = function(place, macroName, params) { var onClick = function(e) { if (!e) var e = window.event; - if (!readOnly) { + if (!readOnly) { // lire les infos sur le tiddler var body = store.getTiddlerText(title); var tags = Tiddlers.getTags(title); @@ -59,18 +59,18 @@ config.macros.todo.handler = function(place, macroName, params) { delete options.done; } body = body.substr(0, mo.index) + "<>" + body.substr(mo.index + mo[0].length); - + lastTodoId = 0; store.saveTiddler(title, title, body, config.options.txtUserName, now, tags); if (config.options.chkAutoSave) saveChanges(); } } - + e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation(); return false; }; - + var span = createTiddlyElement(place, "span"); var cb = createTiddlyElement(span, "input"); cb.type = "checkbox"; diff --git a/lib/b36sha1.py b/lib/b36sha1.py index 3f72fc1..f65807b 100755 --- a/lib/b36sha1.py +++ b/lib/b36sha1.py @@ -2,10 +2,10 @@ # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""%(scriptname)s: afficher le hash SHA-1 d'un fichier exprimé en base 36 - + USAGE %(scriptname)s [options] - + OPTIONS -s, --skip Ignorer les premières lignes modeline + empty. Le dernier saut de ligne diff --git a/lib/init.d/kvm-stop-all b/lib/init.d/kvm-stop-all index 0253574..ace3492 100755 --- a/lib/init.d/kvm-stop-all +++ b/lib/init.d/kvm-stop-all @@ -2,11 +2,11 @@ # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 ### BEGIN INIT INFO # Provides: kvm-stop-all -# Required-Start: -# Required-Stop: -# Should-Start: +# Required-Start: +# Required-Stop: +# Should-Start: # Should-Stop: libvirt kvm $remote_fs $network $syslog $named -# Default-Start: +# Default-Start: # Default-Stop: 0 1 6 # X-Interactive: true # Short-Description: stops kvm virtual machines diff --git a/lib/init.d/openvz-fix-etchosts b/lib/init.d/openvz-fix-etchosts index 29b46b8..3437c79 100755 --- a/lib/init.d/openvz-fix-etchosts +++ b/lib/init.d/openvz-fix-etchosts @@ -3,9 +3,9 @@ ### BEGIN INIT INFO # Provides: openvz-fix-etchosts # Required-Start: $network -# Required-Stop: -# Should-Start: -# Should-Stop: +# Required-Stop: +# Should-Start: +# Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # X-Interactive: true diff --git a/lib/makeself-2.1.5/makeself-header.sh b/lib/makeself-2.1.5/makeself-header.sh index 376292f..6838dd7 100755 --- a/lib/makeself-2.1.5/makeself-header.sh +++ b/lib/makeself-2.1.5/makeself-header.sh @@ -73,7 +73,7 @@ Makeself version $MS_VERSION \$0 --lsm Print embedded lsm entry (or no LSM) \$0 --list Print the list of files in the archive \$0 --check Checks integrity of the archive - + 2) Running \$0 : \$0 [options] [--] [additional arguments to embedded script] with following options (in that order) diff --git a/lib/makeself-2.1.5/makeself.1 b/lib/makeself-2.1.5/makeself.1 index d0f2caa..d698897 100644 --- a/lib/makeself-2.1.5/makeself.1 +++ b/lib/makeself-2.1.5/makeself.1 @@ -2,18 +2,18 @@ .SH "NAME" makeself \- An utility to generate self-extractable archives. .SH "SYNTAX" -.LP -.B makeself [\fIoptions\fP] archive_dir file_name label +.LP +.B makeself [\fIoptions\fP] archive_dir file_name label .B [\fIstartup_script\fP] [\fIargs\fP] .SH "DESCRIPTION" -.LP -This program is a free (GPL) utility designed to create self-extractable -archives from a directory. +.LP +This program is a free (GPL) utility designed to create self-extractable +archives from a directory. .br .SH "OPTIONS" -.LP +.LP The following options are supported. -.LP +.LP .TP 15 .B -v, --version Prints out the makeself version number and exits. @@ -34,7 +34,7 @@ Compress using the UNIX 'compress' command. Do not compress the data. .TP .B --notemp -The archive will create archive_dir in the current directory and +The archive will create archive_dir in the current directory and uncompress in ./archive_dir. .TP .B --copy @@ -48,7 +48,7 @@ The label and startup scripts will then be ignored. Files will be extracted to the current directory. Implies --notemp. .TP .B --header file -Specify location of the header script. +Specify location of the header script. .TP .B --follow Follow the symlinks in the archive. @@ -69,8 +69,8 @@ Do not create a CRC32 checksum for the archive. LSM file describing the package. .PD .SH "AUTHORS" -.LP +.LP Makeself has been written by Stéphane Peter . -.BR -This man page was originally written by Bartosz Fenski for the +.BR +This man page was originally written by Bartosz Fenski for the Debian GNU/Linux distribution (but it may be used by others). diff --git a/lib/makeself-2.1.5/makeself.lsm b/lib/makeself-2.1.5/makeself.lsm index 1d28ba5..5bf8068 100644 --- a/lib/makeself-2.1.5/makeself.lsm +++ b/lib/makeself-2.1.5/makeself.lsm @@ -1,8 +1,8 @@ Begin3 Title: makeself.sh Version: 2.1 -Description: makeself.sh is a shell script that generates a self-extractable - tar.gz archive from a directory. The resulting file appears as a shell +Description: makeself.sh is a shell script that generates a self-extractable + tar.gz archive from a directory. The resulting file appears as a shell script, and can be launched as is. The archive will then uncompress itself to a temporary directory and an arbitrary command will be executed (for example an installation script). This is pretty similar diff --git a/lib/makeself-2.1.5/makeself.sh b/lib/makeself-2.1.5/makeself.sh index fef1957..7d26afa 100755 --- a/lib/makeself-2.1.5/makeself.sh +++ b/lib/makeself-2.1.5/makeself.sh @@ -23,13 +23,13 @@ # support for non-temporary archives. Ideas thanks to Francois Petitjean # - 1.3 : More patches from Bjarni R. Einarsson and Francois Petitjean: # Support for no compression (--nocomp), script is no longer mandatory, -# automatic launch in an xterm, optional verbose output, and -target +# automatic launch in an xterm, optional verbose output, and -target # archive option to indicate where to extract the files. # - 1.4 : Improved UNIX compatibility (Francois Petitjean) # Automatic integrity checking, support of LSM files (Francois Petitjean) # - 1.5 : Many bugfixes. Optionally disable xterm spawning. # - 1.5.1 : More bugfixes, added archive options -list and -check. -# - 1.5.2 : Cosmetic changes to inform the user of what's going on with big +# - 1.5.2 : Cosmetic changes to inform the user of what's going on with big # archives (Quake III demo) # - 1.5.3 : Check for validity of the DISPLAY variable before launching an xterm. # More verbosity in xterms and check for embedded command's return value. diff --git a/lib/profile.d/proxy.shared b/lib/profile.d/proxy.shared index 0ac3c04..f80b175 100644 --- a/lib/profile.d/proxy.shared +++ b/lib/profile.d/proxy.shared @@ -49,7 +49,7 @@ function set_proxy() { done [ -n "$no_proxy" ] || unset no_proxy fi - + if [ -n "$proxy" ]; then if [ -n "$PROXY_LOGIN" ]; then proxy="${proxy/http:\/\//http://${PROXY_LOGIN}${PROXY_PASSWORD:+:$PROXY_PASSWORD}@}" diff --git a/lib/pyulib/migrate/tasks1/TODO.py b/lib/pyulib/migrate/tasks1/TODO.py index 7d0568b..d349251 100644 --- a/lib/pyulib/migrate/tasks1/TODO.py +++ b/lib/pyulib/migrate/tasks1/TODO.py @@ -90,7 +90,7 @@ class TODO: def to_line(self): if self.title is None: return None - + tags = [] if self.contexts is not None: tags.extend(map(lambda c: "@" + c, self.contexts)) if self.projects is not None: tags.extend(map(lambda p: "+" + p, self.projects)) @@ -100,7 +100,7 @@ class TODO: if tags: line = line + " ".join(tags) + " " line = line + quote_nl(self.title) if self.desc is not None: line = line + "\\n" + quote_nl(self.desc) - + return line def to_string(self): @@ -116,7 +116,7 @@ class TODO: tags.append("%s=%s" % (tag, self.tags[tag])) if tags: string = string + " " + " ".join(tags) string = string + "\n" - + string = string + self.title if self.desc: string = string + "\n\n" + self.desc @@ -167,7 +167,7 @@ class TODO: def set_project_released(self, project, date=None): if date is None: date = datef() self.tags["%s_released" % project] = date - + # Filtre def filter(self, filters=None, **kw): @@ -200,7 +200,7 @@ class TODO: else: if filter not in self.tags or self.tags[filter] != value: return False return True - + class TODOFile(TextFile): def __init__(self, file, DONE_file=False, raise_exception=False): TextFile.__init__(self) @@ -275,7 +275,7 @@ class TODOFile(TextFile): for todo in todos: self.todos.remove(todo) self.__update_todonum() - + def put(self, todo): if not isinstance(todo, TODO): todo = TODO(todoline=todo) self.remove(todo) @@ -291,7 +291,7 @@ class TODOFile(TextFile): def release(self, released, release_date=None, version=None, changes=None): pass - + class TiddlyTODOFile: RE_DATE = re.compile(r'(\d\d)/(\d\d)/(\d\d\d\d)$') RE_ID = re.compile(r'(\d\d)/(\d\d)/(\d\d\d\d)-(\d+)$') @@ -318,13 +318,13 @@ class TiddlyTODOFile: else: id = todo_or_id if id is None: raise ValueError("Il n'est possible de mettre à jour qu'un TODO avec un id") - + self.tw.remove(self.get_tiddler(id)) def put(self, todo): id = todo.get("id", None) if id is None: raise ValueError("Il n'est possible de mettre à jour qu'un TODO avec un id") - + tiddler = self.get_tiddler(id) modifier = None modified = None @@ -345,7 +345,7 @@ class TiddlyTODOFile: twtags.append("TODO") self.tw.put(Tiddler(tiddler, twtext, " ".join(twtags), modifier, modified)) - + def save(self): self.tw.save() @@ -376,10 +376,10 @@ class TiddlyTODOFile: twtags = [release_name, "release"] self.tw.put(Tiddler(tiddler, twtext, " ".join(twtags))) - + class TODOs: DEFAULTS = {"scriptdir": scriptdir} - + def __init__(self, todorcfile=None): if todorcfile is None: todorcfile = path.join(os.environ["HOME"], ".utools/todorc") @@ -424,7 +424,7 @@ class TODOs: ## Interface utilisateur def list(self, filters=None, **kw): return self.todos.list(filters, **kw) - + def get(self, filters=None, **kw): todos = self.list(filters, **kw) if len(todos) == 0: return None @@ -451,7 +451,7 @@ class TODOs: todo = self.todos.put(todo) self.__put_in_projects(todo) self.todos.save() - + def add(self, title=None, desc=None, contexts=None, projects=None, tags=None, set_done=False, todoline=None): tags = tags or {} # Calculer la date @@ -478,7 +478,7 @@ class TODOs: todo.tags.update(tags) self.put(todo) - + def do(self, filters=None, **kw): todos = self.list(filters, **kw) date = datef() @@ -490,7 +490,7 @@ class TODOs: modified = True self.__put_in_projects(todo) if modified: self.todos.save() - + def __remove_from_projects(self, todo): for project in todo.projects: projdir = self.get_projdir(project) @@ -500,7 +500,7 @@ class TODOs: else: todofile = TODOFile(projdir) todofile.remove(todo) todofile.save() - + def remove(self, filters=None, **kw): todos = self.list(filters, **kw) modified = False @@ -543,7 +543,7 @@ class TODOs: self.todos.remove(done) modified = True self.__put_in_projects(done, DONE_file=True) - + if modified: self.todos.save() self.dones.save() @@ -684,14 +684,14 @@ class TODOs: def closed_bar(self, max=20): n = self.closed_perc * max / 100 return "=" * n + (max - n) * " " - + def print_reports(self, title, reports): if not reports: return - + print title print "-" * len(title) print - + def cmp_report(r0, r1): r = cmp(r0.pri, r1.pri) if r != 0: return r @@ -711,7 +711,7 @@ class TODOs: report.valid_total ) print - + def do_report(self): """Afficher un rapport sur les tâches """ diff --git a/lib/pyulib/migrate/tasks1/TODO_helper.py b/lib/pyulib/migrate/tasks1/TODO_helper.py index 97b437b..b1ff3cf 100755 --- a/lib/pyulib/migrate/tasks1/TODO_helper.py +++ b/lib/pyulib/migrate/tasks1/TODO_helper.py @@ -62,7 +62,7 @@ def ensure(twfile): def run(): todorc = None twfile = None - + opts, args = get_args(None, [ ("h", "help", "Afficher l'aide"), ("c:", None, "Spécifier le fichier todorc"), diff --git a/lib/pyulib/migrate/tasks1/tiddlywiki.py b/lib/pyulib/migrate/tasks1/tiddlywiki.py index c57a8d7..550fa7b 100755 --- a/lib/pyulib/migrate/tasks1/tiddlywiki.py +++ b/lib/pyulib/migrate/tasks1/tiddlywiki.py @@ -19,7 +19,7 @@ from pyutools.TiddlyWiki import * def run(): twfile = None - + opts, args = get_args(None, [ ("h", "help", "Afficher l'aide"), ("f:", None, "Spécifier le fichier tiddlywiki.html"), diff --git a/lib/pyulib/migrate/tasks1/tiddlywiki2.py b/lib/pyulib/migrate/tasks1/tiddlywiki2.py index e6a1069..3601e06 100644 --- a/lib/pyulib/migrate/tasks1/tiddlywiki2.py +++ b/lib/pyulib/migrate/tasks1/tiddlywiki2.py @@ -68,7 +68,7 @@ def ensure_unicode(data): if data is None: return None elif type(data) is types.UnicodeType: return data else: return unicode(data, ARGS_ENCODING) - + def quote_nl(text): text = text.replace("\n", "\\n") return text @@ -96,7 +96,7 @@ class Tiddler: """Retourner True si ce Tiddler est valide """ return self.tiddler is not None - + def parse(self, line): """Charger un Tiddler depuis line, et retourner le reste de la chaine qui n'a pas été parsé """ @@ -113,7 +113,7 @@ class Tiddler: """Retourner ce tiddler sous forme de ligne """ if not self.is_valid(): die("Il faut spécifier l'id du tiddler") - + line = u' 0: return filtered[0] else: return None - + def has_props(self): return len(self.props) != 0 def has_prop(self, name): @@ -479,7 +479,7 @@ TF_ENCODING = 'encoding' # encoding par défaut du fichier class TextFile(TasksFile): """Fichier de tâches au format texte. """ - + TASKS_TXT = ['TASKS.txt', 'tasks.txt'] PURGED_TXT = ['PURGED.txt', 'purged.txt'] FILENAMES = [TASKS_TXT, PURGED_TXT] @@ -491,7 +491,7 @@ class TextFile(TasksFile): tasks = None props = None - + def __init__(self, src=None, filetype=TASKS_FILETYPE, raise_exception=False): self.tasks = [] self.props = {} @@ -591,12 +591,12 @@ class TextFile(TasksFile): def get_file(self): return self.pf - + def get_lastid(self): return int(self.get_prop(TF_LASTID, 0)) def set_lastid(self, lastid): self.set_prop(TF_LASTID, int(lastid)) - + class TWFile(TasksFile): """Fichier de tâches au format TiddlyWiki """ @@ -607,11 +607,11 @@ class TWFile(TasksFile): twfile = None tasks = None props = None - + def __init__(self, src=None, raise_exception=False): self.tasks = [] self.props = {} - + if src is None: twfile = TiddlyWiki(src, raise_exception=False) if twfile.is_valid(): @@ -630,14 +630,14 @@ class TWFile(TasksFile): self.valid = False # XXX continuer ici twfile = TiddlyWiki(src, raise_exception=False) - + def save(self, file=None, raise_exception=True): pass class ProxyTask: __task = None index = None - + def __init__(self, task, index): self.__task = task self.index = index @@ -648,7 +648,7 @@ class ProxyTask: class FileAggregate(TasksFile): __tfs = None - + def __init__(self, tfs): self.__tfs = [] for tf in tfs: @@ -691,7 +691,7 @@ class FileAggregate(TasksFile): filtered.append(ProxyTask(t, t.index + offset)) offset += len(tf) return filtered - + def has_props(self): for tf in self.__tfs: if tf.has_props(): return True @@ -712,7 +712,7 @@ class FileAggregate(TasksFile): raise NotImplementedError def set_lastid(self, lastid): raise NotImplementedError - + def is_valid(self): raise NotImplementedError @@ -853,7 +853,7 @@ class TasksCLI: if purgedfile is not None: purgedfile = TextFile(purgedfile) else: purgedfile = TextFile(self.tasksrc.get_purgedsrc(), TextFile.PURGED_FILETYPE) self.purgedfile = purgedfile - return self.purgedfile + return self.purgedfile def __init__(self, tasksrc=None): if not isinstance(tasksrc, TasksrcFile): @@ -862,7 +862,7 @@ class TasksCLI: CONFOPT = 'c:' CONFLOPT = ['config=', 'tasksdir=', 'projdirs=', 'tasksfile=', 'purgedfile='] - + def is_global_option(self, opt, value): if opt in ('-c', '--config'): self.tasksrc = TasksrcFile(value) @@ -914,7 +914,7 @@ class TasksCLI: pd = path.join(projdir, p) if path.isdir(pd): return pd return None - + def get_project(self): """Retourner le nom du projet si on est dans un répertoire de projet, None sinon """ @@ -953,7 +953,7 @@ class TasksCLI: """ tfs = {} def get_tf(p): - + tf = tfs.get(p, None) if tf is None: tf = self.get_tf(p) @@ -978,7 +978,7 @@ class TasksCLI: add_or_update = norm_seq(add_or_update) delete_projects = norm_seq(delete_projects) delete_ids = norm_seq(delete_ids) - + if delete: for t in delete: for p in t.get_projects(): @@ -1061,7 +1061,7 @@ class TasksCLI: def __cvs_commit(self, t, argv=()): pass - + ############################################################################ def ADD(self, @@ -1145,7 +1145,7 @@ OPTIONS if not t.has_projects(): project = self.get_project() if project is not None: t.add_project(project) - + if newtask: tf.add(t) tf.save() self.update_projects(add_or_update=t) @@ -1208,7 +1208,7 @@ OPTIONS if infos: infos = u" [%s]" % u", ".join(infos) else: infos = u"" enote(u"%i / %i tâche(s) trouvée(s)%s" % (numtodos, len(tasks), infos)) - + def LIST(self, listall_option=False, listpurged_option=False, showdesc_option=False, showstats_option=True, indexes=None, patterns=None, contexts=None, projects=None, props=None, @@ -1305,7 +1305,7 @@ EDIT: ----------------------------------------------------------------""" PROJECTS_PATTERN = re.compile(r'##\s*projects:\s*') PROJ_PATTERN = re.compile(r'(\S+)\s*') PROP_PATTERN = re.compile(r'##\s*(\S+)\s*=\s*(\S+)') - + def __nblines(self, s): lines = s.split("\n") nblines = len(lines) @@ -1349,15 +1349,15 @@ USAGE for name, value in t.items(): template += u"## %s=%s\n" % (name, value) template += u"\n" - + title = t.get_title() template += u"%s\n" % title setline = self.__nblines(template) setcol = len(title) - + desc = t.get_desc() if desc: template += u"\n%s" % desc - + template += self.EDIT_TEMPLATE lines = edit_template(template, 'EDIT:', setline, setcol).split('\n') @@ -1456,7 +1456,7 @@ OPTIONS if not argv: eerror("Il faut spécifier un numéro de tâche à marquer comme faite") return - + tf = self.__tf() tasks, auto_filtered = self.__get_filtered(tf, argv, indexes=indexes, @@ -1505,7 +1505,7 @@ USAGE if not argv: eerror("Il faut spécifier un numéro de tâche à supprimer") return - + tf = self.__tf() tasks, auto_filtered = self.__get_filtered(tf, argv, indexes=indexes, @@ -1523,7 +1523,7 @@ USAGE self.update_projects(delete=deleted) enote("%i tâche(s) supprimée(s)" % len(tasks)) - + ############################################################################ def PURGE(self, @@ -1554,7 +1554,7 @@ OPTIONS elif opt in ('-h', '--help'): uprint(self.PURGE.__doc__ % locals()) sys.exit(0) - + projects = [] if not argv: project = self.get_project() @@ -1562,7 +1562,7 @@ OPTIONS projects.append(project) else: projects.extend(argv) - + tf = self.__tf() pf = self.__pf() now = datef() diff --git a/lib/pyulib/migrate/tasks2/TiddlyWiki.py b/lib/pyulib/migrate/tasks2/TiddlyWiki.py index ac94a10..11ff3a9 100755 --- a/lib/pyulib/migrate/tasks2/TiddlyWiki.py +++ b/lib/pyulib/migrate/tasks2/TiddlyWiki.py @@ -302,7 +302,7 @@ class TiddlyWiki: END_SAVE_AREA = '' START_DIV = '
\n') return s - + def get_htbody(self, truncate=None): body = self._t.get_body() or u'' if truncate is not None and len(body) > truncate: body = u'%s...' % body[:truncate] return self._htmlize(body) htbody = property(get_htbody) - + TASK_TYPES = {TASK_TYPE: u'task-type', PLAN_TYPE: u'task-type', EVENT_TYPE: u'event-type', @@ -84,15 +84,15 @@ class Server(Application): def __init__(self, basedir=None, templatedir=None, host=None, port=None, debug=None, tsrc=None, ctl=None): self.template_globals = TEMPLATE_GLOBALS - + Application.__init__(self, basedir, templatedir, host, port, debug) - + if ctl is None: ctl = TasksCtl(tsrc) self._ctl = ctl self.OPTIONS = ctl.OPTIONS + self.FILTER_OPTIONS self.LONG_OPTIONS = ctl.LONG_OPTIONS + self.FILTER_LONG_OPTIONS self._ioptions = [] - + self.reset_hts() self.reset_ts() @@ -102,7 +102,7 @@ class Server(Application): FILTER_LONG_OPTIONS = ['show-all', 'show-showable', 'show-doable', 'show-body', 'no-stats'] _ioptions = None # options initiales _ifilter = None # filtre initial sous forme de chaine - + def is_option(self, option, value): if option in ('-a', '--show-all'): pass elif option in ('-q', '--show-showable'): pass @@ -116,12 +116,12 @@ class Server(Application): else: self._ioptions.append('%s%s' % (option, value)) return True - + RE_PIPE = re.compile(ur'\s*\|\s*') def process_args(self, args): ioptions = self._ioptions if ioptions and args[0:1] and args[0].startswith('-'): - ioptions.append('--') + ioptions.append('--') ioptions.extend(args) self._cfilters = cfs = filter(None, self.RE_PIPE.split(join_args(ioptions))) self._ifilter = cfs and cfs[0] or u'' @@ -134,7 +134,7 @@ class Server(Application): def list_tasks(self, cfilter=None, ifilter=None): if ifilter is None: ifilter = self._ifilter if cfilter is None: cfilter = ifilter - + fargs = split_args(cfilter) options, fargs = self.ctl.get_args(fargs, self.FILTER_OPTIONS, self.FILTER_LONG_OPTIONS) showwhat = None @@ -164,11 +164,11 @@ class Server(Application): ts = [t for t in ts if t.is_doable()] ts.sort(Task.cmp, reverse=True) nb_showable = len(ts) - + tasks = [t for t in ts if t.is_task_type()] nb_tasks = len(tasks) nb_done = len([t for t in tasks if t.is_done()]) - + stats = web.storage(showwhat=showwhat, showbody=showbody, showstats=showstats, nb_showable=nb_showable, nb_total=nb_total, @@ -177,13 +177,13 @@ class Server(Application): def ht(self, t): return self.render.task(t) - + # cache du rendu des tâches _hts, hts = make_prop('_hts', setter=False)[:2] - + def reset_hts(self): self._hts = {} - + def update_hts(self, *ts, **kw): force = kw.get('force', False) hts = self._hts @@ -191,7 +191,7 @@ class Server(Application): tid = t.id if force or not hts.has_key(tid): hts[tid] = self.ht(t) - + def remove_from_hts(self, *ts): if self._hts is None: return hts = self._hts @@ -199,28 +199,28 @@ class Server(Application): tid = t.id if hts.has_key(tid): del hts[tid] - + # requêtes précédentes _cfilters, cfilters = make_prop('_cfilters')[:2] - + def new_cfilter(self, cfilter): if cfilter is not None and cfilter not in self._cfilters: self._cfilters.append(cfilter) - + # cache du résultat de la recherche _cfilter, cfilter = make_prop('_cfilter')[:2] _stats, stats = make_prop('_stats')[:2] _ts, ts = make_prop('_ts')[:2] - + def reset_ts(self, reset_cfilter=False): if reset_cfilter: self._cfilter = None self._stats = None self._ts = None - + def refresh(self): self.reset_hts() self.reset_ts() - + def set_query(self, cfilter=None, ifilter=None): # vérifier s'il faut utiliser le cache de requête if cfilter is None: cfilter = self._cfilter @@ -229,16 +229,16 @@ class Server(Application): self.reset_ts() self.new_cfilter(cfilter) return cfilter - + def set_default_query(self): self.reset_ts(True) - + def reload_maybe(self): stores = self.ctl.get_stores() if stores.should_reload(): stores.load() self.refresh() - + def get_hts(self, cfilter=None, ifilter=None): cfilter = self.set_query(cfilter, ifilter) if self._ts is None: @@ -257,10 +257,10 @@ class Server(Application): def dt(self, t, all_values=True): """Transformer une tâche en un dictionnaire dont les clés sont les attributs de la tâche. - + Si all_values==True, inclure les attributs pour lesquels il n'y a pas de valeur définie, avec la valeur None. - + Les attributs du dictionnaire sont: tid, type, cdate, ddate, dates, mindate, maxdate, date, title, body, contexts, projects, sid, id, title1, task_type, event_type, idea_type, due_date, delay, urgent, @@ -278,7 +278,7 @@ class Server(Application): if all_values or value is not None: td[name] = value return td - + def jsencode_tasks(self, cfilter, stats, ts): dts = [self.dt(t) for t in ts] return self.dumps(cfilter), self.dumps(dts), self.dumps(stats) @@ -326,11 +326,11 @@ class Server(Application): stores.save() self.update_hts(force=True, *ts) return ts - + START = 'start' STOP = 'stop' TOGGLE = 'toggle' - + def start_stop_or_toggle(self, action, tids=None, query=None): stores = self.ctl.get_stores() ts = self.get_tasks(tids, query) @@ -349,7 +349,7 @@ class Server(Application): stores.save() self.update_hts(force=True, *ts) return ts - + def plan(self, args=None, tids=None): date = Date() options, args = get_args(args or [], 'd:', ['date=']) @@ -385,10 +385,10 @@ class Server(Application): stores.save() self.reset_ts() return ts - + class page(Page): __abstract_page__ = True - + reload_timeout = 5 ctl = make_delegate('app.ctl') @@ -396,9 +396,9 @@ class page(Page): stats = make_delegate('app.stats') ts = make_delegate('app.ts') hts = make_delegate('app.hts') - + cfilters = make_delegate('app.cfilters') - + @defaults(query=None) def index(self): try: @@ -414,24 +414,24 @@ class page(Page): traceback.print_exc() self.add_last_error_msg() return self.r('index', self) - + class action(page): PATH = r'/action' reload_timeout = None # pas de rechargement automatique - + MSG_FADE = (None, u'msg_fade') # classes css pour le message @defaults(query=None) def doSearch(self): self.app.set_query(self.query) return self.redirect('/') - + def doAdd(self, args): t = self.app.add(args) self.add_msg(u"La tâche #%s a été créée avec succès" % t.id, self.MSG_FADE, level=1) return self.redirect('/') - + @defaults(tids=[], query=None) def doEditForm(self): t = self.app.get_tasks(self.tids, self.query, unique=True)[0] @@ -452,12 +452,12 @@ class action(page): def doDoOrNodo(self, action): self.app.do_or_nodo(action, self.tids, self.query) return self.redirect('/') - + @defaults(tids=[], query=None) def doStartStopOrToggle(self, action): self.app.start_stop_or_toggle(action, self.tids, self.query) return self.redirect('/') - + @defaults(tids=[], query=None) def doPlan(self, args=None): if args is None: args = split_args(self.query) @@ -475,16 +475,16 @@ class action(page): def doRefresh(self): self.app.refresh() return self.redirect('/') - + def doSetDefaultQuery(self): self.app.set_default_query() return self.redirect('/') - + @defaults(store=None) def doSetWStore(self): self.app.ctl.get_stores().set_wstore(self.store) return self.redirect('/') - + SEARCH = 'search' ADD = 'add' EDIT_FORM = 'edit' @@ -499,7 +499,7 @@ class action(page): REFRESH = 'refresh' DEFAULTS = 'defaults' SET_WSTORE = '__sws__' - + ACTIONS = {'S': SEARCH, 'L': SEARCH, 'l': SEARCH, 'ls': SEARCH, 'list': SEARCH, 'A': ADD, 'a': ADD, 'N': ADD, 'n': ADD, 'new': ADD, 'E': EDIT_FORM, 'e': EDIT_FORM, 'ed': EDIT_FORM, @@ -513,7 +513,7 @@ class action(page): 'R': REFRESH, 'D': DEFAULTS, 'default': DEFAULTS, } - + @nocache @defaults(name=None, query=None, tids=[], searchbtn=None, dobtn=None, nodobtn=None) def action(self): @@ -563,7 +563,7 @@ class index(page): self.app.reload_maybe() self.clear_msgs(0) return page.index(self) - + @nocache @defaults(tid=None) def edit(self): diff --git a/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/buttons/screen.css b/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/buttons/screen.css index bb66b21..c1bf8d3 100644 --- a/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/buttons/screen.css +++ b/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/buttons/screen.css @@ -1,8 +1,8 @@ -/* -------------------------------------------------------------- - +/* -------------------------------------------------------------- + buttons.css * Gives you some great CSS-only buttons. - + Created by Kevin Hale [particletree.com] * particletree.com/features/rediscovering-the-button-element @@ -15,7 +15,7 @@ a.button, button { float:left; margin: 0.7em 0.5em 0.7em 0; padding:5px 10px 5px 7px; /* Links */ - + border:1px solid #dedede; border-top:1px solid #eee; border-left:1px solid #eee; diff --git a/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/fancy-type/readme.txt b/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/fancy-type/readme.txt index 85f2491..b921269 100644 --- a/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/fancy-type/readme.txt +++ b/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/fancy-type/readme.txt @@ -1,7 +1,7 @@ Fancy Type -* Gives you classes to use if you'd like some - extra fancy typography. +* Gives you classes to use if you'd like some + extra fancy typography. Credits and instructions are specified above each class in the fancy-type.css file in this directory. diff --git a/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/link-icons/screen.css b/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/link-icons/screen.css index 6d3d47f..dbed2a5 100644 --- a/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/link-icons/screen.css +++ b/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/link-icons/screen.css @@ -1,22 +1,22 @@ -/* -------------------------------------------------------------- - +/* -------------------------------------------------------------- + link-icons.css * Icons for links based on protocol or file type. - + See the Readme file in this folder for additional instructions. -------------------------------------------------------------- */ /* Use this class if a link gets an icon when it shouldn't. */ -body a.noicon { - background:transparent none !important; - padding:0 !important; - margin:0 !important; +body a.noicon { + background:transparent none !important; + padding:0 !important; + margin:0 !important; } /* Make sure the icons are not cut */ -a[href^="http:"], a[href^="mailto:"], a[href^="http:"]:visited, -a[href$=".pdf"], a[href$=".doc"], a[href$=".xls"], a[href$=".rss"], +a[href^="http:"], a[href^="mailto:"], a[href^="http:"]:visited, +a[href$=".pdf"], a[href$=".doc"], a[href$=".xls"], a[href$=".rss"], a[href$=".rdf"], a[href^="aim:"] { padding:2px 22px 2px 0; margin:-2px 0; @@ -25,16 +25,16 @@ a[href$=".rdf"], a[href^="aim:"] { } /* External links */ -a[href^="http:"] { background-image: url(icons/external.png); } +a[href^="http:"] { background-image: url(icons/external.png); } a[href^="mailto:"] { background-image: url(icons/email.png); } a[href^="http:"]:visited { background-image: url(icons/visited.png); } /* Files */ -a[href$=".pdf"] { background-image: url(icons/pdf.png); } -a[href$=".doc"] { background-image: url(icons/doc.png); } -a[href$=".xls"] { background-image: url(icons/xls.png); } - +a[href$=".pdf"] { background-image: url(icons/pdf.png); } +a[href$=".doc"] { background-image: url(icons/doc.png); } +a[href$=".xls"] { background-image: url(icons/xls.png); } + /* Misc */ -a[href$=".rss"], +a[href$=".rss"], a[href$=".rdf"] { background-image: url(icons/feed.png); } a[href^="aim:"] { background-image: url(icons/im.png); } \ No newline at end of file diff --git a/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/rtl/screen.css b/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/rtl/screen.css index 7e7ccdb..db218dd 100644 --- a/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/rtl/screen.css +++ b/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/rtl/screen.css @@ -2,9 +2,9 @@ rtl.css * Mirrors Blueprint for left-to-right languages - + By Ran Yaniv Hartstein [ranh.co.il] - + -------------------------------------------------------------- */ body .container { direction: rtl; } @@ -12,13 +12,13 @@ body .column, body div.span-1, body div.span-2, body div.span-3, body div.span-4 float: right; margin-right: 0; margin-left: 10px; - text-align:right; + text-align:right; } body div.last { margin-left: 0; } body table .last { padding-left: 0; } -body .append-1 { padding-right: 0; padding-left: 40px; } +body .append-1 { padding-right: 0; padding-left: 40px; } body .append-2 { padding-right: 0; padding-left: 80px; } body .append-3 { padding-right: 0; padding-left: 120px; } body .append-4 { padding-right: 0; padding-left: 160px; } @@ -42,7 +42,7 @@ body .append-21 { padding-right: 0; padding-left: 840px; } body .append-22 { padding-right: 0; padding-left: 880px; } body .append-23 { padding-right: 0; padding-left: 920px; } -body .prepend-1 { padding-left: 0; padding-right: 40px; } +body .prepend-1 { padding-left: 0; padding-right: 40px; } body .prepend-2 { padding-left: 0; padding-right: 80px; } body .prepend-3 { padding-left: 0; padding-right: 120px; } body .prepend-4 { padding-left: 0; padding-right: 160px; } diff --git a/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/tabs/README.textile b/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/tabs/README.textile index 604837b..2012f00 100644 --- a/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/tabs/README.textile +++ b/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/tabs/README.textile @@ -1,13 +1,13 @@ h1. Blueprint CSS Tabs Plugin Readme -This plugin adds a simple and flexible set of horizontal tabs to Blueprint. +This plugin adds a simple and flexible set of horizontal tabs to Blueprint. -h2. Usage: +h2. Usage: # Upload the screen.css file to a new directory on your server (preferably tabsplugin/) -# Include the plugin file in the @@ of your webpage. +# Include the plugin file in the @@ of your webpage. -# Add the class @"tabs"@ to your list. An example: +# Add the class @"tabs"@ to your list. An example:
 
  • Tab 1
  • @@ -16,9 +16,9 @@ h2. Usage:
-h2. More options: +h2. More options: -You can add a label to your list by adding the class @"label"@ to the first item. This item should not have a link in it. +You can add a label to your list by adding the class @"label"@ to the first item. This item should not have a link in it.
 
  • This is a "label":
  • @@ -28,7 +28,7 @@ You can add a label to your list by adding the class @"label"@ to the first item
-You can mark the currently selected item with the class @"selected"@. +You can mark the currently selected item with the class @"selected"@.
 
  • Tab 1
  • @@ -37,6 +37,6 @@ You can mark the currently selected item with the class @"selected"@.
-h2. Demo: +h2. Demo: View a demo at "blueprintcss.org":http://blueprintcss.org/demos/tabs.html \ No newline at end of file diff --git a/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/tabs/screen.css b/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/tabs/screen.css index c95a0a0..8e50256 100644 --- a/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/tabs/screen.css +++ b/lib/pyulib/src/uapps/tasks/httpd/static/blueprint/plugins/tabs/screen.css @@ -10,7 +10,7 @@ ----------------------------------------------------------------------- */ -.tabs { +.tabs { border-bottom:1px solid #ccc; height:1%; /* fixing IE 6 */ margin:0 0 .75em 0; @@ -21,12 +21,12 @@ border:1px solid #ccc; border-bottom:none; float:left; - line-height:1.5; + line-height:1.5; list-style-type:none; margin:0 .25em 0 0; padding:0; } -.tabs li a { +.tabs li a { background:#ddd; border:1px solid #eee; border-bottom:none; @@ -37,27 +37,27 @@ font-weight:bold; padding:.15em .33em .25em .33em; } -.tabs li a.selected { +.tabs li a.selected { background:#666; border:1px solid #666; border-bottom:none; color:#fff; cursor:default; } -.tabs li a, .tabs li a:focus, .tabs li a:hover { +.tabs li a, .tabs li a:focus, .tabs li a:hover { text-decoration:none; } -.tabs li a:focus, .tabs li a:hover { +.tabs li a:focus, .tabs li a:hover { color:#555; outline:none; } -.tabs li a.selected:focus, .tabs li a.selected:hover { +.tabs li a.selected:focus, .tabs li a.selected:hover { color:#fafafa; } -.tabs li.label { +.tabs li.label { border:none; font-weight:bold; - line-height:1.5; - margin-right:.5em; + line-height:1.5; + margin-right:.5em; padding:.25em .33em .25em .33em; } diff --git a/lib/pyulib/src/uapps/tasks/httpd/static/index.js b/lib/pyulib/src/uapps/tasks/httpd/static/index.js index 14c3766..9d85d79 100644 --- a/lib/pyulib/src/uapps/tasks/httpd/static/index.js +++ b/lib/pyulib/src/uapps/tasks/httpd/static/index.js @@ -64,8 +64,8 @@ $(function () { // Installers les handlers des icones // ... tidetails: tooltip + afficher body - var ZOOM_IN = "zoom_in"; - var ZOOM_OUT = "zoom_out"; + var ZOOM_IN = "zoom_in"; + var ZOOM_OUT = "zoom_out"; $(".tidetails") .tooltip({ track: true, diff --git a/lib/pyulib/src/uapps/tasks/httpd/static/jquery.hoverIntent.js b/lib/pyulib/src/uapps/tasks/httpd/static/jquery.hoverIntent.js index bd11442..4e5337c 100644 --- a/lib/pyulib/src/uapps/tasks/httpd/static/jquery.hoverIntent.js +++ b/lib/pyulib/src/uapps/tasks/httpd/static/jquery.hoverIntent.js @@ -3,17 +3,17 @@ * instead of firing the onMouseOver event immediately, hoverIntent checks * to see if the user's mouse has slowed down (beneath the sensitivity * threshold) before firing the onMouseOver event. -* +* * hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+ * -* -* hoverIntent is currently available for use in all personal or commercial -* projects under both MIT and GPL licenses. This means that you can choose +* +* hoverIntent is currently available for use in all personal or commercial +* projects under both MIT and GPL licenses. This means that you can choose * the license that best suits your project, and use it accordingly. -* +* * // basic usage (just like .hover) receives onMouseOver and onMouseOut functions * $("ul li").hoverIntent( showNav , hideNav ); -* +* * // advanced usage receives configuration object only * $("ul li").hoverIntent({ * sensitivity: 7, // number = sensitivity threshold (must be 1 or higher) @@ -22,7 +22,7 @@ * timeout: 0, // number = milliseconds delay before onMouseOut function call * out: hideNav // function = onMouseOut callback (required) * }); -* +* * @param f onMouseOver function || An object with configuration options * @param g onMouseOut function || Nothing (use configuration options object) * @author Brian Cherne diff --git a/lib/pyulib/src/uapps/tasks/httpd/static/jquery.js b/lib/pyulib/src/uapps/tasks/httpd/static/jquery.js index 9263574..42c0471 100644 --- a/lib/pyulib/src/uapps/tasks/httpd/static/jquery.js +++ b/lib/pyulib/src/uapps/tasks/httpd/static/jquery.js @@ -11,7 +11,7 @@ */ (function(){ -var +var // Will speed up references to window, and allows munging its name. window = this, // Will speed up references to undefined, and allows munging its name. @@ -594,7 +594,7 @@ jQuery.extend = jQuery.fn.extend = function() { // Recurse if we're merging object values if ( deep && copy && typeof copy === "object" && !copy.nodeType ) - target[ name ] = jQuery.extend( deep, + target[ name ] = jQuery.extend( deep, // Never move original objects, clone them src || ( copy.length != null ? [ ] : { } ) , copy ); @@ -1986,7 +1986,7 @@ var Expr = Sizzle.selectors = { if ( node.nodeType === 1 ) { node.nodeIndex = ++count; } - } + } parent.sizcache = doneName; } @@ -2877,8 +2877,8 @@ var withinElement = function(event) { } }; -jQuery.each({ - mouseover: 'mouseenter', +jQuery.each({ + mouseover: 'mouseenter', mouseout: 'mouseleave' }, function( orig, fix ){ jQuery.event.special[ fix ] = { @@ -2888,7 +2888,7 @@ jQuery.each({ teardown: function(){ jQuery.event.remove( this, orig, withinElement ); } - }; + }; }); jQuery.fn.extend({ @@ -3103,12 +3103,12 @@ jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," + // Prevent memory leaks in IE // And prevent errors on refresh with events like mouseover in other browsers // Window isn't included so as not to unbind existing unload events -jQuery( window ).bind( 'unload', function(){ +jQuery( window ).bind( 'unload', function(){ for ( var id in jQuery.cache ) // Skip the window if ( id != 1 && jQuery.cache[ id ].handle ) jQuery.event.remove( jQuery.cache[ id ].handle.elem ); -}); +}); (function(){ jQuery.support = {}; @@ -3318,7 +3318,7 @@ jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".sp var jsc = now(); jQuery.extend({ - + get: function( url, data, callback, type ) { // shift arguments if data argument was ommited if ( jQuery.isFunction( data ) ) { @@ -4179,7 +4179,7 @@ if ( document.documentElement["getBoundingClientRect"] ) left = box.left + (self.pageXOffset || jQuery.boxModel && docElem.scrollLeft || body.scrollLeft) - clientLeft; return { top: top, left: left }; }; -else +else jQuery.fn.offset = function() { if ( !this[0] ) return { top: 0, left: 0 }; if ( this[0] === this[0].ownerDocument.body ) return jQuery.offset.bodyOffset( this[0] ); @@ -4269,7 +4269,7 @@ jQuery.fn.extend({ parentOffset = /^body|html$/i.test(offsetParent[0].tagName) ? { top: 0, left: 0 } : offsetParent.offset(); // Subtract element margins - // note: when an element has margin: auto the offsetLeft and marginLeft + // note: when an element has margin: auto the offsetLeft and marginLeft // are the same in Safari causing offset.left to incorrectly be 0 offset.top -= num( this, 'marginTop' ); offset.left -= num( this, 'marginLeft' ); diff --git a/lib/pyulib/src/uapps/tasks/httpd/static/jquery.tooltip.js b/lib/pyulib/src/uapps/tasks/httpd/static/jquery.tooltip.js index a8d0cc6..fbdfccb 100644 --- a/lib/pyulib/src/uapps/tasks/httpd/static/jquery.tooltip.js +++ b/lib/pyulib/src/uapps/tasks/httpd/static/jquery.tooltip.js @@ -7,7 +7,7 @@ * Copyright (c) 2006 - 2008 Jörn Zaefferer * * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $ - * + * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html diff --git a/lib/pyulib/src/uapps/tasks/httpstore/server.py b/lib/pyulib/src/uapps/tasks/httpstore/server.py index d848e46..c85b963 100644 --- a/lib/pyulib/src/uapps/tasks/httpstore/server.py +++ b/lib/pyulib/src/uapps/tasks/httpstore/server.py @@ -22,28 +22,28 @@ class Server(Application): def __init__(self, basedir=None, templatedir=None, host=None, port=None, debug=None, tsrc=None, ctl=None): Application.__init__(self, basedir, templatedir, host, port, debug) - + if ctl is None: ctl = TasksCtl(tsrc) self._ctl = ctl self.OPTIONS = self._ctl.OPTIONS self.LONG_OPTIONS = self._ctl.LONG_OPTIONS - + def is_option(self, option, value): return self._ctl.is_option(option, value) - + def process_args(self, args): if args: self._stores = factories.get_store(args) - + class index(Page): PREFIX = r'/' - + def index(self): return self.render(self.app.stores.get_stores()) def utf8plaintext(self, text): web.header("Content-Type", "text/plain; charset=utf-8", True) return text.encode("utf-8") - + def list(self): lines = [] for store in self.app.stores.get_stores(): @@ -65,6 +65,6 @@ class index(Page): if __name__ == '__main__': import sys from os import path - + basedir = path.abspath(path.split(__file__)[0]) Server(basedir).run(sys.argv[1:]) diff --git a/lib/pyulib/src/uapps/tasks/itfctl.py b/lib/pyulib/src/uapps/tasks/itfctl.py index b13905c..3e637f8 100644 --- a/lib/pyulib/src/uapps/tasks/itfctl.py +++ b/lib/pyulib/src/uapps/tasks/itfctl.py @@ -19,7 +19,7 @@ def get_httpd(): def get_httpstore(): import httpstore.server return httpstore.server.Server - + DEFAULT_CLASS_GETTER = lambda: TasksCLI CLASSES_GETTERS = {'httpd': get_httpd, 'httpstore': get_httpstore, diff --git a/lib/pyulib/src/uapps/tasks/taskscli.py b/lib/pyulib/src/uapps/tasks/taskscli.py index 6f9d125..7502a02 100644 --- a/lib/pyulib/src/uapps/tasks/taskscli.py +++ b/lib/pyulib/src/uapps/tasks/taskscli.py @@ -20,7 +20,7 @@ class TasksCLI(TasksCtl): return max(map(lambda t: len(t.id), tasks) or [1]) # ========================================================================= - + def __print_task(self, t, width=1, showbody=False): parts = [] @@ -105,7 +105,7 @@ class TasksCLI(TasksCtl): if infos: notes = u" [%s]" % u", ".join(infos) else: notes = u"" enote(u"%i / %s%s" % (nb_tasks - nb_done, plural(u"%i tâche%#", nb_tasks), notes)) - + SHOW_ALL = 0 SHOW_SHOWABLE = 1 SHOW_DOABLE = 2 @@ -162,7 +162,7 @@ class TasksCLI(TasksCtl): t.save() self.__print_task(t) if edit: self.edit(t) - + def add_cmd(self, *args, **kw): u""" """ @@ -177,12 +177,12 @@ class TasksCLI(TasksCtl): return self.add(args, do, edit) # ========================================================================= - + def edit(self, task=None, tasks=None): if tasks is None and task is not None: tasks = [task] if tasks is None: return - + width = self.get_width(tasks) for t in tasks: title = Lines(t.title) @@ -191,7 +191,7 @@ class TasksCLI(TasksCtl): t.input(text) t.save() self.__print_task(t, width, showbody=True) - + def edit_cmd(self, *args, **kw): u""" """ @@ -209,13 +209,13 @@ class TasksCLI(TasksCtl): if tasks is None and task is not None: tasks = [task] if tasks is None: return - + width = self.get_width(tasks) for t in tasks: t.do() t.save() self.__print_task(t, width, showbody=True) - + def do_cmd(self, *args, **kw): u""" """ @@ -231,13 +231,13 @@ class TasksCLI(TasksCtl): if tasks is None and task is not None: tasks = [task] if tasks is None: return - + width = self.get_width(tasks) for t in tasks: t.nodo() t.save() self.__print_task(t, width, showbody=True) - + def nodo_cmd(self, *args, **kw): u""" """ @@ -256,7 +256,7 @@ class TasksCLI(TasksCtl): elif len(tasks) > 1: eerror(u"Plusieurs tâches correspondent au filtre") else: eerror(u"Aucune tâche trouvée") return None - + def start(self, task, summary=None, exclusive=False, store=None): u""" """ @@ -336,13 +336,13 @@ class TasksCLI(TasksCtl): if tasks is None and task is not None: tasks = [task] if tasks is None: return - + width = self.get_width(tasks) for t in tasks: t.plan(date) t.save() self.__print_task(t, width, showbody=True) - + def plan_cmd(self, *args, **kw): u""" """ @@ -359,7 +359,7 @@ class TasksCLI(TasksCtl): self.plan(date, tasks=tasks) # ========================================================================= - + def remove(self, task=None, tasks=None): if tasks is None and task is not None: tasks = [task] @@ -370,7 +370,7 @@ class TasksCLI(TasksCtl): self.__print_task(t, width, showbody=True) store = t.get_store() if store is None: continue - + if store.remove(t): store.save() enote(u"Tâche supprimée") @@ -387,23 +387,23 @@ class TasksCLI(TasksCtl): store = self.get_stores() tasks = self.get_filtered(args, store=store) self.remove(tasks=tasks) - + # ========================================================================= - + def purge_cmd(self, *args, **kw): u""" """ store = self.get_stores() - + # ========================================================================= - + def report_cmd(self, *args, **kw): u""" """ store = self.get_stores() - + # ========================================================================= - + def run(self, args=None, cmd_name=None, **ignored): cmd = {'add': self.add_cmd, 'list': self.list_cmd, diff --git a/lib/pyulib/src/uapps/umail.py b/lib/pyulib/src/uapps/umail.py index e9bacbd..47ae1bf 100755 --- a/lib/pyulib/src/uapps/umail.py +++ b/lib/pyulib/src/uapps/umail.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""%(scriptname)s: Afficher un mail correctement encodé pour son envoi - + USAGE echo "BODY" | %(scriptname)s [options] RECIPIENTS... | /usr/sbin/sendmail -t -i diff --git a/lib/pyulib/src/uapps/uproject.py b/lib/pyulib/src/uapps/uproject.py index 75fcc6f..5e0ed0c 100755 --- a/lib/pyulib/src/uapps/uproject.py +++ b/lib/pyulib/src/uapps/uproject.py @@ -67,7 +67,7 @@ def new_cmd(*args): status = edit_file(file) return status - + def run_uproject(): args = sys.argv[1:] diff --git a/lib/pyulib/src/uapps/ur_license.txt b/lib/pyulib/src/uapps/ur_license.txt index e96178f..bf76fde 100644 --- a/lib/pyulib/src/uapps/ur_license.txt +++ b/lib/pyulib/src/uapps/ur_license.txt @@ -8,11 +8,11 @@ LICENCE d'utilisation de @@projname@@ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/lib/pyulib/src/uapps/urandomize.py b/lib/pyulib/src/uapps/urandomize.py index 8c2370b..80c8166 100755 --- a/lib/pyulib/src/uapps/urandomize.py +++ b/lib/pyulib/src/uapps/urandomize.py @@ -20,10 +20,10 @@ def run_urandomize(): if len(argv) == 2 and argv[1] in ('--help', ): progname = path.split(argv[0])[1] uprint(u"""%(progname)s -- Mélanger des lignes de façon aléatoire - + USAGE %(progname)s [-j | -J size] - + OPTIONS -j, -J size Fusionner les lignes pour en faire des lignes de taille maximum $size @@ -31,18 +31,18 @@ def run_urandomize(): -q Mettre les valeurs entre quotes """ % vars()) exit(0) - + DEFAULT_SIZE = 920 size = None quote = False - + argv = argv[1:] while argv: if argv[0][:1] == '-': opt = argv[0][:2] if opt == '-j': size = DEFAULT_SIZE - + elif opt == '-J': if not argv[0][2:]: if not argv[1:2]: @@ -53,19 +53,19 @@ def run_urandomize(): else: arg = argv[0][2:] size = atoi(arg) - + elif opt == '-q': quote = True - + elif opt == '--': break - + else: raise ValueError, "Option invalide" else: break argv = argv[1:] - + if argv: # 'lignes' données en ligne de commande input = argv @@ -77,7 +77,7 @@ def run_urandomize(): while line[ - 1:] in ('\n', '\r'): line = line[: - 1] input.append(line) - + if size: # Il faut fusionner les lignes # On en profite pour les striper @@ -86,16 +86,16 @@ def run_urandomize(): while input: item = choice(input) input.remove(item) - + if line: line = line + ' ' line = line + strip(quote_maybe(item, quote)) - + if size != - 1 and len(line) >= size: output.append(line) line = '' if line: output.append(line) - + else: # On se contente de randomiser les lignes output = [] @@ -103,7 +103,7 @@ def run_urandomize(): item = choice(input) input.remove(item) output.append(quote_maybe(item, quote)) - + for item in output: stdout.write(item + '\n') diff --git a/lib/pyulib/src/uapps/uxpath.py b/lib/pyulib/src/uapps/uxpath.py index e29354b..db0141b 100755 --- a/lib/pyulib/src/uapps/uxpath.py +++ b/lib/pyulib/src/uapps/uxpath.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""%(scriptname)s: Faire une requête xpath - + USAGE %(scriptname)s -f input expr diff --git a/lib/pyulib/src/uapps/wofixsql.py b/lib/pyulib/src/uapps/wofixsql.py index e2b78e6..4687a1c 100755 --- a/lib/pyulib/src/uapps/wofixsql.py +++ b/lib/pyulib/src/uapps/wofixsql.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""%(scriptname)s: Afficher une requête SQL d'un fichier de log WebObjects - + USAGE %(scriptname)s 'line' cat /var/log/WebObjets/App-1 | %(scriptname)s @@ -59,7 +59,7 @@ def fixsql(line, raiseerror=True): sql = sql[:pos] + var + sql[pos+1:] return sql + ';' - + def run_wofixsql(): options, longoptions = build_options([ ('h', 'help', "Afficher l'aide"), @@ -79,7 +79,7 @@ def run_wofixsql(): except EOFError: break sql = fixsql(line, False) if sql is not None: print sql - + if __name__ == '__main__': run_wofixsql() diff --git a/lib/pyulib/src/ulib/base/args.py b/lib/pyulib/src/ulib/base/args.py index 3864b50..ceae648 100644 --- a/lib/pyulib/src/ulib/base/args.py +++ b/lib/pyulib/src/ulib/base/args.py @@ -48,11 +48,11 @@ def get_qtoken(pcl): def split_args(cl): """Lire une chaine, et la découper en plusieurs arguments, à utiliser par exemple avec getopt() ou get_args(). - + Note: les arguments peuvent être entre quotes, mais pour le moment, seul " est supporté, pas '. XXX ajouter le support de ' comme quote. - + @return: la liste des arguments, ou None si cl==None @rtype: list """ @@ -79,7 +79,7 @@ def split_args(cl): def join_args(args): """L'opération inverse de split_args - + @return: une chaine, ou None si args==None """ if args is None: return None @@ -92,7 +92,7 @@ def join_args(args): def build_options(argsdesc): """Construire une liste d'options pour utilisation avec get_args ou getopt. - + A partir d'une liste de termes (option, longoptions, desc), construire et retourner (options, longoptions), où options est un chaine et longoptions une liste, pour utilisation avec getopt() ou get_args(). @@ -132,7 +132,7 @@ def get_args(args=None, options=None, longoptions=None, **optdescs): if args is None: args = sys.argv[1:] if options is None: options = '' longoptions = seqof(longoptions, []) - + options = RE_OPTION.findall(options) longoptions = list(longoptions) @@ -313,7 +313,7 @@ class Action(object): name nom de la variable associée à l'option, None s'il faut le calculer initial si une valeur est associée à l'option, valeur initiale de cette option. - + Cet objet doit implémenter une méthode __call__() qui prend les arguments (option[, value[, options]]) La méthode doit retourner False si elle veut indiquer qu'elle n'a pas pu @@ -378,7 +378,7 @@ class Options(object): if self._value is not _none: value = self._value # mettre à jour la valeur - options.update_value(option, value) + options.update_value(option, value) class CallMethod(Action): _method = None @@ -410,7 +410,7 @@ class Options(object): def __init__(self, *optdescs): """Initialiser l'objet avec un ensemble d'argument de la forme - + (options, longoptions, desc) où options est une chaine avec des lettres de la forme 'o' ou 'o:', @@ -447,15 +447,15 @@ class Options(object): def add_option(self, options=None, action=None, desc=None): """Ajouter une option - + options peut être une chaine de l'une des formes suivantes: - + '+' arrêter l'analyse à la première non-option (configuration de gnu_getopt) 'o', '-o', 'o:', '-o:' option courte sans et avec argument 'longo', '--longo', 'longo=', '--longo=' option longue sans et avec argument - + options peut aussi être une liste de ces chaines """ default_name = None @@ -508,9 +508,9 @@ class Options(object): # ne spécifier la valeur initiale que si elle n'existe pas déjà if not self.has_value(option): self.set_value(option, action.initial) - + return self - + ############################################################################ # Gestion des valeurs @@ -560,7 +560,7 @@ class Options(object): self.set_value(option, value + 1) else: self.set_value(option, value) - + ############################################################################ # Exploitation diff --git a/lib/pyulib/src/ulib/base/base.py b/lib/pyulib/src/ulib/base/base.py index 7051c37..cf9a3e0 100644 --- a/lib/pyulib/src/ulib/base/base.py +++ b/lib/pyulib/src/ulib/base/base.py @@ -67,14 +67,14 @@ class odict(dict): """ def __init__(self, dict=None, **kw): super(odict, self).__init__(**updated(dict, **kw)) - + def __getattr__(self, key): try: return self[key] except KeyError: raise AttributeError(key) - + def __setattr__(self, key, value): self[key] = value - + def __delattr__(self, key): try: del self[key] except KeyError: raise AttributeError(key) @@ -88,15 +88,15 @@ class ncdict(odict): """ def __init__(self, dict=None, **kw): super(ncdict, self).__init__(**updated(dict, **kw)) - + def __getitem__(self, key): if isstr(key): key = key.lower() return super(ncdict, self).__getitem__(key) - + def __setitem__(self, key, value): if isstr(key): key = key.lower() return super(ncdict, self).__setitem__(key, value) - + def __delitem__(self, key): if isstr(key): key = key.lower() return super(ncdict, self).__delitem__(key) @@ -104,11 +104,11 @@ class ncdict(odict): def __getattr__(self, key): if isstr(key): key = key.lower() return super(ncdict, self).__getattr__(key) - + def __setattr__(self, key, value): if isstr(key): key = key.lower() return super(ncdict, self).__setattr__(key, value) - + def __delattr__(self, key): if isstr(key): key = key.lower() return super(ncdict, self).__delattr__(key) @@ -196,7 +196,7 @@ def nlistf(name, *attrs, **kw): namespace = dict(itemprop=_itemprop) try: exec template in namespace except SyntaxError, e: raise SyntaxError('%s:\n%s' % (e.message, template)) - + cls = namespace[name] cls.ATTRS = attrs cls.VALIDATORS = validators @@ -227,7 +227,7 @@ def snlistf(base, name, *attrs, **kw): namespace = dict(base=base, itemprop=_itemprop) try: exec template in namespace except SyntaxError, e: raise SyntaxError('%s:\n%s' % (e.message, template)) - + cls = namespace[name] cls.ATTRS = allattrs cls.VALIDATORS = validators @@ -314,7 +314,7 @@ def norm_nl(s, nl="\\n"): def make_getter(name): return lambda self: getattr(self, name) def make_setter(name, validator=None): - if validator is None: + if validator is None: return lambda self, value: setattr(self, name, value) else: return lambda self, value: setattr(self, name, validator(value)) @@ -325,12 +325,12 @@ def make_deleter(name): def make_prop(name, value=None, getter=True, setter=True, deleter=False, validator=None): """Retourne un tuple facilitant la création d'une propriété protégée par des accesseurs. - + Voici un exemple d'usage: - + class C: _name, name, get_name, set_name = make_prop('_name', 'Default value') - + @return: (value, property, getter_func, setter_func, deleter_func) """ accessors = {} @@ -354,11 +354,11 @@ def make_prop(name, value=None, getter=True, setter=True, deleter=False, validat def __check_names(names): if not names: raise AttributeError("The attribute name is required") - + def getattrs(obj, names, strict=False): u"""Soit un objet obj, et un nom de la forme "attr0.attr1....", retourner l'objet obtenu avec l'expression obj.attr0.attr1.... - + @param strict: on requière que toute l'expression soit parcouru jusqu'à la fin. Sinon, arrêter dès que le résultat de l'expression est None. """ @@ -380,7 +380,7 @@ def getattrs(obj, names, strict=False): def setattrs(obj, names, value): u"""Soit un objet obj, et un nom de la forme "attr0.attr1....", effectuer l'équivalent de l'opération: - + obj.attr0.attr1.... = value """ if not isseq(names): names = names.split(".") @@ -391,7 +391,7 @@ def setattrs(obj, names, value): def delattrs(obj, names): u"""Soit un objet obj, et un nom de la forme "attr0.attr1....", effectuer l'équivalent de l'opération: - + del obj.attr0.attr1.... """ if not isseq(names): names = names.split(".") @@ -419,7 +419,7 @@ def make_delegate(names, getter=True, setter=True, deleter=False): def get__all__(module): """Retourner la valeur __all__ d'un module, ou la construire si cette valeur n'est pas définie. - + @rtype: tuple """ all = getattr(module, '__all__', None) @@ -431,7 +431,7 @@ def get__all__(module): def import__module__(module_name, globals, locals=None, name=None): """Importer dans globals le module nommé module_name, en le nommant name. - + Par défaut, name est le nom de base du module. par exemple, le module "a.b.c" sera importé sous le nom "c" """ @@ -443,11 +443,11 @@ def import__module__(module_name, globals, locals=None, name=None): if name is None: name = basenames[-1] globals[name] = module return [name] - + def import__all__(module_name, globals, locals=None, *names): """Importer dans globals tous les objets du module nommé module_name mentionnés dans names. Si names est vides, tous les objets sont importés - comme avec 'from module import *' + comme avec 'from module import *' """ module = __import__(module_name, globals, locals) basenames = module_name.split('.') diff --git a/lib/pyulib/src/ulib/base/config.py b/lib/pyulib/src/ulib/base/config.py index 94c64ee..3c63f2b 100644 --- a/lib/pyulib/src/ulib/base/config.py +++ b/lib/pyulib/src/ulib/base/config.py @@ -50,7 +50,7 @@ class ConfigFile(TextFile): doit partager éventuellement avec d'autres langages ou d'autres systèmes d'exploitation. Par exemple, il peut s'agir d'un fichier de configuration sous bash. - + Une valeur non quotée est trimée à droite et à gauche. Une valeur quotée n'est jamais trimée. @@ -70,8 +70,8 @@ class ConfigFile(TextFile): >>> from StringIO import StringIO >>> input = StringIO(r'''# comment ... name=value - ... name2= value - ... name3 = value + ... name2= value + ... name3 = value ... qname="qvalue" ... qname2=" qvalue " ... qname3 = " qvalue " @@ -264,7 +264,7 @@ class ConfigFile(TextFile): """Traiter les séquences d'échappement dans une valeur scalaire. Si la valeur était quotée, quote contient la valeur du caractère ("'", '"' ou ''). Par défaut, ne rien faire. - + Cette fonction doit être surchargée en fonction du type de fichier de configuration que l'on lit. @@ -686,12 +686,12 @@ class PListFile(TextFile): XXX à faire """ raise NotImplementedError - + def __read_plist(self): """charger un fichier au format plist natif """ self.data = self.get_nl().join(self.grep(r'[ \t]*//', inverse=True)) - + value = self.__parse_value() if type(value) is types.DictType: self.items = value @@ -734,7 +734,7 @@ class PListFile(TextFile): _print_debug("XXX name=%s" % name) return name - + re_value = re.compile(r'[a-zA-Z0-9_/.$]+') def __parse_value(self, optional=False): _print_debug("XXX parse_value, data=\n %s" % self.data[:70]) @@ -768,7 +768,7 @@ class PListFile(TextFile): self.__parse_chars('=', skip_blank=True) value = self.__parse_value() self.__parse_chars(';', skip_blank=True) - + dict[name] = value self.__parse_chars('}', skip_blank=True) diff --git a/lib/pyulib/src/ulib/base/control.py b/lib/pyulib/src/ulib/base/control.py index 0008566..cffc8f2 100644 --- a/lib/pyulib/src/ulib/base/control.py +++ b/lib/pyulib/src/ulib/base/control.py @@ -15,12 +15,12 @@ from output import eerror class Status: """Un objet qui peut être utilisé pour retourner un status pour l'exécution d'un programme ou d'une opération. - + Le status peut être OK ou ERROR. La valeur booléenne de cet objet est True ou False en fonction de la valeur du status. Un code de retour de programme associé est disponible avec la propriété exitcode. """ - + ok = True exitcode = 0 def __init__(self, ok=None, exitcode=None): @@ -36,13 +36,13 @@ class Status: def __nonzero__(self): return self.ok - + OK_STATUS = Status(True) ERROR_STATUS = Status(False) def ensure_status(status): """Retourner une instance de Status. - + Si status est un entier, le prendre comme valeur de retour. Sinon, le considérer comme une valeur booléenne indiquant le status: OK ou ERREUR. """ @@ -56,7 +56,7 @@ class Exit(Exception): """ def __init__(self, status): self.exitcode = ensure_status(status).exitcode - + def exit(status=OK_STATUS): """Quitter le programme avec l'exception Exit, en propageant par défaut le status OK_STATUS. @@ -66,7 +66,7 @@ def exit(status=OK_STATUS): def die(msg=None, status=ERROR_STATUS): """Quitter le programme en affichant un message d'erreur, en propageant par défaut le status ERROR_STATUS. - + Si msg==None, on prend le message de la dernière exception capturée. """ eerror(msg) @@ -78,7 +78,7 @@ def enable_exit_control(): """ prev_excepthook = sys.excepthook if prev_excepthook is sys.__excepthook__: - prev_excepthook = None + prev_excepthook = None def exit(cls, obj, tb, prev_excepthook=prev_excepthook): if issubclass(cls, Exit): sys.exit(obj.exitcode) elif prev_excepthook is not None: diff --git a/lib/pyulib/src/ulib/base/dates.py b/lib/pyulib/src/ulib/base/dates.py index f34f0a6..041c172 100644 --- a/lib/pyulib/src/ulib/base/dates.py +++ b/lib/pyulib/src/ulib/base/dates.py @@ -111,7 +111,7 @@ MONTHNAMES1 = [u"J", u"F", u"M", u"A", u"M", u"J", class Date(object): """Un wrapper pour 'datetime.date'. - + Attention! Cet objet est mutable, il ne faut donc pas l'utiliser comme clé dans un dictionnaire. """ @@ -145,7 +145,7 @@ class Date(object): # nombre de jours du mois monthdays = property(lambda self: MONTHDAYS[self.month]) - + def weekday(self): """Retourner le jour de la semaine, de 0 (lundi) à 6 (dimanche) """ @@ -170,7 +170,7 @@ class Date(object): if day != 1 and not show_month and not show_year: return _u(day) elif month != 1 and not show_year: return u"%i/%i" % (day, month) else: return u"%i/%i/%i" % (day, month, year) - + def monthname(self, format=None): """Obtenir le nom du mois. Si format est dans (1, 't', 'tiny'), retourner le nom sur 1 lettre. @@ -181,7 +181,7 @@ class Date(object): elif format in (3, 's', 'small'): names = MONTHNAMES3 else: names = MONTHNAMES return names[self.month - 1] - + __monthname1 = lambda self: self.monthname(1) __monthname3 = lambda self: self.monthname(3) FORMAT_MAP = {'%Y': '%(y)04i', '%m': '%(m)02i', '%d': '%(d)02i', @@ -203,14 +203,14 @@ class Date(object): if callable(to): to = to(self) format = format.replace(fr, to) return format % locals() - + def set(self, day=None, month=None, year=None): kw = {} for name, value in [('day', day), ('month', month), ('year', year)]: if value is not None: kw[name] = value self._d = self._d.replace(**kw) return self - + def set_weekday(self, weekday=0): if self.weekday() != weekday: day = self.day + weekday - self.weekday() @@ -229,7 +229,7 @@ class Date(object): return '%02i/%02i/%04i' % (self.day, self.month, self.year) def __unicode__(self): return u'%02i/%02i/%04i' % (self.day, self.month, self.year) - + def __eq__(self, other): return self._d == self._date(other, False) def __ne__(self, other): return self._d != self._date(other, False) def __lt__(self, other): @@ -248,7 +248,7 @@ class Date(object): if other is None: return 1 else: return cmp(self._d, self._date(other)) def __hash__(self): return hash(self._d) - + def _date(self, d, required=True): """Retourner l'instance de datetime.date correspondant à l'objet d. """ @@ -256,7 +256,7 @@ class Date(object): elif isinstance(d, Date): return d._d elif required: raise ValueError("Expected datetime.date or Date instance, got %s" % repr(d)) else: return None - + def _delta(self, td): """Retourner l'instance de datetime.timedelta correspondant à l'objet td """ @@ -275,7 +275,7 @@ class Date(object): elif t is not None: return cls(t=t) else: return cls() _new = classmethod(_new) - + def copy(self): """Retourner une nouvelle instance, copie de cet objet """ @@ -292,7 +292,7 @@ class Date(object): def __add__(self, other): return self._new(self._d + self._delta(other)) __radd__ = __add__ def add(self, days=1): return self + days - + def __sub__(self, other): return self._new(self._d - self._delta(other)) __rsub__ = __sub__ def sub(self, days=1): return self - days @@ -314,24 +314,24 @@ class Date(object): else: date.set_weekday(0) return date - + def get_monthweeks(self, complete=True, only_debut=None): """Retourner une liste de dates (debut, fin) correspondant aux débuts et aux fins des semaine du mois de cet objet. - + Si only_debut==True, ne retourner que la liste de valeurs debut au lieu des tuples (debut, fin). Par défaut only_debut==complete - + Si complete==True, on ne retourne que des semaines complètes: les dates au début et à la fin du mois sont corrigées pour inclure les jours du mois précédent et du mois suivant s'il y a au moins 4 jours dans le mois courant. - + Sinon, les semaines du début et de la fin du mois peuvent être tronquées et ne contiennent que les jours du mois. """ if only_debut is None: only_debut = complete - + first = self.copy().set(1) monthdays = first.monthdays last = first + monthdays @@ -355,7 +355,7 @@ class Date(object): else: weeks.append((debut, fin)) debut = fin + 1 return weeks - + def isdate(d): """Tester si d est une instance de Date """ @@ -405,7 +405,7 @@ def _tzname(): tz = abs(tz) / 60 h = tz / 60 m = tz % 60 - return "%s%02i%02i" % (s, h, m) + return "%s%02i%02i" % (s, h, m) def rfc2822(time=None, gmt=True): """Retourner la date au format rfc 2822. @@ -420,34 +420,34 @@ def rfc2822(time=None, gmt=True): time = localtime(time) tzname = _tzname() return "%s %s" % (asctime(time), tzname) - + class _DateSpecConstants: """Constantes utilisées par les classes DateSpec et ses filles """ - + # Contrainte C = r'(?:!(w|n)(\d+))' C_COUNT = 2 # nombre de groupes pour l'expression régulière C C_OP = 0 # numéro relatif du groupe pour la valeur OP C_WD = 1 # numéro relatif du groupe pour la valeur WEEKDAY - + # Spécification I = r'(\d+)' I_COUNT = 1 # nombre de groupes pour l'expression régulière I I_VALUE = 0 # numéro relatif du groupe pour la valeur VALUE - + R = r'(?:(\d+)(?:\s*-\s*(\d+))?)' # Range R_COUNT = 2 # nombre de groupes pour l'expression régulière R R_FROM = 0 # numéro relatif du groupe pour la valeur FROM R_TO = 1 # numéro relatif du groupe pour la valeur TO - + AOR = r'(?:(\*)|%s)' % R # AnyOrRange AOR_COUNT = 1 + R_COUNT # nombre de groupes pour l'expression régulière AOR AOR_R_POS = 1 # position du premier groupe de l'expression R dans AOR AOR_ANY = 0 AOR_FROM = AOR_R_POS + R_FROM # numéro relatif du groupe pour la valeur FROM AOR_TO = AOR_R_POS + R_TO # numéro relatif du groupe pour la valeur TO - + S = r'(?:\+%s|w%s|%s)(?:\s*/\s*%s(?:\s*/\s*%s)?)?' % (I, R, AOR, AOR, AOR) S_COUNT = I_COUNT + R_COUNT + 3 * AOR_COUNT # nombre de groupes pour l'expression régulière S S_I_POS = 0 # position du premier groupe de l'expression I dans S @@ -467,7 +467,7 @@ class _DateSpecConstants: S_Y_ANY = S_YAOR_POS + AOR_ANY # numéro relatif du groupe pour la valeur ANY de Y S_Y_FROM = S_YAOR_POS + AOR_FROM # numéro relatif du groupe pour la valeur FROM de Y S_Y_TO = S_YAOR_POS + AOR_TO # numéro relatif du groupe pour la valeur TO de Y - + RE_SPEC = re.compile(r'(?:(?:%s)|(?:%s))$' % (C, S)) # offsets des positions des groupes dans l'expression RE_SPEC SPEC_C_POS = 0 @@ -531,11 +531,11 @@ class _DateSpecConstants: else: max = str(max) raise ValueError("%s value must be in the [%s, %s] range, got %i" % (name, min, max, v)) _check_value = classmethod(_check_value) - + class DateSpec(_DateSpecConstants): """Une spécification de dates de la forme D[/M[/Y]], ou une spécification de contrainte de date de la forme !W. - + - D peut prendre l'une des formes suivantes: - soit des jours du moins sous la forme *, DAY ou FROM-TO. - soit des jours de la semaine sous la forme "w"WEEKDAY ou "w"FROM-TO @@ -546,9 +546,9 @@ class DateSpec(_DateSpecConstants): - Y représente des années sous la forme *, YEAR ou FROM-TO. - W représente des jours de la semaine sous la forme "w"WEEKDAY ou "n"WEEKDAY avec 1=Lundi, ..., 7=Dimanche - + Exemples: - + w1-5 Les jours de la semaine 15/1-6 @@ -560,18 +560,18 @@ class DateSpec(_DateSpecConstants): !n4 Spécifier que le jour DOIT être le Jeudi *suivant* la date de référence """ - + class Strategy(_DateSpecConstants): def matches(self, date): u"""Tester si la date correspond à cette spécification de date """ raise NotImplementedError - + def fix(self, date, now=None, refdate=None): u"""Corriger date, refdate étant la date de référence """ raise NotImplementedError - + def is_obsolete(self, now=None): u"""Tester si cette spécification de date est obsolète, c'est à dire si elle désigne une date passée. @@ -580,17 +580,17 @@ class DateSpec(_DateSpecConstants): class ConstraintStrategy(Strategy): """Une contrainte de date: - + "!wWEEKDAY" signifie que le jour DOIT être celui spécifié, en restant dans la semaine en cours. - + "!nWEEKDAY" signifie que le jour DOIT être celui spécifié, mais en prenant toujours une date future. Il est alors possible de passer sur la semaine suivante pour arriver au bon jour. """ _op = None # op: w ou n _ws = None # weekdays - + def __init__(self, mo): self._op = mo.group(self.CONS_OP) ws = mo.group(self.CONS_WD) @@ -604,10 +604,10 @@ class DateSpec(_DateSpecConstants): s += self._op s += self._tostr(self._ws) return s - + def matches(self, date): return True - + def fix(self, date, now=None, refdate=None): date = ensure_date(date) expected_wd = self._ws[0] @@ -617,10 +617,10 @@ class DateSpec(_DateSpecConstants): if self._op == 'n' and actual_wd > expected_wd: date += 7 return date - + def is_obsolete(self, now=None): return False - + class DateStrategy(Strategy): """Une spécification de date """ @@ -640,7 +640,7 @@ class DateSpec(_DateSpecConstants): # weekdays wf, wt = mo.group(self.SPEC_WD_FROM), mo.group(self.SPEC_WD_TO) if wf is None and wt is None: pass - elif wt is not None: self._ws = self._range(wf, wt) + elif wt is not None: self._ws = self._range(wf, wt) else: self._ws = self._range(wf) if self._ws is not None: self._check_range("WEEKDAYS", self._ws, 0, 7) @@ -679,7 +679,7 @@ class DateSpec(_DateSpecConstants): s += "/" s += self._tostr(self._ys) return s - + def fill_ranges(self, yrs = None, mrs = None, drs = None, wrs = None): if yrs is None: yrs = [] yrs.append(self._ys) @@ -692,7 +692,7 @@ class DateSpec(_DateSpecConstants): if drs is None: drs = [] drs.append(self._ds) return yrs, mrs, drs, wrs - + def matches(self, date): date = ensure_date(date) # tester l'année @@ -741,7 +741,7 @@ class DateSpec(_DateSpecConstants): """Retourner True s'il s'agit d'une spécification de date """ return isinstance(self._strategy, self.DateStrategy) - + def __init__(self, spec): mo = self.RE_SPEC.match(spec) if mo is None: @@ -750,40 +750,40 @@ class DateSpec(_DateSpecConstants): if mo.group(self.CONS_WD) is None: strategy = self.DateStrategy(mo) else: strategy = self.ConstraintStrategy(mo) self._strategy = strategy - + def __str__(self): return self._strategy.__str__() - + def __repr__(self): return "%s(\"%s\")" % (self.__class__.__name__, self) - + def matches(self, date): return self._strategy.matches(date) - + def fix(self, date, now=None, refdate=None): return self._strategy.fix(date, now, refdate) - + def matches_fix(self, date, now=None, refdate=None): if self.matches(date): return True, self.fix(date, now, refdate) else: return False, date - + def is_obsolete(self): return self._strategy.is_obsolete() class DateSpecs: """Une suite de spécifications de date, séparées par des virgules. - + Attention! l'ordre est important, car les calculs et l'évaluation des contraintes se fait dans l'ordre des spécifications. """ RE_COMMA = re.compile(r'\s*,\s*') - + _specs = None def __constraint_specs(self): return [spec for spec in self._specs if spec.is_constraint_spec()] def __date_specs(self): return [spec for spec in self._specs if spec.is_date_spec()] - + def __init__(self, specs): specs = _s(specs).strip() self._specs = [DateSpec(spec) for spec in self.RE_COMMA.split(specs)] @@ -798,7 +798,7 @@ class DateSpecs: for spec in self._specs: if spec.matches(date): return True return False - + def matches_fix(self, date, now=None, refdate=None): if now is None: now = Date() if refdate is None: refdate = now @@ -808,16 +808,16 @@ class DateSpecs: date = spec.fix(date, now, refdate) return True, date return False, date - + _now = None _refdate = None _candidates = None - + def _reset_candidates(self): self._now = None self._refdate = None self._candidates = None - + def _get_candidates(self, now=None, refdate=None): if now is None: now = Date() if refdate is None: refdate = now @@ -884,7 +884,7 @@ class DateSpecs: self._refdate = refdate self._candidates = candidates return candidates - + def get_next_date(self, now=None, refdate=None): if now is None: now = Date() if refdate is None: refdate = now diff --git a/lib/pyulib/src/ulib/base/editor.py b/lib/pyulib/src/ulib/base/editor.py index f87abc4..f22f309 100644 --- a/lib/pyulib/src/ulib/base/editor.py +++ b/lib/pyulib/src/ulib/base/editor.py @@ -34,14 +34,14 @@ def get_default_editors(): def get_editor_caps(): """Obtenir les caractéristiques de l'éditeur configuré. - + @return: (editor, options, setrow, setcol, colplus) """ options = None setrow = None setcol = '' colplus = 0 - + editor = get_editor() if editor is None: for editor in get_default_editors(): @@ -62,7 +62,7 @@ def get_editor_caps(): def edit_file(file, row=None, col=None): """Lancer un éditeur pour éditer le fichier file. - + @return: le status d'exécution de l'éditeur. """ editor, options, setrow, setcol, colplus = get_editor_caps() @@ -83,10 +83,10 @@ def edit_file(file, row=None, col=None): def edit_template(template=None, strip_prefix=None, row=None, col=None, lines=None): """Obtenir une valeur éditée dans un éditeur. - + Un fichier temporaire vide est initialisé avec le contenu de template, puis le fichier est proposé à l'édition. - + A la sortie, toutes les lignes commençant par strip_prefix sont supprimée, et une instance de Lines avec les lignes du fichier est retourné. @@ -111,17 +111,17 @@ def edit_template(template=None, strip_prefix=None, row=None, col=None, lines=No finally: tmpf.close() else: tmpf.close() - + ## l'éditer edit_file(tmpfile, row, col) - + ## traiter le résultat lines.readlines(tmpfile) # enlever les préfixes if strip_prefix is not None: lines.filter(lambda l: not l.startswith(strip_prefix)) - + # supprimer les lignes vides au début et à la fin while lines and not lines[0].strip(): del lines[0] while lines and not lines[-1].strip(): del lines[-1] diff --git a/lib/pyulib/src/ulib/base/encdetect.py b/lib/pyulib/src/ulib/base/encdetect.py index af55f5a..d85c7d1 100644 --- a/lib/pyulib/src/ulib/base/encdetect.py +++ b/lib/pyulib/src/ulib/base/encdetect.py @@ -76,7 +76,7 @@ def detect_line_encoding(lines, examine_lines=10): nb_lines = len(lines) if nb_lines < 2 * examine_lines: examine_lines = nb_lines - + for line in lines[:examine_lines]: mo = RE_ENCODING.search(line) if mo is not None: return mo.group(1) @@ -107,10 +107,10 @@ class FileType(object): _check_ext, check_ext = make_prop('_check_ext', True)[:2] _check_content, check_content = make_prop('_check_content', True)[:2] _file, file = make_prop('_file')[:2] - + def __init__(self, file): self._file = file - + def is_binary(self): binary = self._binary if binary is None and self.check_ext: @@ -130,24 +130,24 @@ class FileType(object): else: return ext.lower() in ( # exécutables et fichiers objets '.bin', '.com', '.co_', '.exe', '.ex_', '.dll', - '.pyc', '.pyd', '.pyo', '.class', - '.o', '.so', '.so.*', '.lib', '.ovl', + '.pyc', '.pyd', '.pyo', '.class', + '.o', '.so', '.so.*', '.lib', '.ovl', # archives - '.gz', '.bz2', '.tar', '.tgz', '.tbz2', + '.gz', '.bz2', '.tar', '.tgz', '.tbz2', '.hqx', '.sit', '.zip', '.jar', '.rpm', '.srpm', '.deb', # multimédia '.bmp', '.gif', '.png', '.jpeg', '.jpg', '.tif', '.tiff', - '.xbm', '.icns', '.ico', '.avi', '.mov', '.mpg', '.swf', - '.mp3', '.snd', '.ogg', '.dat', + '.xbm', '.icns', '.ico', '.avi', '.mov', '.mpg', '.swf', + '.mp3', '.snd', '.ogg', '.dat', # documents - '.doc', '.ppt', '.xls', '.pdf', - # divers - '.bpt', '.bro', '.eps', '.fm', '.ins', '.mcp', '.objectplant', - '.ofp', '.opn','.pqg', '.prj', '.ps', '.sl', '.strings', '.wordbreak', + '.doc', '.ppt', '.xls', '.pdf', + # divers + '.bpt', '.bro', '.eps', '.fm', '.ins', '.mcp', '.objectplant', + '.ofp', '.opn','.pqg', '.prj', '.ps', '.sl', '.strings', '.wordbreak', ) - + def get_content(self, file): pass #XXX - + def is_binary_content(self, content): pass #XXX diff --git a/lib/pyulib/src/ulib/base/encoding.py b/lib/pyulib/src/ulib/base/encoding.py index 0d1dc7f..70f7cde 100644 --- a/lib/pyulib/src/ulib/base/encoding.py +++ b/lib/pyulib/src/ulib/base/encoding.py @@ -84,7 +84,7 @@ def __set_locale(): break else: print "WARNING: La valeur LANG='%s' n'a pas pu etre utilisee." % lang - + __locale_set = True try: from UTOOLS_CONFIG import SET_LOCALE diff --git a/lib/pyulib/src/ulib/base/files.py b/lib/pyulib/src/ulib/base/files.py index c410095..516828b 100644 --- a/lib/pyulib/src/ulib/base/files.py +++ b/lib/pyulib/src/ulib/base/files.py @@ -33,7 +33,7 @@ class TextFile(object): _absfilename, absfilename = make_prop('_absfilename')[:2] _inf, inf = make_prop('_inf')[:2] _lines, lines = make_prop('_lines')[:2] - + def __init__(self, file=None, raise_exception=True, readlines=True, lines=None): super(TextFile, self).__init__() if lines is not None: self._lines = lines @@ -70,7 +70,7 @@ class TextFile(object): self._inf = file if readlines: return self.readlines(raise_exception) else: return None - + def close(self): if self._inf is not None: self._inf.close() @@ -78,7 +78,7 @@ class TextFile(object): def readlines(self, raise_exception=True, close=True, uio=None): """Lire les lignes du fichier. - + @return: self.lines """ if self._inf is None: @@ -99,7 +99,7 @@ class TextFile(object): def writelines(self, lines=None, outf=None, raise_exception=True, close=True, uio=None): """Ecrire les lignes self.lines dans le fichier. - + si lines!=None, il s'agit du nouvel ensemble de lignes. @return: True si l'écriture a pu se faire, False sinon. diff --git a/lib/pyulib/src/ulib/base/flock.py b/lib/pyulib/src/ulib/base/flock.py index 401432f..9c829bf 100644 --- a/lib/pyulib/src/ulib/base/flock.py +++ b/lib/pyulib/src/ulib/base/flock.py @@ -22,7 +22,7 @@ def __check_mode(mode, *values, **kw): def cxopen(file, mode="r+b", bufsize=-1, perms=0777): u"""Créer atomiquement un fichier et l'ouvrir en lecture/écriture. - + @raise OSError: si le fichier existe déjà. """ __check_mode(mode, 'w', 'a', 'r+') @@ -36,7 +36,7 @@ if os.name == 'posix': def rdopen(file, mode="rb", bufsize=-1, nowait=False): u"""Ouvrir un fichier pour la lecture en tentant d'acquérir un verrou partagé pour sa lecture. - + Le verrou est libéré lors de la fermeture du fichier. """ __check_mode(mode, 'r', unless='r+') @@ -47,7 +47,7 @@ if os.name == 'posix': def wropen(file, mode="r+b", bufsize=-1, perms=0777, nowait=False): u"""Ouvrir un fichier pour la lecture/écriture en tentant d'acquérir un verrou exclusif pour son écriture. - + Le verrou est libéré lors de la fermeture du fichier. """ __check_mode(mode, 'w', 'a', 'r+') diff --git a/lib/pyulib/src/ulib/base/functions.py b/lib/pyulib/src/ulib/base/functions.py index 8b3b16e..ef1170a 100644 --- a/lib/pyulib/src/ulib/base/functions.py +++ b/lib/pyulib/src/ulib/base/functions.py @@ -14,18 +14,18 @@ from base import isseq def apply_args(func, *args, **kw): u"""Appliquer à la fonction func les arguments args, en tenant compte du nombre de ses arguments et en ignorant les arguments "en trop". - + Par exemple, si f est défini ainsi: - + def f(a, b): pass - + Alors: - + apply_args(f, 1, 2, 3) - + Est équivalent à: - + apply(f, (1, 2)) """ f = func diff --git a/lib/pyulib/src/ulib/base/lines.py b/lib/pyulib/src/ulib/base/lines.py index b97248d..017c603 100644 --- a/lib/pyulib/src/ulib/base/lines.py +++ b/lib/pyulib/src/ulib/base/lines.py @@ -20,7 +20,7 @@ class BLines(list): _valid = False def is_valid(self): return self._valid valid = property(is_valid) - + _nl = None def get_nl(self): return self._nl def set_nl(self, nl): self._nl = nl @@ -52,32 +52,32 @@ class BLines(list): if self._nl is None: self._nl = os.linesep else: raise ValueError("Unsupported type: %s" % type(lines)) - + def reset(self): """Vider toutes les lignes de cet objet. """ self[:] = [] self._valid = False self._nl = None - + def _new(self, list=None): u"""Retourner une instance vide de cette classe, avec les mêmes paramètres pour nl. """ return self.__class__(list, self._nl) - + def copy(self): """Faire et retourner une copie de cet objet. """ return self._new(self) - + RE_NLs = re.compile(r'(\r?\n|\r)') def appendtext(self, text, strip_last_nl=False): """Ajouter un texte éventuellement sur plusieurs lignes. - + Si strip_last_nl, ignorer la dernière ligne vide. - + Equivalent en gros à self.extend(test.split(r'\r?\n|\r')) - + @return: self """ lines = self.RE_NLs.split(text) @@ -92,13 +92,13 @@ class BLines(list): i += 2 self.append(self.__strip_nl(line)) return self - + def _after_readlines(self, lines, uio): return lines def readlines(self, inf, raise_exception=True, uio=None, open_func=None, until=None): """Lire les lignes du fichier. - + @param until: fonction qui si elle retourne True, arrête la lecture. La ligne qui arrête la lecture est incluse dans la liste. La signature de la fonction est until(line[, lines]). @@ -131,7 +131,7 @@ class BLines(list): if close_inf: inf.close() if self._nl is None: self._nl = os.linesep return self - + def _before_writelines(self, lines, uio): if uio is None: uio = defaultIO return map(uio.s, lines) @@ -149,11 +149,11 @@ class BLines(list): outf.writelines(map(self.__add_nl, lines)) finally: if close_outf: outf.close() - + def _compile(self, forp): if isstr(forp): forp = re.compile(forp) return forp - + def __apply(self, func, line, index, lines, args): f = func ac_offset = 0 @@ -174,10 +174,10 @@ class BLines(list): """forp étant une fonction ou une expression régulière, retourner une liste d'index de lignes pour lesquelles la fonction retourne True ou qui correspondent à l'expression régulière forp. - + Si inverse==True, la logique est inversée (on ne retourne que les indexes des lignes qui ne matches pas.) - + Si indexes n'est pas None, la recherche se limite aux lignes dont l'index est dans cette liste. Sinon, si boundaries==True, ne rechercher qu'au début et à la fin de la liste (i.e. s'arrêter de part et d'autre @@ -222,10 +222,10 @@ class BLines(list): """forp étant une fonction ou une expression régulière, retourner les lignes pour lesquelles la fonction retourne True ou qui correspondent à l'expression régulière forp. - + Consulter l'aide de la fonction grepi pour des détails sur les paramètres. - + @return: une liste de chaines @rtype: list """ @@ -263,7 +263,7 @@ class BLines(list): Si copy==True, opérer sur une copie de cet objet, sinon les lignes sont modifiées en place. - + @return: la liste résultat @rtype: list """ @@ -287,18 +287,18 @@ class BLines(list): Si l'expression régulière matche, ou si la fonction retourne True, la valeur est gardée, sinon elle est supprimée. Cette logique est inversée si inverse==True. - + Si copy==True, opérer sur une copie de cet objet, sinon les lignes sont modifiées en place. Si boundaries==True, n'opérer qu'au début et à la fin de la liste (i.e. s'arrêter de part et d'autre dès que la fonction retourne True.) - + @return: la liste résultat @rtype: list """ if copy: lines = self.copy() else: lines = self - + forp = self._compile(forp) index = 0 min = 0 @@ -331,7 +331,7 @@ class BLines(list): def join(self, lastnl=False): """Obtenir les lignes jointes avec self.nl - + Si lastnl==True, la dernière ligne se termine par nl. Cela est approprié quand on veut par exemple générer un fichier. """ diff --git a/lib/pyulib/src/ulib/base/output.py b/lib/pyulib/src/ulib/base/output.py index 4eed0cf..1c3584a 100644 --- a/lib/pyulib/src/ulib/base/output.py +++ b/lib/pyulib/src/ulib/base/output.py @@ -204,7 +204,7 @@ def __add_suffix(msg, cls, obj, tb, show_tb=False): msg += u''.join(map(_u, lines)) nl = False return msg, nl - + def eerror(msg=None, flush=None, show_tb=False): nl = True if msg is None or show_tb: diff --git a/lib/pyulib/src/ulib/base/pager.py b/lib/pyulib/src/ulib/base/pager.py index 88c9e2b..086a11d 100644 --- a/lib/pyulib/src/ulib/base/pager.py +++ b/lib/pyulib/src/ulib/base/pager.py @@ -26,7 +26,7 @@ def get_pager_caps(): @return (pager, options) """ options = None - + pager = get_pager() if pager is None: for pager in get_default_pagers(): diff --git a/lib/pyulib/src/ulib/base/password.py b/lib/pyulib/src/ulib/base/password.py index 3e1e7ae..257d143 100644 --- a/lib/pyulib/src/ulib/base/password.py +++ b/lib/pyulib/src/ulib/base/password.py @@ -123,7 +123,7 @@ def gen_binary_hash(pw, scheme, salt=None): if salt is not None: hash += salt return base64.b64encode(hash) - + def gen_hash(pw, scheme=None, ref=None, salt=None, normalized=True): if ref is not None: scheme = get_scheme(ref) diff --git a/lib/pyulib/src/ulib/base/paths.py b/lib/pyulib/src/ulib/base/paths.py index 328b72b..67cbe77 100644 --- a/lib/pyulib/src/ulib/base/paths.py +++ b/lib/pyulib/src/ulib/base/paths.py @@ -20,7 +20,7 @@ def in_PATH(cmd): """ PATH = os.environ.get('PATH', None) if not PATH: return False - + for p in PATH.split(os.pathsep): pf = path.join(p, cmd) if os.access(pf, os.X_OK): @@ -81,7 +81,7 @@ def basename(file, strip_ext=None): RE_ROOT = re.compile(r'/*$') def splitall(file): """Retourner tous les composants de file (répertoires et fichier) - + Par exemple: splitall("/a/b") --> ["a", "b"] Cas particuliers: @@ -100,7 +100,7 @@ def _join(dir, name): def abspath(file, basedir=None, cwd=None): """Retourner le chemin absolu de file. - + file est exprimé par rapport au répertoire basedir, qui est exprimé par rapport à cwd s'il est relatif. """ @@ -113,7 +113,7 @@ def abspath(file, basedir=None, cwd=None): def abspath2(file, basedir=None, cwd=None): """Retourner le chemin absolu de file. - + Si file a un chemin ou s'il existe dans cwd, il est exprimé par rapport à cwd. Si file est sans chemin et qu'il n'existe pas dans cwd, il est exprimé par rapport à basedir. @@ -189,17 +189,17 @@ def ppath(file, basedir=None, cwd=None, homedir=None): def mkdirp(dir): """Créer si nécessaire le répertoire - + @return: True si le répertoire a été créé, False sinon """ if not path.isdir(dir): os.makedirs(dir) return True return False - + def mkdirof(file): """Créer si nécessaire le répertoire du fichier file - + @return: True si le répertoire a été créé, False sinon """ dir, _ = path.split(file) diff --git a/lib/pyulib/src/ulib/base/procs.py b/lib/pyulib/src/ulib/base/procs.py index a861796..35b8572 100644 --- a/lib/pyulib/src/ulib/base/procs.py +++ b/lib/pyulib/src/ulib/base/procs.py @@ -17,21 +17,21 @@ except ImportError: return os.spawnlp(mode, cmd, cmd, *args) from popen2 import Popen3, Popen4 - + def __spawn_capture(capture_out, copy_err_on_out, capture_err, cmd, *args): cmd = (cmd,) + args if copy_err_on_out: child = Popen4(cmd) else: child = Popen3(cmd, True) - + if capture_out: outt = StringDataPumper(child.fromchild, None, close_on_eof=False) if capture_err: errt = StringDataPumper(child.childerr, None, close_on_eof=False) - + if capture_out: outt.join() if capture_err: errt.join() - - exitcode = child.wait() + + exitcode = child.wait() child.fromchild.close() if capture_err: child.childerr.close() child.tochild.close() @@ -47,22 +47,22 @@ except ImportError: cmd = (cmd,) + args if copy_errf_on_outf: child = Popen4(cmd) else: child = Popen3(cmd, True) - + outt = DataPumper(child.fromchild, outf, close_on_eof=False) if errf is not None: errt = DataPumper(child.childerr, errf, close_on_eof=False) int = LinePumper(inf, child.tochild, close_on_eof=True) - + outt.join() if errf is not None: errt.join() int.stop() - + return child.wait() else: def __spawnlp(mode, cmd, *args): return subprocess.call([cmd] + list(args)) - + def __spawn_capture(capture_out, copy_err_on_out, capture_err, cmd, *args): cmd = (cmd,) + args stdout = subprocess.PIPE @@ -73,7 +73,7 @@ else: if not capture_out: stdout = None if not capture_err: stderr = None return Status(exitcode=proc.returncode), stdout, stderr - + def __spawn_redirect(inf, outf, errf, copy_errf_on_outf, cmd, *args): cmd = (cmd,) + args if copy_errf_on_outf: errf = subprocess.STDOUT @@ -110,7 +110,7 @@ def __quote(s): def spawn(cmd, *args, **kw): """Lancer la commande cmd avec les arguments args, et retourner son status d'exécution. La commande est cherchée dans le PATH si nécessaire. - + @rtype: Status @raise OSError: Si la commande n'est pas trouvée dans le PATH. """ @@ -126,11 +126,11 @@ def spawn(cmd, *args, **kw): def spawnall(*argss, **kw): """Lancer toutes les commandes de argss, en s'arrêtant à la première erreur. - + Si kw[STOP_ON_ERRORS] == False, on lance toutes les commande sans se préoccuper de leur code de retour. Retourner le status d'exécution de la dernière commande lancée. - + @rtype: Status """ stop_on_errors = is_stop_on_errors(kw) @@ -143,7 +143,7 @@ def spawnall(*argss, **kw): def spawnone(*argss, **kw): """Lancer toutes les commandes de argss, en s'arrêtant à la première commande qui s'exécute sans erreur. - + @rtype: Status """ status = OK_STATUS @@ -202,7 +202,7 @@ class Pumper(Thread): """ self.pumping = False self.join() - + class LinePumper(Pumper): """Un pumper qui lit les données ligne par ligne """ @@ -213,10 +213,10 @@ class DataPumper(Pumper): """Un pumper qui lit les données par quantité de bufsize. """ bufsize = 4096 - + def set_bufsize(self, bufsize): self.bufsize = bufsize - + def read_data(self): return self.inf.read(self.bufsize) @@ -225,7 +225,7 @@ class StringPumperMixin: dans une chaine plutôt que sur un flux. """ buffer = None - + def write_data(self, data): buffer = self.buffer if buffer is None: buffer = "" @@ -244,13 +244,13 @@ def spawn_capture(cmd, *args, **kw): """Lancer la commande cmd avec les arguments args, et retourner son status d'exécution, ainsi que sa sortie standard et (éventuellement) sa sortie d'erreur sous forme de chaine. - + Si kw ne contient pas la clé stdout avec une valeur fausse, la sortie standard sera capturée. Si kw contient la clé stderr avec une valeur vraie, la sortie d'erreur sera capturée. Si kw contient la clé stderr avec une valeur fausse, la sortie d'erreur ne sera pas capturée. Sinon, la sortie d'erreur sera connectée sur la sortie standard. - + @rtype: tuple @return: (status, stdout, stderr) """ @@ -266,15 +266,15 @@ def spawn_capture(cmd, *args, **kw): def spawn_redirect(cmd, *args, **kw): """Lancer la commande cmd avec les arguments args, et retourner son status d'exécution. - + Si kw contient la clé stdin, l'entrée standard de cmd sera connectée sur ce fichier. Si kw contient la clé stdout, la sortie standard de cmd sera connectée sur ce fichier. Si kw ne contient pas la clé stderr, la sortie d'erreur de cmd sera connectée sur stdout si défini. - + Les valeurs stdout et stderr qui sont retournées sont les valeurs prises de kw telles quelles. - + @rtype: tuple @return: (status, stdout, stderr) """ @@ -283,7 +283,7 @@ def spawn_redirect(cmd, *args, **kw): errf = stderr = kw.get(STDERR, None); close_errf = False if stdin is None and stdout is None and stderr is None: return spawn(cmd, *args, **kw), None, None - + if inf is None: inf = sys.stdin elif isstr(inf): diff --git a/lib/pyulib/src/ulib/base/pversion.py b/lib/pyulib/src/ulib/base/pversion.py index 265d019..d93a608 100644 --- a/lib/pyulib/src/ulib/base/pversion.py +++ b/lib/pyulib/src/ulib/base/pversion.py @@ -32,12 +32,12 @@ def get_version(product=PYTHON): _PYTHON_VERSION_CACHE = {} def check_version(version, product=PYTHON): """Vérifier la version minimum de product. - + Pour le moment, product ne peut valoir que 'python'. version est une chaine de la forme "x[.y...]". - + La version majeure doit correspondre. Les versions mineures doivent être - supérieure ou égales à la version donnée. + supérieure ou égales à la version donnée. """ if product == PYTHON: check = _PYTHON_VERSION_CACHE.get(version, None) diff --git a/lib/pyulib/src/ulib/base/times.py b/lib/pyulib/src/ulib/base/times.py index 0108125..48754f8 100644 --- a/lib/pyulib/src/ulib/base/times.py +++ b/lib/pyulib/src/ulib/base/times.py @@ -77,7 +77,7 @@ class Time(object): hour, minute, second = localtime(t)[3:6] hour, minute, second = _fix_time(hour or 0, minute or 0, second or 0) self._t = pytime(hour, minute, second) - + FORMAT_MAP = {'%Y': '%(y)04i', '%m': '%(m)02i', '%d': '%(d)02i', '%H': '%(H)02i', '%M': '%(M)02i', '%S': '%(S)02i', } @@ -92,13 +92,13 @@ class Time(object): for fr, to in self.FORMAT_MAP.items(): format = format.replace(fr, to) return format % locals() - + def nbsecs(self): """Retourner le nombre de secondes depuis minuit. """ return self.hour * 3600 + self.minute * 60 + self.second nbsecs = property(nbsecs) - + def __repr__(self): if self.second == 0: seconds = '' else: seconds = ', %i' % self.second @@ -111,7 +111,7 @@ class Time(object): if self.second == 0: seconds = '' else: seconds = u':%02i' % self.second return u'%02i:%02i%s' % (self.hour, self.minute, seconds) - + def __eq__(self, other): return self._t == self._time(other, False) def __ne__(self, other): return self._t != self._time(other, False) def __lt__(self, other): @@ -130,7 +130,7 @@ class Time(object): if other is None: return 1 else: return cmp(self._t, self._time(other)) def __hash__(self): return hash(self._t) - + def _time(self, t, required=True): """Retourner l'instance de datetime.time correspondant à l'objet t. """ @@ -138,7 +138,7 @@ class Time(object): elif isinstance(t, Time): return t._t elif required: raise ValueError("Expected datetime.time or Time instance, got %s" % repr(t)) else: return None - + def _s(self, t=None): """Obtenir le nombre de secondes depuis minuit de t. """ @@ -173,13 +173,13 @@ class Time(object): def __add__(self, other): return self._new(s=self._s() + self._s(other)) __radd__ = __add__ def add(self, seconds=1): return self + seconds - + def __sub__(self, other): return self._new(s=self._s() - self._s(other)) __rsub__ = __sub__ def sub(self, seconds=1): return self - seconds def diff(self, other): return self._s() - self._s(other) - + def istime(t): """Tester si t est une instance de Time """ diff --git a/lib/pyulib/src/ulib/base/tmpfiles.py b/lib/pyulib/src/ulib/base/tmpfiles.py index 60e4060..01cbfa8 100644 --- a/lib/pyulib/src/ulib/base/tmpfiles.py +++ b/lib/pyulib/src/ulib/base/tmpfiles.py @@ -43,7 +43,7 @@ class SharedData: tmpfiles = None def _init_tmpfiles(self): self.tmpfiles = [] - + registered = False def _register_atexit(self): if not self.registered: @@ -68,7 +68,7 @@ class SharedData: os.remove(tmpfile) except OSError: pass del self.tmpfiles[li:] - + class ThreadLocalData(ThreadingLocal, SharedData): """Une liste par thread de fichiers temporaires à supprimer """ @@ -84,27 +84,27 @@ class TempFiles: """Créer un fichier temporaire et retourner (tmpf, tmpfile) où tmpf est un file object ouvert en lecture/écriture, et tmpfile le chemin vers le fichier temporaire. - + tmpfile est enregistré pour suppression avec cltemp(). """ tmpf, tmpfile = _mktemp(suffix, prefix, dir, text) self.local.add_tmpfile(tmpfile) return tmpf, tmpfile - + def mktempfile(self, suffix="", prefix=tempfile.template, dir=None, text=False): """Créer un fichier temporaire et retourner tmpfile, le chemin vers le fichier temporaire. - + tmpfile est enregistré pour suppression avec cltemp(). """ tmpf, tmpfile = self.mktemp(suffix, prefix, dir, text) tmpf.close() return tmpfile - + def litemp(self): """Retourner le nombre de fichiers temporaires enregistrés pour suppression. - + Cette information peut être utilisée par cltemp() pour indiquer à partir de quel index il faut supprimer les fichiers temporaires. """ @@ -114,17 +114,17 @@ class TempFiles: """Supprimer les fichiers temporaires enregistrés à partir de l'index li. """ self.local.remove_tmpfiles(li) - + def actemp(self, tmpfile): """Enregistrer un fichier pour suppression avec cltemp(). - + @return: la valeur de litemp() avant l'enregistrement du fichier tmpfile. """ li = self.litemp() self.local.add_tmpfile(path.abspath(tmpfile)) return li - + TEMP_FILES = TempFiles(ThreadLocalData()) def mktemp(suffix="", prefix=tempfile.template, dir=None, text=False): diff --git a/lib/pyulib/src/ulib/base/uio.py b/lib/pyulib/src/ulib/base/uio.py index 22e2a1b..f3e2b44 100644 --- a/lib/pyulib/src/ulib/base/uio.py +++ b/lib/pyulib/src/ulib/base/uio.py @@ -26,7 +26,7 @@ OUTS = {'stdout': stdout, 'out': stdout, class UnicodeIO(object): _encoding, encoding, get_encoding = make_prop('_encoding', None, setter=False) _errors, errors, get_errors = make_prop('_errors', 'strict', setter=False) - + def __init__(self, encoding=None, errors=None): if encoding is not None: self._encoding = encoding if errors is not None: self._errors = errors @@ -44,7 +44,7 @@ class UnicodeIO(object): if type(u) not in StringTypes: u = unicode(str(u), encoding, errors) elif type(u) is not UnicodeType: u = unicode(u, encoding, errors) return u - + def _get_output_encoding(self): return get_output_encoding() @@ -62,14 +62,14 @@ class UnicodeIO(object): """Lire depuis stdin et décoder le résultat avec input_encoding. """ return self.u(raw_input(), encoding, errors) - + def uprint(self, s, nl=True, flush=None, encoding=None, out=None): """Afficher une chaine unicode en l'encodant avec output_encoding. """ if flush is None: flush = nl if out is None: out = stdout elif isstr(out): out = OUTS[out.lower()] - + out.write(self.s(s, encoding)) if nl: out.write("\n") if flush: out.flush() diff --git a/lib/pyulib/src/ulib/base/words.py b/lib/pyulib/src/ulib/base/words.py index 0a3c0a3..54bb578 100644 --- a/lib/pyulib/src/ulib/base/words.py +++ b/lib/pyulib/src/ulib/base/words.py @@ -107,7 +107,7 @@ def splitcc(src, plural=False): """ src = src.strip() if not src: return [] - + parts = UPPERCASE_PATTERN.findall(src) if parts[ - 1] == ('', ''): parts = parts[: - 1] @@ -168,7 +168,7 @@ def splitus(src, plural=False): """ src = src.strip() if not src: return [] - + dests = UNDERSCORE_PATTERN.split(src) if dests and plural: dests[-1] = enplural(dests[-1]) return dests diff --git a/lib/pyulib/src/ulib/ext/optik141/README.txt b/lib/pyulib/src/ulib/ext/optik141/README.txt index 2723699..6297811 100644 --- a/lib/pyulib/src/ulib/ext/optik141/README.txt +++ b/lib/pyulib/src/ulib/ext/optik141/README.txt @@ -52,7 +52,7 @@ details. REQUIREMENTS & INSTALLATION --------------------------- - + Optik requires Python 2.0 or greater (although this release has only been tested with Python 2.1, 2.2, and 2.3.) @@ -142,7 +142,7 @@ met: * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/lib/pyulib/src/ulib/ext/simplejson/decoder.py b/lib/pyulib/src/ulib/ext/simplejson/decoder.py index 811e733..2d99d65 100644 --- a/lib/pyulib/src/ulib/ext/simplejson/decoder.py +++ b/lib/pyulib/src/ulib/ext/simplejson/decoder.py @@ -68,7 +68,7 @@ def py_scanstring(s, end, encoding=None, strict=True, _b=BACKSLASH, _m=STRINGCHU Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. - + Returns a tuple of the decoded string and the index of the character in s after the end quote.""" if encoding is None: diff --git a/lib/pyulib/src/ulib/ext/web/application.py b/lib/pyulib/src/ulib/ext/web/application.py index 2b40d55..25a4c09 100755 --- a/lib/pyulib/src/ulib/ext/web/application.py +++ b/lib/pyulib/src/ulib/ext/web/application.py @@ -24,7 +24,7 @@ except ImportError: __all__ = [ "application", "auto_application", - "subdir_application", "subdomain_application", + "subdir_application", "subdomain_application", "loadhook", "unloadhook", "autodelegate" ] @@ -32,7 +32,7 @@ __all__ = [ class application: """ Application to delegate requests based on path. - + >>> urls = ("/hello", "hello") >>> app = application(urls, globals()) >>> class hello: @@ -47,10 +47,10 @@ class application: self.mapping = mapping self.fvars = fvars self.processors = [] - + self.add_processor(loadhook(self._load)) self.add_processor(unloadhook(self._unload)) - + if autoreload: def main_module_name(): mod = sys.modules['__main__'] @@ -64,14 +64,14 @@ class application: return None if name == '__main__': - # Since the __main__ module can't be reloaded, the module has - # to be imported using its file name. + # Since the __main__ module can't be reloaded, the module has + # to be imported using its file name. name = main_module_name() return name - + mapping_name = utils.dictfind(fvars, mapping) module_name = modname(fvars) - + def reload_mapping(): """loadhook to reload mapping and fvars.""" mod = __import__(module_name) @@ -90,13 +90,13 @@ class application: __import__(main_module_name()) except ImportError: pass - + def _load(self): web.ctx.app_stack.append(self) - + def _unload(self): web.ctx.app_stack = web.ctx.app_stack[:-1] - + if web.ctx.app_stack: # this is a sub-application, revert ctx to earlier state. oldctx = web.ctx.get('_oldctx') @@ -105,25 +105,25 @@ class application: web.ctx.homepath = oldctx.homepath web.ctx.path = oldctx.path web.ctx.fullpath = oldctx.fullpath - + def _cleanup(self): #@@@ # Since the CherryPy Webserver uses thread pool, the thread-local state is never cleared. - # This interferes with the other requests. + # This interferes with the other requests. # clearing the thread-local storage to avoid that. # see utils.ThreadedDict for details import threading t = threading.currentThread() if hasattr(t, '_d'): del t._d - + def add_mapping(self, pattern, classname): self.mapping += (pattern, classname) - + def add_processor(self, processor): """ - Adds a processor to the application. - + Adds a processor to the application. + >>> urls = ("/(.*)", "echo") >>> app = application(urls, globals()) >>> class echo: @@ -146,7 +146,7 @@ class application: >>> urls = ("/hello", "hello") >>> app = application(urls, globals()) >>> class hello: - ... def GET(self): + ... def GET(self): ... web.header('Content-Type', 'text/plain') ... return "hello" ... @@ -179,7 +179,7 @@ class application: >>> class uaprinter: ... def GET(self): ... return 'your user-agent is ' + web.ctx.env['HTTP_USER_AGENT'] - ... + ... >>> app = application(urls, globals()) >>> app.request('/ua', headers = { ... 'User-Agent': 'a small jumping bean/1.0 (compatible)' @@ -189,7 +189,7 @@ class application: """ path, maybe_query = urllib.splitquery(localpart) query = maybe_query or "" - + if 'env' in kw: env = kw['env'] else: @@ -231,7 +231,7 @@ class application: def handle(self): fn, args = self._match(self.mapping, web.ctx.path) return self._delegate(fn, self.fvars, args) - + def handle_with_processors(self): def process(processors): try: @@ -247,10 +247,10 @@ class application: except: print >> web.debug, traceback.format_exc() raise self.internalerror() - + # processors must be applied in the resvere order. (??) return process(self.processors) - + def wsgifunc(self, *middleware): """Returns a WSGI-compatible function for this application.""" def peep(iterator): @@ -265,10 +265,10 @@ class application: except StopIteration: firstchunk = '' - return itertools.chain([firstchunk], iterator) - + return itertools.chain([firstchunk], iterator) + def is_generator(x): return x and hasattr(x, 'next') - + def wsgi(env, start_resp): self.load(env) try: @@ -288,14 +288,14 @@ class application: status, headers = web.ctx.status, web.ctx.headers start_resp(status, headers) - + def cleanup(): self._cleanup() yield '' # force this function to be a generator - + return itertools.chain(result, cleanup()) - for m in middleware: + for m in middleware: wsgi = m(wsgi) return wsgi @@ -306,17 +306,17 @@ class application: that protocol. If called from the command line, it will start an HTTP server on the port named in the first command line argument, or, if there is no argument, on port 8080. - + `middleware` is a list of WSGI middleware which is applied to the resulting WSGI function. """ return wsgi.runwsgi(self.wsgifunc(*middleware)) - + def cgirun(self, *middleware): """ Return a CGI handler. This is mostly useful with Google App Engine. There you can just do: - + main = app.cgirun() """ wsgiapp = self.wsgifunc(*middleware) @@ -327,7 +327,7 @@ class application: except ImportError: # we're not running from within Google App Engine return wsgiref.handlers.CGIHandler().run(wsgiapp) - + def load(self, env): """Initializes ctx using env.""" ctx = web.ctx @@ -356,7 +356,7 @@ class application: # http://trac.lighttpd.net/trac/ticket/406 requires: if env.get('SERVER_SOFTWARE', '').startswith('lighttpd/'): ctx.path = lstrips(env.get('REQUEST_URI').split('?')[0], ctx.homepath) - # Apache and CherryPy webservers unquote the url but lighttpd doesn't. + # Apache and CherryPy webservers unquote the url but lighttpd doesn't. # unquote explicitly for lighttpd to make ctx.path uniform across all servers. ctx.path = urllib.unquote(ctx.path) @@ -366,21 +366,21 @@ class application: ctx.query = '' ctx.fullpath = ctx.path + ctx.query - + for k, v in ctx.iteritems(): if isinstance(v, str): ctx[k] = safeunicode(v) # status must always be str ctx.status = '200 OK' - + ctx.app_stack = [] _handler_configurator = None - + def set_handler_configurator(self, handler_configurator): self._handler_configurator = handler_configurator - + def configure_handler(self, handler): if self._handler_configurator is not None: self._handler_configurator(handler) @@ -396,9 +396,9 @@ class application: self.configure_handler(handler) tocall = getattr(handler, meth) return tocall(*args) - + def is_class(o): return isinstance(o, (types.ClassType, type)) - + if f is None: raise web.notfound() elif isinstance(f, application): @@ -438,16 +438,16 @@ class application: what, result = utils.re_subm('^' + pat + '$', what, value) else: result = utils.re_compile('^' + pat + '$').match(value) - + if result: # it's a match return what, [x for x in result.groups()] return None, None - + def _delegate_sub_application(self, dir, app): """Deletes request to sub application `app` rooted at the directory `dir`. The home, homepath, path and fullpath values in web.ctx are updated to mimic request - to the subapp and are restored after it is handled. - + to the subapp and are restored after it is handled. + @@Any issues with when used with yield? """ web.ctx._oldctx = web.storage(web.ctx) @@ -456,13 +456,13 @@ class application: web.ctx.path = web.ctx.path[len(dir):] web.ctx.fullpath = web.ctx.fullpath[len(dir):] return app.handle_with_processors() - + def get_parent_app(self): if self in web.ctx.app_stack: index = web.ctx.app_stack.index(self) if index > 0: return web.ctx.app_stack[index-1] - + def notfound(self): """Returns HTTPError with '404 not found' message""" parent = self.get_parent_app() @@ -470,7 +470,7 @@ class application: return parent.notfound() else: return web._NotFound() - + def internalerror(self): """Returns HTTPError with '500 internal error' message""" parent = self.get_parent_app() @@ -483,7 +483,7 @@ class application: return web._InternalError() class auto_application(application): - """Application similar to `application` but urls are constructed + """Application similar to `application` but urls are constructed automatiacally using metaclass. >>> app = auto_application() @@ -519,7 +519,7 @@ class auto_application(application): # The application class already has the required functionality of subdir_application subdir_application = application - + class subdomain_application(application): """ Application to delegate requests based on the host. @@ -543,7 +543,7 @@ class subdomain_application(application): host = web.ctx.host.split(':')[0] #strip port fn, args = self._match(self.mapping, host) return self._delegate(fn, self.fvars, args) - + def _match(self, mapping, value): for pat, what in utils.group(mapping, 2): if isinstance(what, basestring): @@ -554,11 +554,11 @@ class subdomain_application(application): if result: # it's a match return what, [x for x in result.groups()] return None, None - + def loadhook(h): """ Converts a load hook into an application processor. - + >>> app = auto_application() >>> def f(): "something done before handling request" ... @@ -567,17 +567,17 @@ def loadhook(h): def processor(handler): h() return handler() - + return processor - + def unloadhook(h): """ Converts an unload hook into an application processor. - + >>> app = auto_application() >>> def f(): "something done after handling request" ... - >>> app.add_processor(unloadhook(f)) + >>> app.add_processor(unloadhook(f)) """ def processor(handler): try: @@ -593,7 +593,7 @@ def unloadhook(h): else: h() return result - + def wrap(result): def next(): try: @@ -606,7 +606,7 @@ def unloadhook(h): result = iter(result) while True: yield next() - + return processor def autodelegate(prefix=''): @@ -621,9 +621,9 @@ def autodelegate(prefix=''): def GET_password(self): pass def GET_privacy(self): pass - `GET_password` would get called for `/prefs/password` while `GET_privacy` for + `GET_password` would get called for `/prefs/password` while `GET_privacy` for `GET_privacy` gets called for `/prefs/privacy`. - + If a user visits `/prefs/password/change` then `GET_password(self, '/change')` is called. """ @@ -635,7 +635,7 @@ def autodelegate(prefix=''): else: func = prefix + arg args = [] - + if hasattr(self, func): try: return getattr(self, func)(*args) @@ -646,7 +646,7 @@ def autodelegate(prefix=''): return internal class Reloader: - """Checks to see if any loaded modules have changed on disk and, + """Checks to see if any loaded modules have changed on disk and, if so, reloads them. """ def __init__(self): @@ -655,24 +655,24 @@ class Reloader: def __call__(self): for mod in sys.modules.values(): self.check(mod) - + def check(self, mod): - try: + try: mtime = os.stat(mod.__file__).st_mtime except (AttributeError, OSError, IOError): return if mod.__file__.endswith('.pyc') and os.path.exists(mod.__file__[:-1]): mtime = max(os.stat(mod.__file__[:-1]).st_mtime, mtime) - + if mod not in self.mtimes: self.mtimes[mod] = mtime elif self.mtimes[mod] < mtime: - try: + try: reload(mod) self.mtimes[mod] = mtime - except ImportError: + except ImportError: pass - + if __name__ == "__main__": import doctest doctest.testmod() diff --git a/lib/pyulib/src/ulib/ext/web/browser.py b/lib/pyulib/src/ulib/ext/web/browser.py index 66d859e..084a8c4 100644 --- a/lib/pyulib/src/ulib/ext/web/browser.py +++ b/lib/pyulib/src/ulib/ext/web/browser.py @@ -28,7 +28,7 @@ class Browser: self.url = "http://0.0.0.0:8080/" self.path = "/" - + self.status = None self.data = None self._response = None @@ -39,7 +39,7 @@ class Browser: self.cookiejar.clear() def build_opener(self): - """Builds the opener using urllib2.build_opener. + """Builds the opener using urllib2.build_opener. Subclasses can override this function to prodive custom openers. """ return urllib2.build_opener() @@ -95,7 +95,7 @@ class Browser: def _get_links(self): soup = self.get_soup() return [a for a in soup.findAll(name='a')] - + def get_links(self, text=None, text_regex=None, url=None, url_regex=None, predicate=None): """Returns all links in the document.""" return self._filter_links(self._get_links(), @@ -106,18 +106,18 @@ class Browser: links = self._filter_links(self.get_links(), text=text, text_regex=text_regex, url=url, url_regex=url_regex, predicate=predicate) link = links and links[0] - + if link: return self.open(link['href']) else: raise BrowserError("No link found") - + def find_link(self, text=None, text_regex=None, url=None, url_regex=None, predicate=None): - links = self._filter_links(self.get_links(), + links = self._filter_links(self.get_links(), text=text, text_regex=text_regex, url=url, url_regex=url_regex, predicate=predicate) return links and links[0] or None - - def _filter_links(self, links, + + def _filter_links(self, links, text=None, text_regex=None, url=None, url_regex=None, predicate=None): @@ -158,13 +158,13 @@ class Browser: forms = [f for f in forms if f.name == name] if predicate: forms = [f for f in forms if predicate(f)] - + if forms: self.form = forms[index] return self.form else: raise BrowserError("No form selected.") - + def submit(self, **kw): """submits the currently selected form.""" if self.form is None: @@ -180,11 +180,11 @@ class Browser: class AppBrowser(Browser): """Browser interface to test web.py apps. - + b = AppBrowser(app) b.open('/') b.follow_link(text='Login') - + b.select_form(name='login') b['username'] = 'joe' b['password'] = 'secret' @@ -220,7 +220,7 @@ class AppHandler(urllib2.HTTPHandler): def https_open(self, req): return self.http_open(req) - + try: https_request = urllib2.HTTPHandler.do_request_ except AttributeError: diff --git a/lib/pyulib/src/ulib/ext/web/contrib/template.py b/lib/pyulib/src/ulib/ext/web/contrib/template.py index 7495d39..b2480e3 100644 --- a/lib/pyulib/src/ulib/ext/web/contrib/template.py +++ b/lib/pyulib/src/ulib/ext/web/contrib/template.py @@ -5,7 +5,7 @@ import os.path __all__ = [ "render_cheetah", "render_genshi", "render_mako", - "cache", + "cache", ] class render_cheetah: @@ -24,13 +24,13 @@ class render_cheetah: def __getattr__(self, name): from Cheetah.Template import Template path = os.path.join(self.path, name + ".html") - + def template(**kw): t = Template(file=path, searchList=[kw]) return t.respond() return template - + class render_genshi: """Rendering interface genshi templates. Example: @@ -75,7 +75,7 @@ class render_genshi: class render_jinja: """Rendering interface to Jinja2 Templates - + Example: render= render_jinja('templates') @@ -88,13 +88,13 @@ class render_jinja: from jinja2 import Environment,FileSystemLoader self._lookup = Environment(loader=FileSystemLoader(*a, **kwargs), extensions=extensions) self._lookup.globals.update(globals) - + def __getattr__(self, name): # Assuming all templates end with .html path = name + '.html' t = self._lookup.get_template(path) return t.render - + class render_mako: """Rendering interface to Mako Templates. @@ -115,7 +115,7 @@ class render_mako: class cache: """Cache for any rendering interface. - + Example: render = cache(render_cheetah("templates/")) diff --git a/lib/pyulib/src/ulib/ext/web/db.py b/lib/pyulib/src/ulib/ext/web/db.py index 8ba1e2f..fcf91ab 100644 --- a/lib/pyulib/src/ulib/ext/web/db.py +++ b/lib/pyulib/src/ulib/ext/web/db.py @@ -4,7 +4,7 @@ Database API """ __all__ = [ - "UnknownParamstyle", "UnknownDB", "TransactionError", + "UnknownParamstyle", "UnknownDB", "TransactionError", "sqllist", "sqlors", "reparam", "sqlquote", "SQLQuery", "SQLParam", "sqlparam", "SQLLiteral", "sqlliteral", @@ -20,7 +20,7 @@ except ImportError: try: set except NameError: from sets import Set as set - + from utils import threadeddict, storage, iters, iterbetter, safestr, safeunicode try: @@ -35,7 +35,7 @@ class UnknownDB(Exception): """raised for unsupported dbms""" pass -class _ItplError(ValueError): +class _ItplError(ValueError): def __init__(self, text, pos): ValueError.__init__(self) self.text = text @@ -46,18 +46,18 @@ class _ItplError(ValueError): class TransactionError(Exception): pass -class UnknownParamstyle(Exception): +class UnknownParamstyle(Exception): """ raised for unsupported db paramstyles (currently supported: qmark, numeric, format, pyformat) """ pass - + class SQLParam: """ Parameter in SQLQuery. - + >>> q = SQLQuery(["SELECT * FROM test WHERE name=", SQLParam("joe")]) >>> q @@ -68,7 +68,7 @@ class SQLParam: """ def __init__(self, value): self.value = value - + def get_marker(self, paramstyle='pyformat'): if paramstyle == 'qmark': return '?' @@ -77,19 +77,19 @@ class SQLParam: elif paramstyle is None or paramstyle in ['format', 'pyformat']: return '%s' raise UnknownParamstyle, paramstyle - - def sqlquery(self): + + def sqlquery(self): return SQLQuery([self]) - + def __add__(self, other): return self.sqlquery() + other - + def __radd__(self, other): - return other + self.sqlquery() - - def __str__(self): + return other + self.sqlquery() + + def __str__(self): return str(self.value) - + def __repr__(self): return '' % repr(self.value) @@ -107,7 +107,7 @@ class SQLQuery: # tested in sqlquote's docstring def __init__(self, items=[]): r"""Creates a new SQLQuery. - + >>> SQLQuery("x") >>> q = SQLQuery(['SELECT * FROM ', 'test', ' WHERE x=', SQLParam(1)]) @@ -126,7 +126,7 @@ class SQLQuery: self.items = list(items.items) else: self.items = [items] - + # Take care of SQLLiterals for i, item in enumerate(self.items): if isinstance(item, SQLParam) and isinstance(item.value, SQLLiteral): @@ -146,7 +146,7 @@ class SQLQuery: items = [other] else: return NotImplemented - + return SQLQuery(items + self.items) def __iadd__(self, other): @@ -161,7 +161,7 @@ class SQLQuery: def __len__(self): return len(self.query()) - + def query(self, paramstyle=None): """ Returns the query part of the sql query. @@ -177,7 +177,7 @@ class SQLQuery: x = x.get_marker(paramstyle) s += safestr(x) return s - + def values(self): """ Returns the values of the parameters used in the sql query. @@ -186,11 +186,11 @@ class SQLQuery: ['joe'] """ return [i.value for i in self.items if isinstance(i, SQLParam)] - + def join(items, sep=' '): """ Joins multiple queries. - + >>> SQLQuery.join(['a', 'b'], ', ') """ @@ -202,25 +202,25 @@ class SQLQuery: q += sep q += item return q - + join = staticmethod(join) - + def _str(self): try: - return self.query() % tuple([sqlify(x) for x in self.values()]) + return self.query() % tuple([sqlify(x) for x in self.values()]) except (ValueError, TypeError): return self.query() - + def __str__(self): return safestr(self._str()) - + def __unicode__(self): return safeunicode(self._str()) def __repr__(self): return '' % repr(str(self)) -class SQLLiteral: +class SQLLiteral: """ Protects a string from `sqlquote`. @@ -229,10 +229,10 @@ class SQLLiteral: >>> sqlquote(SQLLiteral('NOW()')) """ - def __init__(self, v): + def __init__(self, v): self.v = v - def __repr__(self): + def __repr__(self): return self.v sqlliteral = SQLLiteral @@ -251,7 +251,7 @@ def _sqllist(values): items.append(')') return SQLQuery(items) -def reparam(string_, dictionary): +def reparam(string_, dictionary): """ Takes a string and a dictionary and interpolates the string using values from the dictionary. Returns an `SQLQuery` for the result. @@ -268,11 +268,11 @@ def reparam(string_, dictionary): if live: v = eval(chunk, dictionary) result.append(sqlquote(v)) - else: + else: result.append(chunk) return SQLQuery.join(result, '') -def sqlify(obj): +def sqlify(obj): """ converts `obj` to its proper SQL version @@ -298,10 +298,10 @@ def sqlify(obj): if isinstance(obj, unicode): obj = obj.encode('utf8') return repr(obj) -def sqllist(lst): +def sqllist(lst): """ Converts the arguments for use in something like a WHERE clause. - + >>> sqllist(['a', 'b']) 'a, b' >>> sqllist('a') @@ -309,14 +309,14 @@ def sqllist(lst): >>> sqllist(u'abc') u'abc' """ - if isinstance(lst, basestring): + if isinstance(lst, basestring): return lst else: return ', '.join(lst) def sqlors(left, lst): """ - `left is a SQL clause like `tablename.arg = ` + `left is a SQL clause like `tablename.arg = ` and `lst` is a list of values. Returns a reparam-style pair featuring the SQL that ORs together the clause for each item in the lst. @@ -339,17 +339,17 @@ def sqlors(left, lst): lst = lst[0] if isinstance(lst, iters): - return SQLQuery(['('] + + return SQLQuery(['('] + sum([[left, sqlparam(x), ' OR '] for x in lst], []) + ['1=2)'] ) else: return left + sqlparam(lst) - -def sqlwhere(dictionary, grouping=' AND '): + +def sqlwhere(dictionary, grouping=' AND '): """ Converts a `dictionary` to an SQL WHERE clause `SQLQuery`. - + >>> sqlwhere({'cust_id': 2, 'order_id':3}) >>> sqlwhere({'cust_id': 2, 'order_id':3}, grouping=', ') @@ -359,7 +359,7 @@ def sqlwhere(dictionary, grouping=' AND '): """ return SQLQuery.join([k + ' = ' + sqlparam(v) for k, v in dictionary.items()], grouping) -def sqlquote(a): +def sqlquote(a): """ Ensures `a` is quoted properly for use in a SQL query. @@ -406,7 +406,7 @@ class Transaction: self.query('ROLLBACK TO SAVEPOINT webpy_sp_%s') class dummy_engine: - """Transaction Engine used instead of subtransaction_engine + """Transaction Engine used instead of subtransaction_engine when sub transactions are not supported.""" do_transact = do_commit = do_rollback = lambda self: None @@ -441,7 +441,7 @@ class Transaction: self.engine.do_rollback() self.ctx.transactions = self.ctx.transactions[:self.transaction_count] -class DB: +class DB: """Database""" def __init__(self, db_module, keywords): """Creates a database. @@ -453,82 +453,82 @@ class DB: self.db_module = db_module self.keywords = keywords - + self._ctx = threadeddict() # flag to enable/disable printing queries self.printing = config.get('debug', False) self.supports_multiple_insert = False - + try: import DBUtils # enable pooling if DBUtils module is available. self.has_pooling = True except ImportError: self.has_pooling = False - + # Pooling can be disabled by passing pooling=False in the keywords. self.has_pooling = self.keywords.pop('pooling', True) and self.has_pooling - - def _getctx(self): + + def _getctx(self): if not self._ctx.get('db'): self._load_context(self._ctx) return self._ctx ctx = property(_getctx) - + def _load_context(self, ctx): ctx.dbq_count = 0 ctx.transactions = [] # stack of transactions - + if self.has_pooling: ctx.db = self._connect_with_pooling(self.keywords) else: ctx.db = self._connect(self.keywords) ctx.db_execute = self._db_execute - + if not hasattr(ctx.db, 'commit'): ctx.db.commit = lambda: None if not hasattr(ctx.db, 'rollback'): ctx.db.rollback = lambda: None - + def commit(unload=True): - # do db commit and release the connection if pooling is enabled. + # do db commit and release the connection if pooling is enabled. ctx.db.commit() if unload and self.has_pooling: self._unload_context(self._ctx) - + def rollback(): # do db rollback and release the connection if pooling is enabled. ctx.db.rollback() if self.has_pooling: self._unload_context(self._ctx) - + ctx.commit = commit ctx.rollback = rollback - + def _unload_context(self, ctx): del ctx.db - + def _connect(self, keywords): return self.db_module.connect(**keywords) - + def _connect_with_pooling(self, keywords): def get_pooled_db(): from DBUtils import PooledDB # In DBUtils 0.9.3, `dbapi` argument is renamed as `creator` # see Bug#122112 - + if PooledDB.__version__.split('.') < '0.9.3'.split('.'): return PooledDB.PooledDB(dbapi=self.db_module, **keywords) else: return PooledDB.PooledDB(creator=self.db_module, **keywords) - + if getattr(self, '_pooleddb', None) is None: self._pooleddb = get_pooled_db() - + return self._pooleddb.connection() - + def _db_cursor(self): return self.ctx.db.cursor() @@ -544,10 +544,10 @@ class DB: return '%s' raise UnknownParamstyle, style - def _db_execute(self, cur, sql_query): + def _db_execute(self, cur, sql_query): """executes an sql query""" self.ctx.dbq_count += 1 - + try: a = time.time() paramstyle = getattr(self, 'paramstyle', 'pyformat') @@ -565,8 +565,8 @@ class DB: if self.printing: print >> debug, '%s (%s): %s' % (round(b-a, 2), self.ctx.dbq_count, str(sql_query)) return out - - def _where(self, where, vars): + + def _where(self, where, vars): if isinstance(where, (int, long)): where = "id = " + sqlparam(where) #@@@ for backward-compatibility @@ -575,15 +575,15 @@ class DB: elif isinstance(where, SQLQuery): pass else: - where = reparam(where, vars) + where = reparam(where, vars) return where - - def query(self, sql_query, vars=None, processed=False, _test=False): + + def query(self, sql_query, vars=None, processed=False, _test=False): """ Execute SQL query `sql_query` using dictionary `vars` to interpolate it. - If `processed=True`, `vars` is a `reparam`-style list to use + If `processed=True`, `vars` is a `reparam`-style list to use instead of interpolating. - + >>> db = DB(None, {}) >>> db.query("SELECT * FROM foo", _test=True) @@ -593,15 +593,15 @@ class DB: """ if vars is None: vars = {} - + if not processed and not isinstance(sql_query, SQLQuery): sql_query = reparam(sql_query, vars) - + if _test: return sql_query - + db_cursor = self._db_cursor() self._db_execute(db_cursor, sql_query) - + if db_cursor.description: names = [x[0] for x in db_cursor.description] def iterwrapper(): @@ -615,18 +615,18 @@ class DB: for x in db_cursor.fetchall()] else: out = db_cursor.rowcount - - if not self.ctx.transactions: + + if not self.ctx.transactions: self.ctx.commit() return out - - def select(self, tables, vars=None, what='*', where=None, order=None, group=None, - limit=None, offset=None, _test=False): + + def select(self, tables, vars=None, what='*', where=None, order=None, group=None, + limit=None, offset=None, _test=False): """ - Selects `what` from `tables` with clauses `where`, `order`, - `group`, `limit`, and `offset`. Uses vars to interpolate. + Selects `what` from `tables` with clauses `where`, `order`, + `group`, `limit`, and `offset`. Uses vars to interpolate. Otherwise, each clause can be a SQLQuery. - + >>> db = DB(None, {}) >>> db.select('foo', _test=True) @@ -639,12 +639,12 @@ class DB: qout = SQLQuery.join(clauses) if _test: return qout return self.query(qout, processed=True) - - def where(self, table, what='*', order=None, group=None, limit=None, + + def where(self, table, what='*', order=None, group=None, limit=None, offset=None, _test=False, **kwargs): """ Selects from `table` where keys are equal to values in `kwargs`. - + >>> db = DB(None, {}) >>> db.where('foo', bar_id=3, _test=True) @@ -654,11 +654,11 @@ class DB: where = [] for k, v in kwargs.iteritems(): where.append(k + ' = ' + sqlquote(v)) - return self.select(table, what=what, order=order, - group=group, limit=limit, offset=offset, _test=_test, + return self.select(table, what=what, order=order, + group=group, limit=limit, offset=offset, _test=_test, where=SQLQuery.join(where, ' AND ')) - - def sql_clauses(self, what, tables, where, group, order, limit, offset): + + def sql_clauses(self, what, tables, where, group, order, limit, offset): return ( ('SELECT', what), ('FROM', sqllist(tables)), @@ -667,8 +667,8 @@ class DB: ('ORDER BY', order), ('LIMIT', limit), ('OFFSET', offset)) - - def gen_clause(self, sql, val, vars): + + def gen_clause(self, sql, val, vars): if isinstance(val, (int, long)): if sql == 'WHERE': nout = 'id = ' + sqlquote(val) @@ -688,12 +688,12 @@ class DB: return xjoin(sql, nout) - def insert(self, tablename, seqname=None, _test=False, **values): + def insert(self, tablename, seqname=None, _test=False, **values): """ Inserts `values` into `tablename`. Returns current sequence ID. Set `seqname` to the ID if it's not the default, or to `False` if there isn't one. - + >>> db = DB(None, {}) >>> q = db.insert('foo', name='bob', age=2, created=SQLLiteral('NOW()'), _test=True) >>> q @@ -704,7 +704,7 @@ class DB: [2, 'bob'] """ def q(x): return "(" + x + ")" - + if values: _keys = SQLQuery.join(values.keys(), ', ') _values = SQLQuery.join([sqlparam(v) for v in values.values()], ', ') @@ -713,13 +713,13 @@ class DB: sql_query = SQLQuery("INSERT INTO %s DEFAULT VALUES" % tablename) if _test: return sql_query - + db_cursor = self._db_cursor() - if seqname is not False: + if seqname is not False: sql_query = self._process_insert_query(sql_query, tablename, seqname) if isinstance(sql_query, tuple): - # for some databases, a separate query has to be made to find + # for some databases, a separate query has to be made to find # the id of the inserted row. q1, q2 = sql_query self._db_execute(db_cursor, q1) @@ -727,39 +727,39 @@ class DB: else: self._db_execute(db_cursor, sql_query) - try: + try: out = db_cursor.fetchone()[0] - except Exception: + except Exception: out = None - - if not self.ctx.transactions: + + if not self.ctx.transactions: self.ctx.commit() return out - + def multiple_insert(self, tablename, values, seqname=None, _test=False): """ - Inserts multiple rows into `tablename`. The `values` must be a list of dictioanries, + Inserts multiple rows into `tablename`. The `values` must be a list of dictioanries, one for each row to be inserted, each with the same set of keys. - Returns the list of ids of the inserted rows. + Returns the list of ids of the inserted rows. Set `seqname` to the ID if it's not the default, or to `False` if there isn't one. - + >>> db = DB(None, {}) >>> db.supports_multiple_insert = True >>> values = [{"name": "foo", "email": "foo@example.com"}, {"name": "bar", "email": "bar@example.com"}] >>> db.multiple_insert('person', values=values, _test=True) - """ + """ if not values: return [] - + if not self.supports_multiple_insert: out = [self.insert(tablename, seqname=seqname, _test=_test, **v) for v in values] if seqname is False: return None else: return out - + keys = values[0].keys() #@@ make sure all keys are valid @@ -768,7 +768,7 @@ class DB: if v.keys() != keys: raise ValueError, 'Bad data' - sql_query = SQLQuery('INSERT INTO %s (%s) VALUES ' % (tablename, ', '.join(keys))) + sql_query = SQLQuery('INSERT INTO %s (%s) VALUES ' % (tablename, ', '.join(keys))) data = [] for row in values: @@ -779,11 +779,11 @@ class DB: if _test: return sql_query db_cursor = self._db_cursor() - if seqname is not False: + if seqname is not False: sql_query = self._process_insert_query(sql_query, tablename, seqname) if isinstance(sql_query, tuple): - # for some databases, a separate query has to be made to find + # for some databases, a separate query has to be made to find # the id of the inserted row. q1, q2 = sql_query self._db_execute(db_cursor, q1) @@ -791,18 +791,18 @@ class DB: else: self._db_execute(db_cursor, sql_query) - try: + try: out = db_cursor.fetchone()[0] - out = range(out-len(values)+1, out+1) - except Exception: + out = range(out-len(values)+1, out+1) + except Exception: out = None - if not self.ctx.transactions: + if not self.ctx.transactions: self.ctx.commit() return out - - def update(self, tables, where, vars=None, _test=False, **values): + + def update(self, tables, where, vars=None, _test=False, **values): """ Update `tables` with clause `where` (interpolated using `vars`) and setting `values`. @@ -822,19 +822,19 @@ class DB: where = self._where(where, vars) query = ( - "UPDATE " + sqllist(tables) + - " SET " + sqlwhere(values, ', ') + + "UPDATE " + sqllist(tables) + + " SET " + sqlwhere(values, ', ') + " WHERE " + where) if _test: return query - + db_cursor = self._db_cursor() self._db_execute(db_cursor, query) - if not self.ctx.transactions: + if not self.ctx.transactions: self.ctx.commit() return db_cursor.rowcount - - def delete(self, table, where, using=None, vars=None, _test=False): + + def delete(self, table, where, using=None, vars=None, _test=False): """ Deletes from `table` with clauses `where` and `using`. @@ -854,23 +854,23 @@ class DB: db_cursor = self._db_cursor() self._db_execute(db_cursor, q) - if not self.ctx.transactions: + if not self.ctx.transactions: self.ctx.commit() return db_cursor.rowcount def _process_insert_query(self, query, tablename, seqname): return query - def transaction(self): + def transaction(self): """Start a transaction.""" return Transaction(self.ctx) - -class PostgresDB(DB): + +class PostgresDB(DB): """Postgres driver.""" def __init__(self, **keywords): if 'pw' in keywords: keywords['password'] = keywords.pop('pw') - + db_module = import_driver(["psycopg2", "psycopg", "pgdb"], preferred=keywords.pop('driver', None)) if db_module.__name__ == "psycopg2": import psycopg2.extensions @@ -879,25 +879,25 @@ class PostgresDB(DB): # if db is not provided postgres driver will take it from PGDATABASE environment variable if 'db' in keywords: keywords['database'] = keywords.pop('db') - + self.dbname = "postgres" self.paramstyle = db_module.paramstyle DB.__init__(self, db_module, keywords) self.supports_multiple_insert = True self._sequences = None - + def _process_insert_query(self, query, tablename, seqname): if seqname is None: # when seqname is not provided guess the seqname and make sure it exists seqname = tablename + "_id_seq" if seqname not in self._get_all_sequences(): seqname = None - + if seqname: query += "; SELECT currval('%s')" % seqname - + return query - + def _get_all_sequences(self): """Query postgres to find names of all sequences used in this database.""" if self._sequences is None: @@ -909,13 +909,13 @@ class PostgresDB(DB): conn = DB._connect(self, keywords) conn.set_client_encoding('UTF8') return conn - + def _connect_with_pooling(self, keywords): conn = DB._connect_with_pooling(self, keywords) conn._con._con.set_client_encoding('UTF8') return conn -class MySQLDB(DB): +class MySQLDB(DB): def __init__(self, **keywords): import MySQLdb as db if 'pw' in keywords: @@ -931,7 +931,7 @@ class MySQLDB(DB): self.dbname = "mysql" DB.__init__(self, db, keywords) self.supports_multiple_insert = True - + def _process_insert_query(self, query, tablename, seqname): return query, SQLQuery('SELECT last_insert_id();') @@ -948,7 +948,7 @@ def import_driver(drivers, preferred=None): pass raise ImportError("Unable to import " + " or ".join(drivers)) -class SqliteDB(DB): +class SqliteDB(DB): def __init__(self, **keywords): db = import_driver(["sqlite3", "pysqlite2.dbapi2", "sqlite"], preferred=keywords.pop('driver', None)) @@ -957,17 +957,17 @@ class SqliteDB(DB): self.paramstyle = db.paramstyle keywords['database'] = keywords.pop('db') - self.dbname = "sqlite" + self.dbname = "sqlite" DB.__init__(self, db, keywords) def _process_insert_query(self, query, tablename, seqname): return query, SQLQuery('SELECT last_insert_rowid();') - + def query(self, *a, **kw): out = DB.query(self, *a, **kw) if isinstance(out, iterbetter): # rowcount is not provided by sqlite - def _nonzero(): + def _nonzero(): raise self.db_module.NotSupportedError("rowcount is not supported by sqlite") del out.__len__ out.__nonzero__ = _nonzero @@ -988,7 +988,7 @@ class FirebirdDB(DB): keywords['database'] = keywords['db'] del keywords['db'] DB.__init__(self, db, keywords) - + def delete(self, table, where=None, using=None, vars=None, _test=False): # firebird doesn't support using clause using=None @@ -1008,14 +1008,14 @@ class FirebirdDB(DB): class MSSQLDB(DB): def __init__(self, **keywords): - import pymssql as db + import pymssql as db if 'pw' in keywords: keywords['password'] = keywords.pop('pw') keywords['database'] = keywords.pop('db') self.dbname = "mssql" DB.__init__(self, db, keywords) - def sql_clauses(self, what, tables, where, group, order, limit, offset): + def sql_clauses(self, what, tables, where, group, order, limit, offset): return ( ('SELECT', what), ('TOP', limit), @@ -1024,14 +1024,14 @@ class MSSQLDB(DB): ('GROUP BY', group), ('ORDER BY', order), ('OFFSET', offset)) - + def _test(self): """Test LIMIT. Fake presence of pymssql module for running tests. >>> import sys >>> sys.modules['pymssql'] = sys.modules['sys'] - + MSSQL has TOP clause instead of LIMIT clause. >>> db = MSSQLDB(db='test', user='joe', pw='secret') >>> db.select('foo', limit=4, _test=True) @@ -1039,34 +1039,34 @@ class MSSQLDB(DB): """ pass -class OracleDB(DB): - def __init__(self, **keywords): - import cx_Oracle as db - if 'pw' in keywords: - keywords['password'] = keywords.pop('pw') +class OracleDB(DB): + def __init__(self, **keywords): + import cx_Oracle as db + if 'pw' in keywords: + keywords['password'] = keywords.pop('pw') - #@@ TODO: use db.makedsn if host, port is specified - keywords['dsn'] = keywords.pop('db') - self.dbname = 'oracle' - db.paramstyle = 'numeric' + #@@ TODO: use db.makedsn if host, port is specified + keywords['dsn'] = keywords.pop('db') + self.dbname = 'oracle' + db.paramstyle = 'numeric' self.paramstyle = db.paramstyle - # oracle doesn't support pooling - keywords.pop('pooling', None) - DB.__init__(self, db, keywords) + # oracle doesn't support pooling + keywords.pop('pooling', None) + DB.__init__(self, db, keywords) - def _process_insert_query(self, query, tablename, seqname): - if seqname is None: + def _process_insert_query(self, query, tablename, seqname): + if seqname is None: # It is not possible to get seq name from table name in Oracle return query else: - return query + "; SELECT %s.currval FROM dual" % seqname + return query + "; SELECT %s.currval FROM dual" % seqname _databases = {} def database(dburl=None, **params): """Creates appropriate database using params. - - Pooling will be enabled if DBUtils module is available. + + Pooling will be enabled if DBUtils module is available. Pooling can be disabled by passing pooling=False in params. """ dbn = params.pop('dbn') @@ -1079,12 +1079,12 @@ def register_database(name, clazz): """ Register a database. - >>> class LegacyDB(DB): - ... def __init__(self, **params): - ... pass + >>> class LegacyDB(DB): + ... def __init__(self, **params): + ... pass ... >>> register_database('legacy', LegacyDB) - >>> db = database(dbn='legacy', db='test', user='joe', passwd='secret') + >>> db = database(dbn='legacy', db='test', user='joe', passwd='secret') """ _databases[name] = clazz @@ -1095,7 +1095,7 @@ register_database('firebird', FirebirdDB) register_database('mssql', MSSQLDB) register_database('oracle', OracleDB) -def _interpolate(format): +def _interpolate(format): """ Takes a format string and returns a list of 2-tuples of the form (boolean, string) where boolean says whether string should be evaled @@ -1118,7 +1118,7 @@ def _interpolate(format): while 1: dollar = format.find("$", pos) - if dollar < 0: + if dollar < 0: break nextchar = format[dollar + 1] @@ -1129,9 +1129,9 @@ def _interpolate(format): match, pos = matchorfail(format, pos) tstart, tend = match.regs[3] token = format[tstart:tend] - if token == "{": + if token == "{": level = level + 1 - elif token == "}": + elif token == "}": level = level - 1 chunks.append((1, format[dollar + 2:pos - 1])) @@ -1148,18 +1148,18 @@ def _interpolate(format): match, pos = matchorfail(format, pos) tstart, tend = match.regs[3] token = format[tstart:tend] - if token[0] in "([": + if token[0] in "([": level = level + 1 - elif token[0] in ")]": + elif token[0] in ")]": level = level - 1 - else: + else: break chunks.append((1, format[dollar + 1:pos])) else: chunks.append((0, format[pos:dollar + 1])) pos = dollar + 1 + (nextchar == "$") - if pos < len(format): + if pos < len(format): chunks.append((0, format[pos:])) return chunks diff --git a/lib/pyulib/src/ulib/ext/web/debugerror.py b/lib/pyulib/src/ulib/ext/web/debugerror.py index 59b94d3..9edfd84 100644 --- a/lib/pyulib/src/ulib/ext/web/debugerror.py +++ b/lib/pyulib/src/ulib/ext/web/debugerror.py @@ -2,7 +2,7 @@ pretty debug errors (part of web.py) -portions adapted from Django +portions adapted from Django Copyright (c) 2005, the Lawrence Journal-World Used under the modified BSD license: http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5 @@ -38,11 +38,11 @@ $def with (exception_type, exception_value, frames) h2 span { font-size:80%; color:#666; font-weight:normal; } h3 { margin:1em 0 .5em 0; } h4 { margin:0 0 .5em 0; font-weight: normal; } - table { + table { border:1px solid #ccc; border-collapse: collapse; background:white; } tbody td, tbody th { vertical-align:top; padding:2px 3px; } - thead th { - padding:1px 6px 1px 3px; background:#fefefe; text-align:left; + thead th { + padding:1px 6px 1px 3px; background:#fefefe; text-align:left; font-weight:normal; font-size:11px; border:1px solid #ddd; } tbody th { text-align:right; color:#666; padding-right:.5em; } table.vars { margin:5px 0 2px 40px; } @@ -50,14 +50,14 @@ $def with (exception_type, exception_value, frames) table td.code { width:100%;} table td.code div { overflow:hidden; } table.source th { color:#666; } - table.source td { + table.source td { font-family:monospace; white-space:pre; border-bottom:1px solid #eee; } ul.traceback { list-style-type:none; } ul.traceback li.frame { margin-bottom:1em; } div.context { margin: 10px 0; } - div.context ol { + div.context ol { padding-left:30px; margin:0 10px; list-style-position: inside; } - div.context ol li { + div.context ol li { font-family:monospace; white-space:pre; color:#666; cursor:pointer; } div.context ol.context-line li { color:black; background-color:#ccc; } div.context ol.context-line li span { float: right; } @@ -79,7 +79,7 @@ $def with (exception_type, exception_value, frames)