Commit c0d1836f698ce7688653c6d4f0f6bfc9cca32a93
1 parent
745f2a4d
Exists in
master
and in
1 other branch
Rendering error message if the recommendation was not generated.
Showing
2 changed files
with
25 additions
and
2 deletions
Show diff stats
src/web/survey.py
| @@ -175,7 +175,7 @@ class Survey: | @@ -175,7 +175,7 @@ class Survey: | ||
| 175 | pkgs_list = [line.strip() for line in packages_list.readlines()] | 175 | pkgs_list = [line.strip() for line in packages_list.readlines()] |
| 176 | request = Request(web_input,self.submissions_dir,user_id,pkgs_list) | 176 | request = Request(web_input,self.submissions_dir,user_id,pkgs_list) |
| 177 | if not request.validates(): | 177 | if not request.validates(): |
| 178 | - return render.error(request.errors) | 178 | + return render.error_survey() |
| 179 | else: | 179 | else: |
| 180 | user = User(dict.fromkeys(request.pkgs_list,1),request.user_id) | 180 | user = User(dict.fromkeys(request.pkgs_list,1),request.user_id) |
| 181 | user.maximal_pkg_profile() | 181 | user.maximal_pkg_profile() |
| @@ -206,7 +206,10 @@ class Survey: | @@ -206,7 +206,10 @@ class Survey: | ||
| 206 | pkg_summaries[pkg] = cache[pkg].candidate.summary | 206 | pkg_summaries[pkg] = cache[pkg].candidate.summary |
| 207 | except: | 207 | except: |
| 208 | pkg_summaries[pkg] = "" | 208 | pkg_summaries[pkg] = "" |
| 209 | - return render.survey(pkg_details, request) | 209 | + if pkg_details: |
| 210 | + return render.survey(pkg_details, request) | ||
| 211 | + else: | ||
| 212 | + return render.error_survey() | ||
| 210 | 213 | ||
| 211 | def add_global_hook(): | 214 | def add_global_hook(): |
| 212 | g = web.storage({"counter": "1"}) | 215 | g = web.storage({"counter": "1"}) |
| @@ -0,0 +1,20 @@ | @@ -0,0 +1,20 @@ | ||
| 1 | +$var title: Error | ||
| 2 | +$var mod = 'error'; | ||
| 3 | +$var cssfiles: static/css/facebox.css | ||
| 4 | +$var jsfiles: static/js/facebox.js | ||
| 5 | + | ||
| 6 | + | ||
| 7 | +<div id="maincontent"> | ||
| 8 | +<div class="innertube"> | ||
| 9 | + | ||
| 10 | +<center> | ||
| 11 | +<div class="index_include"> | ||
| 12 | + <h1>AppRecommender Survey</h1> | ||
| 13 | +<p>Unfortunately your request could not be proccessed.</p> | ||
| 14 | +<p>Please report this error along with the submitted <br />file to <a href="mailto:tassia@gamil.com">tassia@gmail.com</a>.</p> | ||
| 15 | +</center> | ||
| 16 | + | ||
| 17 | +</div> | ||
| 18 | + | ||
| 19 | +</div><!-- id="innertube" --> | ||
| 20 | +</div><!-- id="maincontent" --> |