Edgewall Software
Modify

Opened 14 years ago

Closed 14 years ago

#9218 closed defect (fixed)

TypeError: not indexable

Reported by: Felix Schwarz <felix.schwarz@…> Owned by: Christian Boos
Priority: normal Milestone: plugin - spam-filter
Component: plugin/spamfilter Version: 0.12dev
Severity: critical Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

To re

Beim Ausführen der Operation POST auf '/attachment/ticket/9217' hat Trac einen internen Fehler gemeldet.

Anfrageparameter:

{'__FORM_TOKEN': u'....',
 'action': u'new',
 'attachment': FieldStorage('attachment', 'make_comment_optional', '# HG changeset patch\n# Parent e537b06a46f5f056403884222aabd177d5728263\n\ndiff -r e537b06a46f5 trac/ticket/model.py\n--- a/trac/ticket/model.py\tWed Oct 14 00:21:33 2009 +0200\n+++ b/trac/ticket/model.py\tSun Apr 11 15:50:40 2010 +0200\n@@ -234,7 +234,7 @@\n \n         return self.id\n \n-    def save_changes(self, author, comment, when=None, db=None, cnum=\'\'):\n+    def save_changes(self, author, comment=None, when=None, db=None, cnum=\'\'):\n         """\n         Store ticket changes in the database. The ticket must already exist in\n         the database.  Returns False if there were no changes to save, True\ndiff -r e537b06a46f5 trac/ticket/tests/model.py\n--- a/trac/ticket/tests/model.py\tWed Oct 14 00:21:33 2009 +0200\n+++ b/trac/ticket/tests/model.py\tSun Apr 11 15:50:40 2010 +0200\n@@ -123,6 +123,19 @@\n         self.assertEqual(ticket_id, ticket.id)\n         self.assertEqual(ticket.resource.id, ticket_id)\n \n+    def test_can_save_ticket_without_explicit_comment(self):\n+        ticket = Ticket(self.env)\n+        ticket.insert()\n+        ticket[\'summary\'] = \'another summary\'\n+        \n+        ticket.save_changes(\'foo\')\n+        \n+        changes = ticket.get_changelog()\n+        comment_change = filter(lambda change: change[2] == \'comment\', changes)[0]\n+        self.assertEqual(\'\', comment_change[3])\n+        self.assertEqual(\'\', comment_change[4])\n+\n+\n     def test_ticket_default_values(self):\n         """\n         Verify that a ticket uses default values specified in the configuration\n'),
 'author': u'Felix Schwarz <felix.schwarz@agile42.com>',
 'description': u'Make comment parameter optional',
 'id': u'9217',
 'path': u'9217',
 'realm': u'ticket'}

Systeminformationen

Trac 0.12dev-r9466
Babel 0.9.4
Docutils 0.6
Genshi 0.6dev-r1096
psycopg2 2.0.8
Pygments 1.2.2dev-20100224
Python 2.5.2 (r252:60911, Oct 5 2008, 19:29:17)
[GCC 4.3.2]
pytz 2010g
setuptools 0.6c9
Subversion 1.5.1 (r32289)
jQuery 1.4.2

Enabled Plugins

Python-Zurückverfolgungsinformationen

Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/trac/web/main.py", line 512, in _dispatch_request
    dispatcher.dispatch(req)
  File "build/bdist.linux-x86_64/egg/trac/web/main.py", line 233, in dispatch
    resp = chosen_handler.process_request(req)
  File "build/bdist.linux-x86_64/egg/trac/attachment.py", line 446, in process_request
    self._do_save(req, attachment)
  File "build/bdist.linux-x86_64/egg/trac/attachment.py", line 642, in _do_save
    attachment):
  File "build/bdist.linux-x86_64/egg/tracspamfilter/adapters.py", line 123, 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 (1)

0.11.2-release-notes.txt (997 bytes ) - added by anonymous 14 years ago.
test …

Download all attachments as: .zip

Change History (5)

comment:1 by Felix Schwarz <felix.schwarz@…>, 14 years ago

Actually this happened when I wanted to upload this patch for #9217:

# HG changeset patch
# Parent e537b06a46f5f056403884222aabd177d5728263

diff -r e537b06a46f5 trac/ticket/model.py
--- a/trac/ticket/model.py	Wed Oct 14 00:21:33 2009 +0200
+++ b/trac/ticket/model.py	Sun Apr 11 15:50:40 2010 +0200
@@ -234,7 +234,7 @@
 
         return self.id
 
-    def save_changes(self, author, comment, when=None, db=None, cnum=''):
+    def save_changes(self, author, comment=None, when=None, db=None, cnum=''):
         """
         Store ticket changes in the database. The ticket must already exist in
         the database.  Returns False if there were no changes to save, True
diff -r e537b06a46f5 trac/ticket/tests/model.py
--- a/trac/ticket/tests/model.py	Wed Oct 14 00:21:33 2009 +0200
+++ b/trac/ticket/tests/model.py	Sun Apr 11 15:50:40 2010 +0200
@@ -123,6 +123,19 @@
         self.assertEqual(ticket_id, ticket.id)
         self.assertEqual(ticket.resource.id, ticket_id)
 
+    def test_can_save_ticket_without_explicit_comment(self):
+        ticket = Ticket(self.env)
+        ticket.insert()
+        ticket['summary'] = 'another summary'
+        
+        ticket.save_changes('foo')
+        
+        changes = ticket.get_changelog()
+        comment_change = filter(lambda change: change[2] == 'comment', changes)[0]
+        self.assertEqual('', comment_change[3])
+        self.assertEqual('', comment_change[4])
+
+
     def test_ticket_default_values(self):
         """
         Verify that a ticket uses default values specified in the configuration

comment:2 by Christian Boos, 14 years ago

I should have tested r9462 a bit more. Sorry, fix coming soon.

comment:3 by Christian Boos, 14 years ago

Component: ticket systemplugin/spamfilter
Milestone: 0.12spam-filter-plugin
Owner: set to Christian Boos

by anonymous, 14 years ago

Attachment: 0.11.2-release-notes.txt added

test …

comment:4 by anonymous, 14 years ago

Resolution: fixed
Status: newclosed

Works ;-)

Fixed in r9467.

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.