fix: retrieve third icons even if module is local

This commit is contained in:
Romain Bignon 2012-02-11 16:19:22 +01:00
commit d6534ae845

View file

@ -67,7 +67,7 @@ class ModuleInfo(object):
self.description = to_unicode(items['description']) self.description = to_unicode(items['description'])
self.maintainer = to_unicode(items['maintainer']) self.maintainer = to_unicode(items['maintainer'])
self.license = to_unicode(items['license']) self.license = to_unicode(items['license'])
self.icon = items['icon'] self.icon = items['icon'].strip() or None
self.urls = items['urls'] self.urls = items['urls']
def has_caps(self, caps): def has_caps(self, caps):
@ -482,14 +482,13 @@ class Repositories(object):
dest_path = self.get_module_icon_path(module) dest_path = self.get_module_icon_path(module)
icon_url = module.icon
if not icon_url:
if module.is_local(): if module.is_local():
icon_path = os.path.join(module.path, module.name, 'favicon.png') icon_path = os.path.join(module.path, module.name, 'favicon.png')
if module.path and os.path.exists(icon_path): if module.path and os.path.exists(icon_path):
shutil.copy(icon_path, dest_path) shutil.copy(icon_path, dest_path)
return return
if module.icon:
icon_url = module.icon
else: else:
icon_url = module.url.replace('.tar.gz', '.png') icon_url = module.url.replace('.tar.gz', '.png')