Commit 0a5b7d4898b16b83d95ac49ee9e6e4ee07fd4c13
1 parent
e8bf858b
Exists in
master
and in
1 other branch
Fixing popcon file upload.
Showing
1 changed file
with
11 additions
and
3 deletions
Show diff stats
src/web/server.py
| ... | ... | @@ -68,10 +68,18 @@ class AppRecommender: |
| 68 | 68 | user_pkgs_list = request_info['pkgs_list'].encode('utf8').split() |
| 69 | 69 | print user_pkgs_list |
| 70 | 70 | |
| 71 | - if request_info.has_key('pkgs_file'): | |
| 71 | + if request_info['pkgs_file'].value: | |
| 72 | 72 | f = open(outputdir + "/packages_list", "wb") |
| 73 | - for line in request_info['pkgs_file'].file: | |
| 74 | - user_pkgs_list.append(line.split()[0]) | |
| 73 | + lines = request_info['pkgs_file'].file.readlines() | |
| 74 | + print lines | |
| 75 | + if lines[0].startswith('POPULARITY-CONTEST'): | |
| 76 | + del lines[0] | |
| 77 | + del lines[-1] | |
| 78 | + package_name_field = 2 | |
| 79 | + else: | |
| 80 | + package_name_field = 0 | |
| 81 | + for line in lines: | |
| 82 | + user_pkgs_list.append(line.split()[package_name_field]) | |
| 75 | 83 | f.write(line) |
| 76 | 84 | f.close() |
| 77 | 85 | ... | ... |