Skip to content

Commit

Permalink
fix: traceback is GetGroupPackages is called before GetGroups
Browse files Browse the repository at this point in the history
(RhBug: # 1221030)
  • Loading branch information
Tim Lauridsen committed May 13, 2015
1 parent 667bd5c commit cd28cb3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions python/dnfdaemon/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ def expire_cache(self):
def get_groups(self):
"""Get available comps categories & groups"""
all_groups = []
if not self.base.comps: # lazy load the comps metadata
self.base.read_comps()
self._load_comps()
for category in self.base.comps.categories_iter():
cat = (category.name, category.ui_name, category.ui_description)
cat_grps = []
Expand Down Expand Up @@ -374,6 +373,7 @@ def get_group_pkgs(self, grp_id, grp_flt, attrs):
group package type.
"""
pkgs = []
self._load_comps()
grp = self.base.comps.group_by_pattern(grp_id)
if grp:
if grp_flt == 'all':
Expand Down Expand Up @@ -721,10 +721,14 @@ def _get_po_by_name(self, name, newest_only, ignore_case=True):
pkgs = self.base.packages.filter_packages(qa)
return pkgs

def _find_group(self, pattern):
""" Find comps.Group object by pattern."""
def _load_comps(self):
''' Lazy load the group metadata'''
if not self.base.comps: # lazy load the comps metadata
self.base.read_comps()

def _find_group(self, pattern):
""" Find comps.Group object by pattern."""
self._load_comps()
grp = self.base.comps.group_by_pattern(pattern)
return grp

Expand Down

0 comments on commit cd28cb3

Please sign in to comment.