Commit 2f37def660ad3f25eebac55a290d7c26fbb0e588
1 parent
2ecc4e78
Exists in
master
and in
1 other branch
Improving popup.
Showing
2 changed files
with
10 additions
and
7 deletions
Show diff stats
src/web/server.py
... | ... | @@ -5,6 +5,7 @@ from web import form |
5 | 5 | import tempfile |
6 | 6 | import sys |
7 | 7 | import simplejson as json |
8 | +import apt | |
8 | 9 | |
9 | 10 | sys.path.insert(0,"../") |
10 | 11 | |
... | ... | @@ -66,7 +67,6 @@ class Package: |
66 | 67 | json_data['r']['tag'] = tags |
67 | 68 | # formatting long description |
68 | 69 | json_data['r']['long_description'] = json_data['r']['long_description'].replace(' .\n','').replace('\n','<br />') |
69 | - print json_data['r']['long_description'] | |
70 | 70 | return render_plain.package(json_data['r']) |
71 | 71 | |
72 | 72 | def _debtags_list_to_dict(self, debtags_list): |
... | ... | @@ -134,7 +134,13 @@ class AppRecommender: |
134 | 134 | if request_info.has_key('strategy_hybrid_plus'): |
135 | 135 | strategies.append("hybrid_plus") |
136 | 136 | recommends = self._recommends(user_id,user_pkgs_list,strategies, int(request_info['limit'])) |
137 | - return render.apprec("/thanks", "post", recommends, FeedbackForm(strategies)) | |
137 | + ### Getting package summary (short description) ### | |
138 | + pkg_summaries = {} | |
139 | + cache = apt.Cache() | |
140 | + for strategy, result in recommends.items(): | |
141 | + for pkg in result: | |
142 | + pkg_summaries[pkg] = cache[pkg].candidate.summary | |
143 | + return render.apprec(recommends, pkg_summaries, FeedbackForm(strategies)) | |
138 | 144 | |
139 | 145 | # parsing json from screenshots - can be usefull in the future... |
140 | 146 | # def _packages_attrs(self, recommends): #recommends is result of _recommends() |
... | ... | @@ -150,9 +156,6 @@ class AppRecommender: |
150 | 156 | # recommended_pkgs_attrs[pkg_attrs_dict['name']] = pkg_attrs_dict |
151 | 157 | # return recommended_pkgs_attrs |
152 | 158 | |
153 | - def _get_pkg_attrs(self, pkg_name): | |
154 | - pass | |
155 | - | |
156 | 159 | def _recommends(self,user_id,user_pkgs_list,strategies,limit): |
157 | 160 | user = User(dict.fromkeys(user_pkgs_list,1),user_id) |
158 | 161 | user.maximal_pkg_profile() | ... | ... |
src/web/templates/apprec.html
1 | -$def with (action, method, recommends, form) | |
1 | +$def with (recommends, pkg_summaries, form) | |
2 | 2 | $var title: Feedback |
3 | 3 | $var mod = 'feedback'; |
4 | 4 | |
... | ... | @@ -37,7 +37,7 @@ $for strategy, result in recommends.items(): |
37 | 37 | |
38 | 38 | <div class="imgcaption"> |
39 | 39 | <a href="http://screenshots.debian.net/package/$pkg"> |
40 | - <p class="smaller">short description</p> | |
40 | + <p class="smaller">$pkg_summaries[pkg]</p> | |
41 | 41 | </div> |
42 | 42 | </td> |
43 | 43 | $if count == 5: | ... | ... |