Opened 5 years ago

Closed 18 months ago

#10677 closed defect (wontfix)

KeyError: ('add_domain', '_', 'N_', 'tag_')

Reported by: Ryan J Ollos Owned by:
Priority: normal Component: AnnouncerPlugin
Severity: normal Keywords: i18n compatibility
Cc: Trac Release: 0.11


When running the unit tests again r8130 of the trunk (which fail for other reasons such as Trac database compatibility), I see the following traceback:

Traceback (most recent call last):
  File "", line 87, in <module>
  File "/usr/lib/python2.7/distutils/", line 152, in setup
  File "/usr/lib/python2.7/distutils/", line 953, in run_commands
  File "/usr/lib/python2.7/distutils/", line 972, in run_command
  File "/home/user/Workspace/th9110-r8130/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/", line 137, in run
  File "/home/user/Workspace/th9110-r8130/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/", line 117, in with_project_on_sys_path
  File "/home/user/Workspace/th9110-r8130/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/command/", line 146, in run_tests
    testLoader = loader_class()
  File "/usr/lib/python2.7/unittest/", line 94, in __init__
  File "/usr/lib/python2.7/unittest/", line 149, in parseArgs
  File "/usr/lib/python2.7/unittest/", line 158, in createTests
  File "/usr/lib/python2.7/unittest/", line 128, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib/python2.7/unittest/", line 91, in loadTestsFromName
    module = __import__('.'.join(parts_copy))
  File "/home/user/Workspace/announcerplugin.git/announcer/tests/", line 24, in <module>
    from announcer.tests import (
  File "/home/user/Workspace/announcerplugin.git/announcer/tests/", line 20, in <module>
    from announcer.api import AnnouncementSystem, AnnouncementEvent
  File "/home/user/Workspace/announcerplugin.git/announcer/", line 351, in <module>
    domain_functions('announcer', ('add_domain', '_', 'N_', 'tag_'))
  File "/home/user/Workspace/th9110-r8130/trac-trunk-r8130/trac/util/", line 91, in domain_functions
    return [_functions[s] for s in symbols]
KeyError: ('add_domain', '_', 'N_', 'tag_')

The fix appears to be:

  • announcer/

    diff --git a/announcer/ b/announcer/
    index 69d315b..3c4b1e0 100644
    a b def istrue(value, otherwise=False): 
    349349    from trac.util.translation import domain_functions
    350350    add_domain, _, N_ , tag_= \
    351         domain_functions('announcer', ('add_domain', '_', 'N_', 'tag_'))
     351        domain_functions('announcer', 'add_domain', '_', 'N_', 'tag_')
    352352except ImportError:
    353353    from  genshi.builder         import  tag as tag_
    354354    from  trac.util.translation  import  gettext

It looks like the reason there is not an error in later versions of Trac is the addition to the top of the function to handle a tuple argument:

    if symbols and not isinstance(symbols[0], basestring):
        symbols = symbols[0]

So the modification to the function call may only be necessary for Trac 0.11 compatibility.

Attachments (0)

Change History (4)

comment:1 Changed 5 years ago by Steffen Hoffmann

Keywords: i18n compatibility added

I remember that change being made, and the new tuple form becoming the recommended invocation.

For Trac 0.11 this shouldn't be an issue, because all i18n is >= 0.12 only. Anyway, I'll have a look at it and deal with this issue after back-porting db API.

comment:2 Changed 5 years ago by Ryan J Ollos

Since you are in a try/except, you might be able to deal with the issue by catching KeyError. I briefly tried that and it wasn't working, but didn't dig deeper in why I was running into problems.

comment:3 Changed 18 months ago by Ryan J Ollos

Owner: Steffen Hoffmann deleted

comment:4 Changed 18 months ago by Ryan J Ollos

Resolution: wontfix
Status: newclosed

Wontfix since this is a 0.11 compatibility issue.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The ticket will remain with no owner.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.