Edgewall Software
Modify

Opened 14 years ago

Closed 14 years ago

#9460 closed enhancement (fixed)

TypeError: not indexable

Reported by: anonymous Owned by: Christian Boos
Priority: high Milestone: plugin - spam-filter
Component: plugin/spamfilter Version: 0.12dev
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Как воспроизвести

При выполнении операции POST по /attachment/ticket/9183/, Trac выдает внутреннюю ошибку.

(просьба предоставить дополнительные подробности здесь)

Параметры запроса:

{'__FORM_TOKEN': u'7ae6a361ea2439c8a1dd6b15',
 'action': u'new',
 'attachment': FieldStorage('attachment', 'toc.htm', '<html xmlns="http://www.w3.org/1999/xhtml">\r\n<head>\r\n<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r\n<script src="js/displayToc.js"></script>\r\n<link rel="stylesheet" href="css/eacont.css" />\r\n</head>\r\n<body onload="tocInit()">\r\n</body>\r\n</html>'),
 'author': u'anonymous',
 'description': u'njr njr njr',
 'id': u'9183',
 'path': u'9183/',
 'realm': u'ticket'}

User agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4

Системная информация

Системная информация недоступна

Включенные плагины

Информация о плагинах недоступна

Python Traceback

Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/trac/web/main.py", line 513, in _dispatch_request
    dispatcher.dispatch(req)
  File "build/bdist.linux-x86_64/egg/trac/web/main.py", line 235, in dispatch
    resp = chosen_handler.process_request(req)
  File "build/bdist.linux-x86_64/egg/trac/attachment.py", line 448, in process_request
    self._do_save(req, attachment)
  File "build/bdist.linux-x86_64/egg/trac/attachment.py", line 655, in _do_save
    attachment):
  File "/usr/local/virtualenv/trunk/lib/python2.5/site-packages/TracSpamFilter-0.3.2dev_r9893-py2.5.egg/tracspamfilter/adapters.py", line 134, in validate_attachment
    if upload:
  File "/usr/lib/python2.5/cgi.py", line 633, in __len__
    return len(self.keys())
  File "/usr/lib/python2.5/cgi.py", line 609, in keys
    raise TypeError, "not indexable"
TypeError: not indexable

Attachments (0)

Change History (3)

comment:1 by Christian Boos, 14 years ago

Component: generalplugin/spamfilter
Milestone: next-major-0.1Xplugin - spam-filter
Owner: set to Christian Boos
Priority: normalhigh

Oops… reproduced.

Seems like the following fixes it:

  • tracspamfilter/adapters.py

     
    131131        filename = None
    132132        upload = req.args.get('attachment')
    133133        content = ''
    134         if upload:
     134        if upload is not None:
    135135            try:
    136136                data = upload.file.read(self.sample_size)
    137137                if not is_binary(data):

Strange though, as we had that change in the 0.11 version as well… Oh well, that was a known issue (r9467).

comment:2 by Christian Boos, 14 years ago

Fixed in r9920.

The fix for 'content' was already there, the check for is not None is nicer so I didn't backport r9467.

I'll nevertheless update the mergeinfo property so that we can see in source:/plugins/0.12/spam-filter-captcha if there are any changesets remaining on the 0.11 branch (eligible link).

comment:3 by Christian Boos, 14 years ago

Resolution: fixed
Status: newclosed

svn:mergeinfo properties are now correct in r9922.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.