changeset 7:c576f5877459

* fix resolution for bad urls; * change URL post to get
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 19 Nov 2011 18:19:13 -0800
parents ffe01043ecea
children f53171b2acf4
files setup.py wordstream/handlers.py wordstream/templates/post.html
diffstat 3 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Tue Dec 21 18:07:15 2010 -0800
+++ b/setup.py	Sat Nov 19 18:19:13 2011 -0800
@@ -7,7 +7,7 @@
 except:
     description = ""
 
-version = "0.1.1"
+version = "0.1.2"
 
 setup(name='wordstream',
       version=version,
--- a/wordstream/handlers.py	Tue Dec 21 18:07:15 2010 -0800
+++ b/wordstream/handlers.py	Sat Nov 19 18:19:13 2011 -0800
@@ -53,7 +53,7 @@
         return '/'.join(path)
 
     def redirect(self, location):
-        raise exc.HTTPSeeOther(location=location)
+        return exc.HTTPSeeOther(location=location)
 
 class GenshiHandler(Handler):
 
@@ -147,7 +147,10 @@
 
     def Get(self):
         if 'url' in self.request.GET:
-            contents = self.url_contents(self.request.GET['url'])
+            try:
+                contents = self.url_contents(self.request.GET['url'])
+            except:
+                return GenshiHandler.Get(self)
             dissociation = self.dissociation(contents)
             return Response(content_type='text/html',
                             body='<html><body>%s</body></html>' % dissociation)
@@ -168,7 +171,10 @@
 
     def Post(self):
         if 'url' in self.request.POST:
-            contents = self.url_contents(self.request.POST['url'])
+            try:
+                contents = self.url_contents(self.request.POST['url'])
+            except:
+                return GenshiHandler.Get(self)
         elif 'text' in self.request.POST:
             contents = self.request.POST['text']
         elif 'file' in self.request.POST:
--- a/wordstream/templates/post.html	Tue Dec 21 18:07:15 2010 -0800
+++ b/wordstream/templates/post.html	Sat Nov 19 18:19:13 2011 -0800
@@ -15,10 +15,10 @@
 <input type="submit" value="Dissociate"/>
 </form>
 
-<form method="post">
+<form method="get">
 or point to a URL
 <input type="text" name="url"/>
 <input type="submit" value="Dissociate"/>
 </form>
 </body>
-</html>
\ No newline at end of file
+</html>