Commit c0d1836f698ce7688653c6d4f0f6bfc9cca32a93

Authored by Tássia Camões Araújo
1 parent 745f2a4d
Exists in master and in 1 other branch add_vagrant

Rendering error message if the recommendation was not generated.

src/web/survey.py
... ... @@ -175,7 +175,7 @@ class Survey:
175 175 pkgs_list = [line.strip() for line in packages_list.readlines()]
176 176 request = Request(web_input,self.submissions_dir,user_id,pkgs_list)
177 177 if not request.validates():
178   - return render.error(request.errors)
  178 + return render.error_survey()
179 179 else:
180 180 user = User(dict.fromkeys(request.pkgs_list,1),request.user_id)
181 181 user.maximal_pkg_profile()
... ... @@ -206,7 +206,10 @@ class Survey:
206 206 pkg_summaries[pkg] = cache[pkg].candidate.summary
207 207 except:
208 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 214 def add_global_hook():
212 215 g = web.storage({"counter": "1"})
... ...
src/web/templates/error_survey.html 0 → 100644
... ... @@ -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" -->
... ...