From: Fredrik Tolf Date: Tue, 4 Jun 2013 13:24:01 +0000 (+0200) Subject: Merge branch 'master' into python3 X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=2a5a8ce70a0107b7bfd5bd3459ae4aae3a7558e2;p=wrw.git Merge branch 'master' into python3 Conflicts: wrw/util.py --- 2a5a8ce70a0107b7bfd5bd3459ae4aae3a7558e2 diff --cc wrw/util.py index eb27683,4306e9b..f70de0d --- a/wrw/util.py +++ b/wrw/util.py @@@ -1,20 -1,12 +1,21 @@@ - import inspect - from . import req, dispatch, session, form, resp + import inspect, math -import req, dispatch, session, form, resp, proto ++from . import req, dispatch, session, form, resp, proto def wsgiwrap(callable): def wrapper(env, startreq): return dispatch.handleenv(env, startreq, callable) + wrapper.__wrapped__ = callable return wrapper +def stringwrap(charset): + def dec(callable): + def wrapper(*args, **kwargs): + bk = callable(*args, **kwargs) + for string in bk: + yield string.encode(charset) + return wrapper + return dec + def formparams(callable): def wrapper(req): data = form.formdata(req)