comparison uploader/handlers.py @ 7:a8c60480fce0

make query_string argument more universal
author k0s <k0scist@gmail.com>
date Sun, 27 Dec 2009 18:45:28 -0500
parents d2990750e5d6
children 619516d8c9ff
comparison
equal deleted inserted replaced
6:d2990750e5d6 7:a8c60480fce0
27 form = """<html><body><form name="upload_form" method="post" enctype="multipart/form-data"> 27 form = """<html><body><form name="upload_form" method="post" enctype="multipart/form-data">
28 <input type="file" name="file"/><input type="submit" value="upload"/></form></body></html>""" 28 <input type="file" name="file"/><input type="submit" value="upload"/></form></body></html>"""
29 29
30 @classmethod 30 @classmethod
31 def match(cls, app, request): 31 def match(cls, app, request):
32 if app.query_string and (app.query_string not in request.GET):
33 return False
32 return request.method == 'GET' 34 return request.method == 'GET'
33 35
34 def __call__(self): 36 def __call__(self):
35 return Response(content_type='text/html', body=self.form) 37 return Response(content_type='text/html', body=self.form)
36 38
60 62
61 class SubpathGet(Get): 63 class SubpathGet(Get):
62 64
63 @classmethod 65 @classmethod
64 def match(cls, app, request): 66 def match(cls, app, request):
65 if request.method != 'GET': 67 if not Get.match(cls, app, request):
66 return False
67 if app.query_string and (app.query_string not in request.GET):
68 return False 68 return False
69 _path = path(app.directory, request) 69 _path = path(app.directory, request)
70 if os.path.exists(_path) and os.path.isdir(_path): 70 if os.path.exists(_path) and os.path.isdir(_path):
71 return True 71 return True
72 72