Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#11539 closed defect (fixed)

Skipping "themeengine.admin" with Trac 0.12.x

Reported by: Jun Omae Owned by: Olemis Lang
Priority: normal Component: ThemeEnginePlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

I think the plugin should work with Trac 0.12.x or create themeengineplugin/0.12 branch.

If you want to work with Trac 0.12.x, the following would help you. source:tracworkflowadminplugin/0.12/tracworkflowadmin/web_ui.py@13611#L35.

2014-02-03 14:37:26,035 Trac[loader] ERROR: Skipping "themeengine.admin = themeengine.admin":
Traceback (most recent call last):
  File "/home/jun66j5/venv/trac/0.12.5/lib/python2.4/site-packages/trac/loader.py", line 68, in _load_eggs
    entry.load(require=True)
  File "/home/jun66j5/venv/trac/0.12.5/lib/python2.4/site-packages/distribute-0.6.15-py2.4.egg/pkg_resources.py", line 1954, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/home/jun66j5/src/trac/trac-hacks/themeengineplugin/trunk/themeengine/admin.py", line 21, in ?
    from themeengine.api import ThemeEngineSystem, ThemeNotFound
  File "/home/jun66j5/src/trac/trac-hacks/themeengineplugin/trunk/themeengine/api.py", line 88, in ?
    class ThemeEngineSystem(Component):
  File "/home/jun66j5/src/trac/trac-hacks/themeengineplugin/trunk/themeengine/api.py", line 93, in ThemeEngineSystem
    doc_domain='themeengine')
TypeError: __init__() got an unexpected keyword argument 'doc_domain'

Attachments (0)

Change History (10)

comment:1 Changed 10 years ago by Olemis Lang

Status: newassigned

I cannot accept the ticket

/me working on it ...

comment:2 Changed 10 years ago by Olemis Lang

In 13639:

ThemeEnginePlugin [ refs #11539 ] : Only specify doc options for Trac>=1.0 , do not crash on Trac=0.12

comment:3 Changed 10 years ago by Olemis Lang

@jun66j5 : could you please report if everything is back to normal now ?

comment:4 Changed 10 years ago by Jun Omae

I tried the latest. That issue goes away. But another issue on Trac 0.12.5 with Python 2.4.

  File "/home/jun66j5/src/trac/trac-hacks/themeengineplugin/trunk/themeengine/translation.py", line 27
     if trac_version[:2] >= (1, 0) else {}
      ^
SyntaxError: invalid syntax (translation.py, line 27)
  • themeengine/translation.py

     
    99
    1010"""Translation functions and classes."""
    1111
     12from pkg_resources import parse_version
     13
    1214from trac import __version__ as trac_version
    1315from trac.util.translation import domain_functions
    1416
    15 trac_version = tuple(int(x) for x in trac_version.split()
    16                             if x[0] in '0123456789')
    17 
    1817#------------------------------------------------------
    1918#    Internationalization
    2019#------------------------------------------------------
     
    2322   domain_functions('themeengine', ('_', 'ngettext', 'tag_', 'tagn_',
    2423                                'gettext', 'N_', 'add_domain'))
    2524
    26 I18N_DOC_OPTIONS = dict(doc_domain='themeengine') \
    27                        if trac_version[:2] >= (1, 0) else {}
    28 
     25I18N_DOC_OPTIONS = {}
     26if parse_version(trac_version) >= parse_version('1.0'):
     27    I18N_DOC_OPTIONS['doc_domain'] = 'themeengine'

Also extract_messages command extracts no translation messages.

$ ~/venv/trac/1.0.1/bin/python setup.py extract_messages
running extract_messages
writing PO template file to themeengine/locale/messages.pot
$ msgfmt -v themeengine/locale/messages.pot
0 translated messages.
  • setup.py

     
    2626            }),
    2727        ]
    2828        extra['message_extractors'] = {
    29             'bhdashboard': extractors,
     29            'themeengine': extractors,
    3030        }
    3131except ImportError:
    3232    pass

After the above patch, 14 messages would be extracted.

$ ~/venv/trac/1.0.1/bin/python setup.py extract_messages
running extract_messages
extracting messages from themeengine/__init__.py
extracting messages from themeengine/admin.py
extracting messages from themeengine/api.py
extracting messages from themeengine/translation.py
extracting messages from themeengine/web_ui.py
extracting messages from themeengine/templates/admin_theme.html
extracting messages from themeengine/templates/admin_theme_advanced.html
extracting messages from themeengine/templates/admin_theme_custom.html
extracting messages from themeengine/tests/__init__.py
extracting messages from themeengine/tests/api.py
writing PO template file to themeengine/locale/messages.pot
$ msgfmt -v themeengine/locale/messages.pot
0 translated messages, 14 untranslated messages.

comment:5 in reply to:  4 ; Changed 10 years ago by Olemis Lang

Replying to jun66j5:

I tried the latest. That issue goes away. But another issue on Trac 0.12.5 with Python 2.4.

  File "/home/jun66j5/src/trac/trac-hacks/themeengineplugin/trunk/themeengine/translation.py", line 27
     if trac_version[:2] >= (1, 0) else {}
      ^
SyntaxError: invalid syntax (translation.py, line 27)

Should we still support such an old version of Python ? ... anyway it's a simple improvement . I'll fix that .

[... patch (themeengine/translation.py) ...]

... yeah this is a much better solution , I did not know exactly how to deal with version numbers and suffices like dev ...

Also extract_messages command extracts no translation messages.

[...]

my big mistake , sorry .

Thanks for the review !

comment:6 Changed 10 years ago by Olemis Lang

Resolution: fixed
Status: assignedclosed

In 13640:

ThemeEnginePlugin [ fixes #11539 ] : Fix regression introduced in [13639] regarding support for Python 2.4 (see comment:4:ticket:11539)

comment:7 Changed 10 years ago by Olemis Lang

In 13641:

ThemeEnginePlugin [ refs #11455 & #11539 ] : Oops ... use themeengine i18n domain in setup.py extractors (see comment:4:ticket:11539)

comment:8 in reply to:  5 ; Changed 10 years ago by Jun Omae

Should we still support such an old version of Python ? ... anyway it's a simple improvement . I'll fix that .

Trac 0.12.x supports Python 2.4. Python in RHEL/CentOS 5 is 2.4 and the distributions are maintained. Python 2.4 is old version but that is normally used.

If a plugin supports Trac 0.12 and it isn't difficult to support Python 2.4, I think it must work on Python 2.4.

If a plugin doesn't support Python 2.4 and I need it, I probably will fork it. e.g. https://github.com/jun66j5/pygit2/tree/master-py24 (pygit2 requires 2.6+).

comment:9 in reply to:  8 Changed 10 years ago by Olemis Lang

Replying to jun66j5:

Should we still support such an old version of Python ? ... anyway it's a simple improvement . I'll fix that .

Trac 0.12.x supports Python 2.4. Python in RHEL/CentOS 5 is 2.4 and the distributions are maintained. Python 2.4 is old version but that is normally used.

If a plugin supports Trac 0.12 and it isn't difficult to support Python 2.4, I think it must work on Python 2.4.

If a plugin doesn't support Python 2.4 and I need it, I probably will fork it. e.g. https://github.com/jun66j5/pygit2/tree/master-py24 (pygit2 requires 2.6+).

It's ok then . I'll take that into account from now on .

comment:10 Changed 10 years ago by Olemis Lang

In 13644:

ThemeEnginePlugin [ refs #11539 ]: Oops ... Fix syntax error in translation.py (missing colon)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Olemis Lang.
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.