Opened 13 years ago
Closed 13 years ago
#9092 closed defect (fixed)
TypeError: __call__() got an unexpected keyword argument 'link'
Reported by: | Owned by: | Steffen Hoffmann | |
---|---|---|---|
Priority: | normal | Component: | AccountManagerPlugin |
Severity: | normal | Keywords: | i18n compatibility |
Cc: | Trac Release: | 0.11 |
Description
I'm using Trac 0.11.7 in Debian testing and also AccountManagerPlugin r10593 (same happens with the current stable, too).
After a user registers a new account, he/she is brought to a page where he/she can log in. If the user fills out the login form correctly, then he/she is brought to /prefs/admin which kicks up this error:
2011-08-13 16:32:38,752 Trac[main] ERROR: Internal Server Error: Traceback (most recent call last): File "/usr/lib/python2.6/dist-packages/trac/web/main.py", line 450, in _dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.6/dist-packages/trac/web/main.py", line 217, in dispatch self._post_process_request(req, *resp) File "/usr/lib/python2.6/dist-packages/trac/web/main.py", line 309, in _post_process_request resp = f.post_process_request(req, *resp) File "build/bdist.linux-i686/egg/acct_mgr/web_ui.py", line 882, in post_process_request email=email, link=link)))) TypeError: __call__() got an unexpected keyword argument 'link'
I'm using Trac 0.11 and at the top of AccountManagerPlugin api.py, it imports tag_ differently depending on whether trac.util.translation exists. Trac 0.11 doesn't have trac.util.translations.domain_functions, so tag_ ends up coming from Genshi.builder.tag . I'm pretty sure that tag doesn't take keyword arguments:
from genshi.builder import tag tag("foo")
<Fragment>
tag("foo %{bar}s", bar="bar")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: call() got an unexpected keyword argument 'bar'
I don't know how Trac 0.12 works, but this is a compatibility issue. I fixed it (poorly) like this:
Index: api.py =================================================================== --- api.py (revision 10594) +++ api.py (working copy) @@ -25,7 +25,7 @@ 'ngettext', 'tag_')) dgettext = None except ImportError: - from genshi.builder import tag as tag_ + from genshi.builder import tag as genshitag from trac.util.translation import gettext _ = gettext N_ = lambda text: text @@ -44,6 +44,10 @@ except KeyError: pass return string + def tag_(s, **kwargs): + if kwargs: + return genshitag(s % kwargs) + return genshitag(s) from acct_mgr.hashlib_compat import md5
Pretty sure that screws up localization, but I hope it makes the problem clearer.
Attachments (0)
Change History (6)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
Bah... I thought I was using Debian testing--but that's a different server. This server is Debian stable. Debian stable has Trac 0.11.7.
comment:3 Changed 13 years ago by
Keywords: | i18n compatibility added |
---|---|
Status: | new → assigned |
Similar issues have surfaced several times within the last months. So I'm sure that we'll just not use tag_()
once again.
comment:4 Changed 13 years ago by
(In [10596]) AccountManagerPlugin: Fix compatibility with Trac 0.11 once again, refs #8684 and #9092.
Replace tag_
call to prevent TypeError
in Genshi used by any Trac 0.11
release.
comment:5 Changed 13 years ago by
(In [10597]) AccountManagerPlugin: Change another critical occurrence of tag_()
, refs #9090 and #9092.
comment:6 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
(In [10618]) AccountManagerPlugin: Publish maintenance release 0.3.2, closes #9051, #9082, #9088, #9091, #9092, #9093, #9095, #9099, #9107, #9108 and #9109.
This is an update for current stable at 0.3.1 with a number of fixes for issues reported within the last weeks.
While they will go into acct_mgr-0.4 too, current code isn't ready for release yet and will introduce a number of backwards-incompatible changes. So don't hurry for acct_mgr-0.4 right now.
Just noticed what I'd call a bug in signatures.py
and removed unreasonable
dependency on identical absolute path for successful check.
Looks like nobody else tried this by now, right? Hey folks!
I screwed up the runtime example of Genshi tag. Here it is again in better formatting: