__all__ = ["wsgiwrap", "restart", "cookie", "formdata"]
from . import proto
-from .util import wsgiwrap, formparams, persession, sessiondata, autodirty, manudirty
+from .util import wsgiwrap, stringwrap, formparams, persession, sessiondata, autodirty, manudirty
from .dispatch import restart
from . import cookie
from .form import formdata
return dispatch.handle(req.origrequest(env), startreq, 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)