[csw-devel] SF.net SVN: gar:[13899] csw/mgar/gar/v2/lib

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Mon Mar 21 10:46:03 CET 2011


Revision: 13899
          http://gar.svn.sourceforge.net/gar/?rev=13899&view=rev
Author:   wahwah
Date:     2011-03-21 09:46:03 +0000 (Mon, 21 Mar 2011)

Log Message:
-----------
pkgdb-web: A bugfix for error tag display

The problem was that the function returning all error tags was asked for tags
matching arch='all', and no such tags ever exist: even if the package is
architecture-independent, checks are done always specific to an architecture
architecture and are stored as such.

When the package is arch='all', errors for all architectures are displayed.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/models.py
    csw/mgar/gar/v2/lib/web/pkgdb_web.py
    csw/mgar/gar/v2/lib/web/templates/Srv4Detail.html

Modified: csw/mgar/gar/v2/lib/python/models.py
===================================================================
--- csw/mgar/gar/v2/lib/python/models.py	2011-03-21 09:18:43 UTC (rev 13898)
+++ csw/mgar/gar/v2/lib/python/models.py	2011-03-21 09:46:03 UTC (rev 13899)
@@ -166,6 +166,8 @@
     return CheckpkgOverride.select(CheckpkgOverride.q.srv4_file==self)
 
   def GetErrorTagsResult(self, os_rel, arch, catrel):
+    assert arch.name != 'all', ("Asked for the 'all' architecture, this is not valid "
+                                "for GetErrorTagsResult().")
     return CheckpkgErrorTag.select(
         sqlobject.AND(
             CheckpkgErrorTag.q.srv4_file==self,

Modified: csw/mgar/gar/v2/lib/web/pkgdb_web.py
===================================================================
--- csw/mgar/gar/v2/lib/web/pkgdb_web.py	2011-03-21 09:18:43 UTC (rev 13898)
+++ csw/mgar/gar/v2/lib/web/pkgdb_web.py	2011-03-21 09:46:03 UTC (rev 13899)
@@ -72,17 +72,21 @@
       overrides = pkg.GetOverridesResult()
       tags_by_cat = {}
       tags_and_catalogs = []
-      arch = pkg.arch
       osrels = models.OsRelease.select()
       catrels = models.CatalogRelease.select()
       all_tags = list(models.CheckpkgErrorTag.selectBy(srv4_file=pkg))
+      if pkg.arch.name == 'all':
+        archs = models.Architecture.select(models.Architecture.q.name!='all')
+      else:
+        archs = [arch]
       for catrel in catrels:
-        for osrel in osrels:
-          tags = pkg.GetErrorTagsResult(osrel, arch, catrel)
-          key = (osrel, arch, catrel)
-          tags = list(tags)
-          tags_by_cat[key] = tags
-          tags_and_catalogs.append((osrel, arch, catrel, tags))
+        for arch in archs:
+          for osrel in osrels:
+            tags = pkg.GetErrorTagsResult(osrel, arch, catrel)
+            key = (osrel, arch, catrel)
+            tags = list(tags)
+            tags_by_cat[key] = tags
+            tags_and_catalogs.append((osrel, arch, catrel, tags))
       return render.Srv4Detail(pkg, overrides, tags_by_cat, all_tags,
           tags_and_catalogs)
     except sqlobject.main.SQLObjectNotFound, e:

Modified: csw/mgar/gar/v2/lib/web/templates/Srv4Detail.html
===================================================================
--- csw/mgar/gar/v2/lib/web/templates/Srv4Detail.html	2011-03-21 09:18:43 UTC (rev 13898)
+++ csw/mgar/gar/v2/lib/web/templates/Srv4Detail.html	2011-03-21 09:46:03 UTC (rev 13899)
@@ -57,7 +57,7 @@
 
 <h3>Error tags</h3>
 
-<p>Error tags in catalogs.<p>
+<p>Error tags associated with catalogs.<p>
 <ul>
 $for osrel, arch, catrel, tags_in_cat in tags_and_catalogs:
   $if tags_in_cat:
@@ -72,7 +72,7 @@
         <span style="color: gray;">
       $else:
         <span style="color: black;">
-      $tag
+      <a href="http://wiki.opencsw.org/checkpkg-error-tags#$tag.tag_name" title="Information about the $tag.tag_name tag.">$tag.tag_name</a> $tag.tag_info
       $if tag.overridden:
         (overridden)
       </span>
@@ -80,25 +80,6 @@
     </ul>
     </li>
 </ul>
-<p>All error tags for this srv4 file.</p>
-<ul>
-$for tag in tags:
-  <li>
-  $if tag.overridden:
-    <span style="color: gray;">
-  $else:
-    <span style="color: black;">
-  <a href="http://wiki.opencsw.org/checkpkg-error-tags#$tag.tag_name" title="Information about the $tag.tag_name tag.">$tag.tag_name</a> $tag.tag_info
-  $if tag.overridden:
-    [overridden]
-  <span style="font-size: 80%">
-  ($tag.catrel.name
-  $tag.arch.name
-  $tag.os_rel.short_name)
-  </span>
-  </span>
-  </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