Skip to content
Browse files

Tightened up sessions, added redirects and setting headers from dbpy

  • Loading branch information...
1 parent 5ef5de2 commit b28f0c0694a32a49e5a2d83b18038c6f2aae131c Louis Sobel committed Apr 18, 2012
Showing with 28 additions and 1 deletion.
  1. +1 −1 drapache/dbapiserver.py
  2. +23 −0 drapache/dbpybuiltins.py
  3. +1 −0 drapache/dbpyexecute.py
  4. +3 −0 requirements.txt
View
2 drapache/dbapiserver.py
@@ -63,7 +63,7 @@ def serve(self,path):
#first check if it doesn't end with a slash
if not path.endswith('/'):
redirect_location = path+'/'
- if self.query_string:
+ if self.request.query_string:
redirect_location += '?'+self.request.query_string
return ResponseObject(301,'redirect',headers={'Location':redirect_location})
View
23 drapache/dbpybuiltins.py
@@ -17,6 +17,8 @@
import dropbox
import os.path
+
+import markdown
import StringIO
@@ -231,6 +233,27 @@ def destroy_session():
session.destroy()
@register
+ def set_response_header(key,value):
+ response.set_header(key,value)
+
+ @register
+ def set_response_status(status):
+ response.status = status
+
+ @register
+ def redirect(where,immediately=True):
+ set_response_status(302)
+ set_response_header('Location',where)
+
+ if immediately:
+ die("redirecting")
+
+
+ @register
+ def markdown_to_html(markdown_string):
+ return markdown.markdown(markdown_string)
+
+ @register
def pretty_print(thingy,pre=True):
"""
Pretty prints the given thingy
View
1 drapache/dbpyexecute.py
@@ -18,6 +18,7 @@
import sandbox as pysandbox
from util import ResponseObject
import dbpybuiltins
+
import dbapiio
class Timeout(Exception):
View
3 requirements.txt
@@ -1,5 +1,8 @@
dropbox==1.3
-e git+git://github.com/haypo/pysandbox.git#egg=sandbox
+markdown
+beaker
+
### only needed if using mysql for the subdomain list
#Mysql-python

0 comments on commit b28f0c0

Please sign in to comment.
Something went wrong with that request. Please try again.