Commit 0c0b19a6313e012e8a61151db4f7a08c948da660
1 parent
dbac92b9
Exists in
master
and in
1 other branch
Fixed upload file
Showing
1 changed file
with
5 additions
and
10 deletions
Show diff stats
src/web/server.py
| ... | ... | @@ -77,19 +77,18 @@ class Package: |
| 77 | 77 | return debtags |
| 78 | 78 | |
| 79 | 79 | class Request: |
| 80 | - def __init__(self,web_input,user_id): | |
| 80 | + def __init__(self,web_input): | |
| 81 | + outputdir = tempfile.mkdtemp(prefix='',dir='./submissions/') | |
| 82 | + user_id = outputdir.lstrip('./submissions/') | |
| 81 | 83 | self.user_id = user_id |
| 82 | 84 | self.storage = web_input |
| 83 | 85 | |
| 84 | 86 | self.pkgs_list = [] |
| 85 | 87 | if web_input.has_key('pkgs_list'): |
| 86 | 88 | self.pkgs_list = web_input['pkgs_list'].encode('utf8').split() |
| 87 | - print self.pkgs_list | |
| 88 | - print web_input['pkgs_file'] | |
| 89 | - if web_input['pkgs_file']: | |
| 89 | + if web_input['pkgs_file'].value: | |
| 90 | 90 | f = open(outputdir + "/packages_list", "wb") |
| 91 | 91 | lines = web_input['pkgs_file'].file.readlines() |
| 92 | - print lines | |
| 93 | 92 | if lines[0].startswith('POPULARITY-CONTEST'): |
| 94 | 93 | del lines[0] |
| 95 | 94 | del lines[-1] |
| ... | ... | @@ -214,11 +213,7 @@ class RandomRequest(Request): |
| 214 | 213 | |
| 215 | 214 | class AppRecommender: |
| 216 | 215 | def POST(self): |
| 217 | - print "post",web.input() | |
| 218 | - outputdir = tempfile.mkdtemp(prefix='',dir='./submissions/') | |
| 219 | - user_id = outputdir.lstrip('./submissions/') | |
| 220 | - print web.input(pkgs_file={}) | |
| 221 | - request = Request(web.input(pkgs_file={}),user_id) | |
| 216 | + request = Request(web.input(pkgs_file={})) | |
| 222 | 217 | if not request.validates(): |
| 223 | 218 | return render.error(request.errors) |
| 224 | 219 | else: | ... | ... |