changeset 1:478d13061336

include a text input
author k0s <k0scist@gmail.com>
date Sat, 06 Feb 2010 19:00:32 -0500
parents 21ec6325ae0e
children c861518b2a44
files captchamiddleware/middleware.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/captchamiddleware/middleware.py
+++ b/captchamiddleware/middleware.py
@@ -59,15 +59,15 @@ class CAPTCHAmiddleware(LXMLMiddleware):
         # don't use CAPTCHAs for authorized users
         if request.remote_user:
             return tree 
 
         for element in tree.findall(".//form[@method='post']"):
             key = random.Random().randint(0, len(self.words))
             word = self.words[key]
             captcha = skimpyAPI.Pre(word).data()
-            string = '<div class="captcha">%s<input type="hidden" value="%s"/></div>' % (captcha, key)
+            string = '<div class="captcha">%s<input type="hidden" value="%s"/><input type="text" name="captcha"/></div>' % (captcha, key)
             addition = etree.fromstring(string)
             insertion_point = element.find('.' + self.path)
             insertion_point.addprevious(addition)
 
         return tree