You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/07/23 22:16:31 UTC

[5/5] git commit: [#6487] don't use google code's default icon

[#6487] don't use google code's default icon


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/e573d78d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/e573d78d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/e573d78d

Branch: refs/heads/db/6487
Commit: e573d78df9c51062f18633327315ea856d1c14c7
Parents: 9fab0e6
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Jul 23 20:15:47 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Jul 23 20:15:47 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/google/__init__.py | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e573d78d/ForgeImporters/forgeimporters/google/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/__init__.py b/ForgeImporters/forgeimporters/google/__init__.py
index f4a7b7a..17d724f 100644
--- a/ForgeImporters/forgeimporters/google/__init__.py
+++ b/ForgeImporters/forgeimporters/google/__init__.py
@@ -54,6 +54,8 @@ class GoogleCodeProjectExtractor(object):
             'Other Open Source': 'Other/Proprietary License',
         })
 
+    DEFAULT_ICON = 'http://www.gstatic.com/codesite/ph/images/defaultlogo.png'
+
     def __init__(self, project, page='project_info'):
         gc_project_name = project.get_tool_data('google-code', 'project_name')
         self.url = self.PAGE_MAP[page] % urllib.quote(gc_project_name)
@@ -65,6 +67,8 @@ class GoogleCodeProjectExtractor(object):
 
     def get_icon(self):
         icon_url = urljoin(self.url, self.page.find(itemprop='image').attrMap['src'])
+        if icon_url == self.DEFAULT_ICON:
+            return
         icon_name = urllib.unquote(urlparse(icon_url).path).split('/')[-1]
         fp_ish = urllib2.urlopen(icon_url)
         fp = StringIO(fp_ish.read())