Hello Samuele,
> call me dumb, but I keep getting errors (TypeError: 'NoneType' object
> is not iterable). I've even compared the current
> SimulatedModPythonRequest from git with 1.1.0, and there is nothing
> relevat, to my eyes.
The attached patch relative to maint-1.1 fixes my troubles, although I
don't fully understand the causes. What do you think?
Thanks,
Ferran
WebStyle: provide mp_legacy_publisher_path fallback arguments
Catch empty expected_args or expected_defaults are empty and turn them to
empty lists, so SimulatedModPythonRequest doesn't fail.
---
modules/webstyle/lib/webinterface_handler_wsgi.py | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/modules/webstyle/lib/webinterface_handler_wsgi.py b/modules/webstyle/lib/webinterface_handler_wsgi.py
index 477b0b5..8aed582 100644
--- a/modules/webstyle/lib/webinterface_handler_wsgi.py
+++ b/modules/webstyle/lib/webinterface_handler_wsgi.py
@@ -678,8 +678,14 @@ def mp_legacy_publisher(req, possible_module, possible_handler):
except TypeError, err:
if ("%s() got an unexpected keyword argument" % possible_handler) in str(err) or ('%s() takes at least' % possible_handler) in str(err):
inspected_args = inspect.getargspec(module_globals[possible_handler])
- expected_args = list(inspected_args[0])
- expected_defaults = list(inspected_args[3])
+ try:
+ expected_args = list(inspected_args[0])
+ except TypeError:
+ expected_args = []
+ try:
+ expected_defaults = list(inspected_args[3])
+ except TypeError:
+ expected_defaults = []
expected_args.reverse()
expected_defaults.reverse()
register_exception(req=req, prefix="Wrong GET parameter set in calling a legacy publisher handler for %s: expected_args=%s, found_args=%s" % (possible_handler, repr(expected_args), repr(req.form.keys())), alert_admin=CFG_DEVEL_SITE)