Christopher Aillon brought up a problem in the current icon code for
PackageDB. It seems that mozilla is sensitive to the icon that is
associated with the firefox web browser. So we shouldn't be showing icons
other than the default or hicolor icon set for firefox or risk trademark
repurcussions.
I've removed the other icons from the pkgdb for now but newer packages with
icons for firefox that get imported into the database could potentially
occur at any time.
Martin Bacovsky has a small patch for pkgdb that prioritises the themes that
are used when choosing an icon. That should be enough to always choose
a proper icon for displaying alongside firefox.
Could I get two +1s for applying this to the app servers?
=== modified file 'pkgdb/applications.py'
--- pkgdb/applications.py 2010-03-15 16:26:59 +0000
+++ pkgdb/applications.py 2010-03-25 12:30:12 +0000
@@ -38,7 +38,7 @@
from pkgdb.model import Comment, Application, Icon, IconName, PackageBuild
from pkgdb.model import Tag, Usage, ApplicationUsage, ApplicationTag
-from pkgdb.model import MimeType
+from pkgdb.model import MimeType, Theme
from pkgdb.lib.utils import mod_grp
from pkgdb import release, _
from pkgdb.lib.text_utils import excerpt
@@ -531,15 +531,18 @@
def show(self, *app_name):
app_name = '/'.join(app_name)
- # TODO: themes
- icon_data = session.query(Icon.icon)\
- .join(Icon.name, IconName.applications)\
+ icon_data = session.query(Theme.name, Icon.icon)\
+ .join(Icon.name, IconName.applications, Icon.theme)\
.filter(Application.name==app_name)\
- .first()
+ .all()
+
if not icon_data:
redirect('/static/images/noicon.png')
- return str(icon_data[0])
+ icons = dict(icon_data)
+
+ # icon theme priority: default > hicolor > whatever
+ return str(icons.get('default', None) or icons.get('hicolor', None) or icons[icons.keys()[0]])
-Toshio