﻿id	summary	reporter	owner	description	type	status	priority	component	severity	resolution	keywords	cc	release
9092	TypeError: __call__() got an unexpected keyword argument 'link'	willg@…	hasienda	"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."	defect	closed	normal	AccountManagerPlugin	normal	fixed	i18n compatibility		0.11
