Edgewall Software
Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#9657 closed defect (fixed)

I get "NameError: global name 'any' is not defined" when adding new repository.

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 0.12.1
Component: admin/web Version: 0.12-stable
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:

Description

I get the below error when I add new repository in "Manage Repositoies" page with CentOS 5.5 and python 2.4.3.

2010-10-01 20:24:46,474 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
  File "/home/jun66j5/src/trac.git/trac/web/main.py", line 511, in _dispatch_request
    dispatcher.dispatch(req)
  File "/home/jun66j5/src/trac.git/trac/web/main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "/home/jun66j5/src/trac.git/trac/admin/web_ui.py", line 116, in process_request
    path_info)
  File "/home/jun66j5/src/trac.git/trac/versioncontrol/admin.py", line 255, in render_admin_panel
    elif self._check_dir(req, dir):
  File "/home/jun66j5/src/trac.git/trac/versioncontrol/admin.py", line 346, in _check_dir
    if prefixes and not any(is_path_below(dir, prefix)
NameError: global name 'any' is not defined

It should use trac.util.compact.any with python 2.4.

  • trac/versioncontrol/admin.py

    diff --git a/trac/versioncontrol/admin.py b/trac/versioncontrol/admin.py
    index fcb1369..513b164 100644
    a b from trac.config import _TRUE_VALUES, ListOption  
    2121from trac.core import *
    2222from trac.perm import IPermissionRequestor
    2323from trac.util import is_path_below
     24from trac.util.compat import any
    2425from trac.util.text import breakable_path, normalize_whitespace, print_table, \
    2526                           printout
    2627from trac.util.translation import _, ngettext, tag_
Trac 0.12.1dev
Babel 0.9.5
Genshi 0.6
Pygments 1.1.1
pysqlite 2.3.3
Python 2.4.3 (#1, Sep 3 2009, 15:37:12) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]
pytz 2010h
setuptools 0.6
SQLite 3.3.6
Subversion 1.6.12 (r955767)
jQuery 1.4.2

Attachments (0)

Change History (7)

comment:1 by Christian Boos, 9 years ago

Just in time for the rc1, thanks!

comment:2 by Remy Blank, 9 years ago

Resolution: fixed
Status: newclosed

Good catch, thanks! Patch applied in [10155].

comment:3 by Remy Blank, 9 years ago

Owner: set to Jun Omae

comment:4 by Christian Boos, 9 years ago

I verified it was the only occurrence (and also no problem for all).

comment:5 by Remy Blank, 9 years ago

To prevent future breakage, we could push any() and all() into __builtin__ if they aren't there already.

comment:6 by osimons, 9 years ago

Please don't assume that Trac is the only code running in a process, and avoid any magic that extends beyond the confines of the trac namespace.

comment:7 by Remy Blank, 9 years ago

I hadn't thought of that. Ok, bad idea, then :)

Modify Ticket

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