From: Bernie Innocenti Date: Mon, 17 Aug 2009 17:32:31 +0000 (+0200) Subject: Update all macros to take 2 arguments (args, kvargs) X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=b61122d9783076d85b89b8a130127e3303eb4a73;p=geekigeeki.git Update all macros to take 2 arguments (args, kvargs) --- diff --git a/macros/CgiVar.py b/macros/CgiVar.py index 9199514..867bc87 100644 --- a/macros/CgiVar.py +++ b/macros/CgiVar.py @@ -1,4 +1,4 @@ -def _macro_CgiVar(argv): +def _macro_CgiVar(argv, kvargs): return { 'REMOTE_USER': remote_user(), 'REMOTE_HOST': get_hostname(remote_host()), diff --git a/macros/HttpGet.py b/macros/HttpGet.py index 7a4b548..391a144 100644 --- a/macros/HttpGet.py +++ b/macros/HttpGet.py @@ -1,6 +1,6 @@ -def _macro_HttpGet(argv): - if argv[1] in form: +def _macro_HttpGet(args, kvargs): + if args[1] in form: return form[argv[1]].value - elif len(argv) > 2: - return argv[2] # default value - return '' + elif len(args) > 2: + return args[2] # default value + raise Exception("Undefined argument " + args[1]) diff --git a/macros/HttpPost.py b/macros/HttpPost.py index ce61f79..b7037c1 100644 --- a/macros/HttpPost.py +++ b/macros/HttpPost.py @@ -1,6 +1,6 @@ -def _macro_HttpPost(argv): - if argv[1] in form: +def _macro_HttpPost(args, kvargs): + if args[1] in form: return form[argv[1]].value - elif len(argv) > 2: - return argv[2] # default value - return '' + elif len(args) > 2: + return args[2] # default value + raise Exception("Undefined argument " + args[1]) diff --git a/macros/TitleIndex.py b/macros/TitleIndex.py index 04d5019..7212f2b 100644 --- a/macros/TitleIndex.py +++ b/macros/TitleIndex.py @@ -1,4 +1,4 @@ -def _macro_TitleIndex(argv): +def _macro_TitleIndex(args, kvargs): s = make_index_key() pages = list(page_list()) pages.sort() diff --git a/macros/WordIndex.py b/macros/WordIndex.py index 6438d0b..10fb346 100644 --- a/macros/WordIndex.py +++ b/macros/WordIndex.py @@ -1,4 +1,4 @@ -def _macro_WordIndex(argv): +def _macro_WordIndex(args, kvargs): s = make_index_key() pages = list(page_list()) map = {}