diff roundup/cgi/templating.py @ 3893:1bf9a4b4de33

Cope with spam robots posting with multiple instances of the same form value. Details: http://psf.upfronthosting.co.za/roundup/meta/issue111
author Erik Forsberg <forsberg@users.sourceforge.net>
date Mon, 10 Sep 2007 19:30:27 +0000
parents b052820e86bf
children a90fa2e08a0a
line wrap: on
line diff
--- a/roundup/cgi/templating.py	Mon Sep 10 19:18:39 2007 +0000
+++ b/roundup/cgi/templating.py	Mon Sep 10 19:30:27 2007 +0000
@@ -2272,7 +2272,13 @@
         for name in ':search_text @search_text'.split():
             if self.form.has_key(name):
                 self.special_char = name[0]
-                self.search_text = self.form[name].value
+                try:
+                    self.search_text = self.form[name].value
+                except AttributeError:
+                    # http://psf.upfronthosting.co.za/roundup/meta/issue111
+                    # Multiple search_text, probably some kind of spambot.
+                    # Use first value.
+                    self.search_text = self.form[name][0].value
 
         # pagination - size and start index
         # figure batch args

Roundup Issue Tracker: http://roundup-tracker.org/