aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPriit Laes <plaes@plaes.org>2010-08-03 11:32:31 +0300
committerPriit Laes <plaes@plaes.org>2010-08-03 11:32:31 +0300
commit726df4817d6e4fa881e869b24228a61372c2f9fb (patch)
treeadc5ee50a1992575d35a897c98edb8501afa3edd
parentUpdate portage syncer to use new API (diff)
downloadgsoc2010-grumpy-726df4817d6e4fa881e869b24228a61372c2f9fb.tar.gz
gsoc2010-grumpy-726df4817d6e4fa881e869b24228a61372c2f9fb.tar.bz2
gsoc2010-grumpy-726df4817d6e4fa881e869b24228a61372c2f9fb.zip
Port webapp to new model layout
-rw-r--r--grumpy/templates/browse_pkg.html8
-rw-r--r--grumpy/templates/index.html2
-rw-r--r--grumpy/webapp.py17
3 files changed, 15 insertions, 12 deletions
diff --git a/grumpy/templates/browse_pkg.html b/grumpy/templates/browse_pkg.html
index 80d803d..3479976 100644
--- a/grumpy/templates/browse_pkg.html
+++ b/grumpy/templates/browse_pkg.html
@@ -1,11 +1,11 @@
{% extends "layout.html" %}
-{% block title %}Browsing package "{{ cat | e }}/{{pkg.pkg | e}}"{% endblock %}
+{% block title %}Browsing package "{{ pkg.key | e}}"{% endblock %}
{% block body %}
-<h3>Browsing package "{{ cat | e }}/{{ pkg.pkg | e }}" - {{ pkg.ebuilds | length }} ebuild(s):</h3>
+<h3>Browsing package "{{ pkg.key | e }}" - {{ pkg.ebuilds | length }} ebuild(s):</h3>
<ul>
<li><a href="{{ url_for('browse_cat', cat=cat) }}">..</a></li>
- {% for ebuild in pkg.ebuilds %}
- <li>{{ ebuild.fullver | e }}</li>
+ {% for ebuild in pkg.ebuilds.values() %}
+ <li>{{ ebuild.cpv | e }}</li>
{% endfor %}
</ul>
{% if qa %}
diff --git a/grumpy/templates/index.html b/grumpy/templates/index.html
index 15f99bf..c013b7e 100644
--- a/grumpy/templates/index.html
+++ b/grumpy/templates/index.html
@@ -4,7 +4,7 @@
{% if cats %}
<ul>
{% for cat in cats %}
- <li><a href="{{ url_for('browse_cat', cat=cat.cat) }}">{{ cat.cat | e }}</a></li>
+ <li><a href="{{ url_for('browse_cat', cat=cat.name) }}">{{ cat.name| e }}</a></li>
{% endfor %}
</ul>
{% else %}
diff --git a/grumpy/webapp.py b/grumpy/webapp.py
index f416c05..3973236 100644
--- a/grumpy/webapp.py
+++ b/grumpy/webapp.py
@@ -28,13 +28,14 @@ def before_request():
@app.route('/')
@app.route('/browse/')
def index():
- cats = Category.query.order_by(Category.cat.asc()).all()
+ cats = Category.query.order_by(Category.name.asc()).all()
return render_template('index.html', cats=cats)
@app.route('/browse/<cat>/')
def browse_cat(cat):
if cat:
- pkgs = Package.query.filter_by(cat=cat) \
+ c = Category.query.filter_by(name=cat).first()
+ pkgs = Package.query.filter_by(category=c) \
.order_by(Package.pkg.asc()).all()
if pkgs:
return render_template('browse_cat.html', cat=cat, pkgs=pkgs)
@@ -44,11 +45,13 @@ def browse_cat(cat):
@app.route('/browse/<cat>/<pkg>/')
def browse_pkg(cat, pkg):
if cat and pkg:
- package = Package.query.filter_by(cat=cat) \
- .filter_by(pkg=pkg).first()
- if package:
- return render_template('browse_pkg.html', cat=cat, pkg=package, \
- qa=package.qaissues)
+ c = Category.query.filter_by(name=cat).first()
+ if c:
+ package = Package.query.filter_by(category=c) \
+ .filter_by(pkg=pkg).first()
+ if package:
+ return render_template('browse_pkg.html', cat=cat,
+ pkg=package, qa=package.qaissues)
flash('Package "%s/%s" does not exist' % (cat, pkg))
return redirect(url_for('browse_cat', cat=cat))