Modify

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#3944 closed defect (fixed)

NameError: global name 'sorted' is not defined

Reported by: richard.cross@… Owned by: Jeff Hammel
Priority: highest Component: TicketSubmitPolicyPlugin
Severity: blocker Keywords:
Cc: Trac Release: 0.11

Description

How to Reproduce

While doing a GET operation on /newticket, Trac issued an internal error.

This happened when I added the following to trac.ini:

[components] ticketsubmitpolicy.* = enabled

...

[ticket-submit-policy] policy1.condition = type is not defect policy1.excludes = version

More specifically, it's the two policy1... lines that cause the problem. I would enter the policy via the web interface, but this throws errors also (see ticket 3943)

User Agent was: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_5; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.20.1

System Information

Trac 0.11
Python 2.3.4 (#1, Dec 11 2007, 05:28:55)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-9)]
setuptools 0.6c8
SQLite 3.3.6
pysqlite 1.1.7
Genshi 0.5
Pygments 0.9
Subversion 1.1.4 (r13838)
jQuery: 1.2.3

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.3/site-packages/Trac-0.11-py2.3.egg/trac/web/main.py", line 423, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.3/site-packages/Trac-0.11-py2.3.egg/trac/web/main.py", line 219, in dispatch
    data, content_type)
  File "/usr/lib/python2.3/site-packages/Trac-0.11-py2.3.egg/trac/web/chrome.py", line 690, in render_template
    stream |= self._filter_stream(req, method, filename, stream, data)
  File "build/bdist.linux-x86_64/egg/genshi/core.py", line 128, in __or__
    __swig_getmethods__["size"] = _core.svn_dirent_t_size_get
  File "/usr/lib/python2.3/site-packages/Trac-0.11-py2.3.egg/trac/web/chrome.py", line 789, in inner
    data)
  File "/usr/lib/python2.3/site-packages/TicketSubmitPolicy-0.7-py2.3.egg/ticketsubmitpolicy/ticketsubmitpolicy.py", line 161, in filter_stream
    policies = self.parse()
  File "/usr/lib/python2.3/site-packages/TicketSubmitPolicy-0.7-py2.3.egg/ticketsubmitpolicy/ticketsubmitpolicy.py", line 108, in parse
    comparitors = sorted(self.comparitors.keys(), key=lambda x: len(x), reverse=True)
NameError: global name 'sorted' is not defined

Attachments (0)

Change History (5)

comment:1 Changed 16 years ago by Jeff Hammel

Priority: highhighest

really, you should upgrade to python 2.4 or greater, which would fix this problem. I'll see if there's an easy fix for 2.3 (which doesn't have sorted built-in)

comment:2 Changed 16 years ago by Jeff Hammel

Status: newassigned

comment:3 Changed 16 years ago by Jeff Hammel

Resolution: fixed
Status: assignedclosed

hopefully fixed with r4545

comment:4 in reply to:  3 Changed 16 years ago by Jeff Hammel

Replying to k0s:

hopefully fixed with r4545

...though still...please upgrade to python at least 2.4; i don't have much interest in doing extra work to support a version of python that is now 4 years old and precedes the life of my plugins

comment:5 Changed 16 years ago by anonymous

Yeah, the problem with Python is that I'm running Trac on a managed server that only uses packages distributed by YUM. The latest version of Python it provides is 2.3.4. I'll see if I can convince our hosting company to install Python 2.4 manually.

Modify Ticket

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