Modify

Opened 11 years ago

Closed 7 years 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

Description

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

The fix appears to be:

  • announcer/api.py

    diff --git a/announcer/api.py b/announcer/api.py
    index 69d315b..3c4b1e0 100644
    a b def istrue(value, otherwise=False): 
    348348try:
    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 11 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 11 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 7 years ago by Ryan J Ollos

Owner: Steffen Hoffmann deleted

comment:4 Changed 7 years 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
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.