diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2007-10-13 07:24:36 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2007-10-13 07:24:36 +0000 |
commit | 37646afc734647446c40c8e68a90405550d33663 (patch) | |
tree | 5e9763f54f908e2a1ca710437c84c55b42f93d25 | |
parent | Display functional stable/testing/masked links ONLY if on an /arch/ page. (diff) | |
download | packages-3-37646afc734647446c40c8e68a90405550d33663.tar.gz packages-3-37646afc734647446c40c8e68a90405550d33663.tar.bz2 packages-3-37646afc734647446c40c8e68a90405550d33663.zip |
Allow viewing of masked packages specifically.
-rw-r--r-- | web/controller.py | 2 | ||||
-rw-r--r-- | web/lib/filters.py | 5 | ||||
-rw-r--r-- | web/model.py | 6 | ||||
-rw-r--r-- | web/templates/index.html | 2 |
4 files changed, 11 insertions, 4 deletions
diff --git a/web/controller.py b/web/controller.py index 03b6d16..e5799e5 100644 --- a/web/controller.py +++ b/web/controller.py @@ -57,6 +57,8 @@ class Root(object): filtered_latest_entries = entry_filter.stable_filter(arch, limit) elif 'testing' in kwds: filtered_latest_entries = entry_filter.testing_filter(arch, limit) + elif 'masked' in kwds: + filtered_latest_entries = entry_filter.masked_filter(arch, limit) else: filtered_latest_entries = entry_filter.arch_filter(arch, limit) center_pkgs = build_centerpkg_list(filtered_latest_entries, diff --git a/web/lib/filters.py b/web/lib/filters.py index 45ba1ea..f04f11d 100644 --- a/web/lib/filters.py +++ b/web/lib/filters.py @@ -61,6 +61,11 @@ class EntryFilters(object): return [] return self.package_source.get_latest_cpvs_by_category_pkgname(category, pkgname, limit) + def masked_filter(self, arch, limit=None): + """Filter packages by masked keyword for arch""" + + return self.package_source.get_latest_cpvs_by_arch(arch, 'M', limit) + def stable_filter(self, arch, limit=None): """Filter packages by stable keyword for arch""" diff --git a/web/model.py b/web/model.py index eea8cfb..a837cb5 100644 --- a/web/model.py +++ b/web/model.py @@ -137,7 +137,7 @@ class PackageDB(object): def get_latest_cpvs_by_arch(self, arch, mode, limit=None): """return modified cpvs limited by arch and mode""" - valid_modes = ['+','~','M+','M~',''] + valid_modes = ['+','~','M','M+','M~',''] params = () if mode not in valid_modes or arch not in self.arches: return [] @@ -145,9 +145,9 @@ class PackageDB(object): if mode != '': sql = """SELECT %s, versions.mtime FROM arches JOIN keywords USING (a) JOIN versions USING (cpv) JOIN packages USING (cp) JOIN categories USING (c) - WHERE arches.arch=? AND keywords.mode=? + WHERE arches.arch=? AND SUBSTR(keywords.mode,1,1)=? ORDER by versions.mtime DESC""" % (self.columns_category_pn_pv) - params = (arch, mode) + params = (arch, str(mode)[0]) else: sql = """SELECT %s, versions.mtime FROM arches JOIN keywords USING (a) JOIN versions USING (cpv) JOIN packages USING (cp) JOIN categories USING (c) diff --git a/web/templates/index.html b/web/templates/index.html index c87189d..40eaa2c 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -80,7 +80,7 @@ ${lastupdate} </p> <p class="switch" py:if="cherrypy.request.path_info.startswith('/arch/')"> -Switch to <a href="${cherrypy.request.path_info}?stable">stable</a>/<a href="${cherrypy.request.path_info}?testing">testing</a>.<br /> +<a href="${cherrypy.request.path_info}?stable">arch</a>/<a href="${cherrypy.request.path_info}?testing">~arch</a>/<a href="${cherrypy.request.path_info}?masked">masked</a>. </p> </div> |