[csw-devel] SF.net SVN: gar:[20539] csw/mgar/gar/v2/lib/web
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Fri Mar 29 21:44:30 CET 2013
Revision: 20539
http://gar.svn.sourceforge.net/gar/?rev=20539&view=rev
Author: wahwah
Date: 2013-03-29 20:44:29 +0000 (Fri, 29 Mar 2013)
Log Message:
-----------
pkgdb-web: Show time information in catalog view
When displaying catalog info, show how much time did the query take.
Modified Paths:
--------------
csw/mgar/gar/v2/lib/web/pkgdb_web.py
csw/mgar/gar/v2/lib/web/templates/CatalogDetail.html
Modified: csw/mgar/gar/v2/lib/web/pkgdb_web.py
===================================================================
--- csw/mgar/gar/v2/lib/web/pkgdb_web.py 2013-03-29 20:44:17 UTC (rev 20538)
+++ csw/mgar/gar/v2/lib/web/pkgdb_web.py 2013-03-29 20:44:29 UTC (rev 20539)
@@ -12,6 +12,7 @@
import pprint
import sqlobject
import web
+import time
from lib.python import models
from lib.python import configuration
@@ -198,8 +199,12 @@
cat_name = " ".join((catrel_name, arch_name, osrel_name))
sqo_osrel, sqo_arch, sqo_catrel = pkgdb.GetSqoTriad(
osrel_name, arch_name, catrel_name)
+ t2 = time.time()
pkgs = models.GetCatPackagesResult(sqo_osrel, sqo_arch, sqo_catrel)
- return render.CatalogDetail(cat_name, pkgs)
+ pkgs = list(pkgs)
+ t3 = time.time()
+ timeinfo = "Query evaluation: %.2fs" % (t3-t2)
+ return render.CatalogDetail(cat_name, pkgs, timeinfo, len(pkgs))
class MaintainerList(object):
Modified: csw/mgar/gar/v2/lib/web/templates/CatalogDetail.html
===================================================================
--- csw/mgar/gar/v2/lib/web/templates/CatalogDetail.html 2013-03-29 20:44:17 UTC (rev 20538)
+++ csw/mgar/gar/v2/lib/web/templates/CatalogDetail.html 2013-03-29 20:44:29 UTC (rev 20539)
@@ -1,4 +1,4 @@
-$def with (cat_name, pkgs)
+$def with (cat_name, pkgs, timeinfo, n_of_pkgs)
<html>
<head>
<title>
@@ -8,7 +8,7 @@
</head>
<body>
<h3>$cat_name</h3>
- <p>$pkgs.count() packages</p>
+ <p>$n_of_pkgs packages</p>
<table>
<tr>
<th>filename</th>
@@ -22,5 +22,6 @@
<td>$pkg.version_string</td>
</tr>
</table>
+<p><code>$timeinfo</code></p>
</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