changeset 8:59245309f054 tip

conform to modern version of lxmlmiddleware
author k0s <k0scist@gmail.com>
date Fri, 26 Feb 2010 15:40:56 -0500
parents 8d826c3fbb06
children
files captchamiddleware/middleware.py setup.py
diffstat 2 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/captchamiddleware/middleware.py
+++ b/captchamiddleware/middleware.py
@@ -70,21 +70,19 @@ class CAPTCHAmiddleware(LXMLMiddleware):
                 return exc.HTTPSeeOther(location=location)(environ, start_response)
             # TODO: set a cookie to record an error
             # stage 2: record form values from request.POST,
             # and reinsert them into the form so that users
             # don't hate me ;)
 
         return LXMLMiddleware.__call__(self, environ, start_response)
 
-    def manipulate(self, environ, tree):
+    def manipulate(self, request, response, tree):
         """manipulate the DOM; should return an etree._Element"""
 
-        request = Request(environ)
-
         # 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()
--- a/setup.py
+++ b/setup.py
@@ -2,17 +2,17 @@ from setuptools import setup, find_packa
 import sys, os
 
 # read the description from the file
 try:
     description = file(os.path.join(os.path.dirname(__file__), 'README.txt')).read()
 except:
     description = '' 
 
-version = "0.2"
+version = "0.3"
 
 setup(name='CAPTCHAmiddleware',
       version=version,
       description="put CAPTCHAs on forms",
       long_description=description,
       classifiers=[], # Get strings from http://www.python.org/pypi?%3Aaction=list_classifiers
       author='Jeff Hammel',
       author_email='k0scist@gmail.com',