class RelationshipsNavWidget(TabWidget): tabs = OrderedDict([('Requires', 'package.relationships.requires'), ('Required By', 'package.relationships.requiredby'), ('Provides', 'package.relationships.provides'), ('Obsoletes', 'package.relationships.obsoletes'), ('Conflicts', 'package.relationships.conflicts')]) base_url = Template(text='/${kwds["package_name"]}/relationships/') default_tab = 'Requires'
def __init__(self, *args, **kw): super(TabWidget, self).__init__(*args, **kw) self._uuid = str(uuid.uuid4()) self._expanded_tabs = OrderedDict() for key, widget_key in self.tabs.items(): display_name = key key = key.lower().replace(' ', '_') self._expanded_tabs[key] = {'display_name': display_name, 'widget_key': widget_key}
class Sources(TabWidget): tabs = OrderedDict([ ('Patches', 'package.sources.patches'), ('Spec', 'package.sources.spec'), #('Diffs', 'package.sources.diffs'), #('Tarballs', 'package.sources.tarballs'), #('Git', 'package.sources.git'), ]) base_url = Template(text='/${kwds["package_name"]}/sources/') default_tab = 'Patches'
class PackageNavWidget(TabWidget): tabs = OrderedDict([('Overview', 'package_overview'), ('Builds', 'package_builds'), ('Updates', 'package_updates'), ('Bugs', 'package_bugs'), ('Contents', 'package_contents'), ('Changelog', 'package_changelog'), ('Sources', 'package_sources')]) #('Relationships', 'package_relationships')]) base_url = Template(text='/${kwds["package_name"]}/'); default_tab = 'Overview' args = twc.Param(default=None) kwds = twc.Param(default=None)
def get_latest_builds(self, package_name): enquire = xapian.Enquire(self._versionmap_db) qp = xapian.QueryParser() qp.set_database(self._versionmap_db) qp.add_boolean_prefix('key', 'XA') query = qp.parse_query('key:%s' % utils.filter_search_string(package_name)) enquire.set_query(query) matches = enquire.get_mset(0, 1) if len(matches) == 0: return None results = json.loads(matches[0].document.get_data()) latest_builds = OrderedDict() lastdistname = "" for dist in distmappings.tags: distname = dist['name'] if lastdistname != distname and distname in results: latest_builds[distname] = results[distname] lastdistname = distname return latest_builds