[csw-devel] SF.net SVN: gar:[13233] csw/mgar/gar/v2/lib/web
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Tue Feb 8 11:08:54 CET 2011
Revision: 13233
http://gar.svn.sourceforge.net/gar/?rev=13233&view=rev
Author: wahwah
Date: 2011-02-08 10:08:54 +0000 (Tue, 08 Feb 2011)
Log Message:
-----------
pkgdb-web: Error tags available to browse
A little bit of lower-level SQLObject use allowed to list all error tags even
though there's no dedicated error tag name class.
Modified Paths:
--------------
csw/mgar/gar/v2/lib/web/pkgdb_web.py
csw/mgar/gar/v2/lib/web/templates/ErrorTagList.html
csw/mgar/gar/v2/lib/web/templates/index.html
Added Paths:
-----------
csw/mgar/gar/v2/lib/web/templates/CatalognameList.html
csw/mgar/gar/v2/lib/web/templates/ErrorTagDetail.html
Modified: csw/mgar/gar/v2/lib/web/pkgdb_web.py
===================================================================
--- csw/mgar/gar/v2/lib/web/pkgdb_web.py 2011-02-08 09:01:58 UTC (rev 13232)
+++ csw/mgar/gar/v2/lib/web/pkgdb_web.py 2011-02-08 10:08:54 UTC (rev 13233)
@@ -10,6 +10,7 @@
from lib.python import pkgdb
from lib.python import checkpkg_lib
import datetime
+from sqlobject import sqlbuilder
urls = (
r'/', 'index',
@@ -22,7 +23,10 @@
r'/maintainers/(\d+)/', 'MaintainerDetail',
r'/maintainers/(\d+)/checkpkg/', 'MaintainerCheckpkgReport',
r'/error-tags/', 'ErrorTagList',
+ r'/error-tags/([^/]+)/', 'ErrorTagDetail',
+ r'/catalognames/', 'CatalognameList',
r'/catalognames/([^/]+)/', 'Catalogname',
+ r'/error-tags/', 'ErrorTagList',
r'/rest/catalogs/([^/]+)/([^/]+)/([^/]+)/', 'Catalogs',
r'/rest/catalogs/([^/]+)/([^/]+)/([^/]+)/pkgname-by-filename',
'PkgnameByFilename',
@@ -94,6 +98,22 @@
raise web.notfound()
+class CatalognameList(object):
+ def GET(self):
+ ConnectToDatabase()
+ try:
+ connection = models.Srv4FileStats._connection
+ rows = connection.queryAll(connection.sqlrepr(
+ sqlbuilder.Select(
+ [models.Srv4FileStats.q.catalogname],
+ distinct=True,
+ where=(models.Srv4FileStats.q.use_to_generate_catalogs==True),
+ orderBy=models.Srv4FileStats.q.catalogname)))
+ return render.CatalognameList(rows)
+ except sqlobject.main.SQLObjectNotFound, e:
+ raise web.notfound()
+
+
class Srv4DetailFiles(object):
def GET(self, md5_sum):
ConnectToDatabase()
@@ -170,13 +190,23 @@
return render.MaintainerCheckpkgReport(maintainer, pkgs, tags_by_md5)
+class ErrorTagDetail(object):
+ def GET(self, tag_name):
+ ConnectToDatabase()
+ # TODO: Select only tags of registered packages
+ tags = models.CheckpkgErrorTag.selectBy(tag_name=tag_name)
+ return render.ErrorTagDetail(tag_name, tags)
+
class ErrorTagList(object):
def GET(self):
ConnectToDatabase()
- # Find all tag names
- # tag_names = models.CheckpkgErrorTag.select().distinct()
- tag_names = ['foo']
- return render.ErrorTagList(tag_names)
+ connection = models.CheckpkgErrorTag._connection
+ rows = connection.queryAll(connection.sqlrepr(
+ sqlbuilder.Select(
+ [models.CheckpkgErrorTag.q.tag_name],
+ distinct=True,
+ orderBy=models.CheckpkgErrorTag.q.tag_name)))
+ return render.ErrorTagList(rows)
class Catalogs(object):
Added: csw/mgar/gar/v2/lib/web/templates/CatalognameList.html
===================================================================
--- csw/mgar/gar/v2/lib/web/templates/CatalognameList.html (rev 0)
+++ csw/mgar/gar/v2/lib/web/templates/CatalognameList.html 2011-02-08 10:08:54 UTC (rev 13233)
@@ -0,0 +1,28 @@
+$def with (catalognames)
+<html>
+ <head>
+ <title>
+ Catalognames
+ </title>
+ <style type="text/css">
+ ul.catalogname-list {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ }
+ ul.catalogname-list > li {
+ margin: 0.2em;
+ padding: 0;
+ }
+ </style>
+ </head>
+ <body>
+ <ul class="catalogname-list">
+$for catalogname in catalognames:
+ <li>
+ <a href="$catalogname[0]/">$catalogname[0]</a>
+ </li>
+</ul>
+</body>
+</html>
+
Added: csw/mgar/gar/v2/lib/web/templates/ErrorTagDetail.html
===================================================================
--- csw/mgar/gar/v2/lib/web/templates/ErrorTagDetail.html (rev 0)
+++ csw/mgar/gar/v2/lib/web/templates/ErrorTagDetail.html 2011-02-08 10:08:54 UTC (rev 13233)
@@ -0,0 +1,19 @@
+$def with (tag_name, tags)
+<html>
+ <head>
+ <title>
+ $tag_name
+ </title>
+ </head>
+ <body>
+ <h3>$tag_name</h3>
+ <ul>
+$for tag in tags:
+ $if tag.srv4_file.registered:
+ <li>
+ <a href="../../srv4/$tag.srv4_file.md5_sum/">$tag.srv4_file.basename</a>:
+ $tag.tag_info
+ </li>
+</ul>
+</body>
+</html>
Modified: csw/mgar/gar/v2/lib/web/templates/ErrorTagList.html
===================================================================
--- csw/mgar/gar/v2/lib/web/templates/ErrorTagList.html 2011-02-08 09:01:58 UTC (rev 13232)
+++ csw/mgar/gar/v2/lib/web/templates/ErrorTagList.html 2011-02-08 10:08:54 UTC (rev 13233)
@@ -2,16 +2,14 @@
<html>
<head>
<title>
- OpenCSW Maintainers
+ Checkpkg error tags
</title>
</head>
<body>
<ul>
-$for tag_name in tags:
+$for tag in tags:
<li>
- <a href="$tag_name/">
- $tag_name
- </a>
+ <a href="$tag[0]/">$tag[0]</a>
</li>
</ul>
</body>
Modified: csw/mgar/gar/v2/lib/web/templates/index.html
===================================================================
--- csw/mgar/gar/v2/lib/web/templates/index.html 2011-02-08 09:01:58 UTC (rev 13232)
+++ csw/mgar/gar/v2/lib/web/templates/index.html 2011-02-08 10:08:54 UTC (rev 13233)
@@ -16,6 +16,12 @@
<li>
<a href="maintainers/">Maintainer list</a>
</li>
+ <li>
+ <a href="catalognames/">Catalogname list</a>
+ </li>
+ <li>
+ <a href="error-tags/">Error tags</a>
+ </li>
</ul>
</body>
</html>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list