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:27 UTC

[1/5] git commit: [#6487] get fully qualified icon url

Updated Branches:
  refs/heads/db/6487 [created] e573d78df


[#6487] get fully qualified icon url


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

Branch: refs/heads/db/6487
Commit: d08624404a12f6fbbbbaf4f1158ca7bb96f40412
Parents: 62099e2
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Jul 23 19:58:36 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Jul 23 19:58:36 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/google/__init__.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/d0862440/ForgeImporters/forgeimporters/google/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/__init__.py b/ForgeImporters/forgeimporters/google/__init__.py
index 49aa907..d7e341c 100644
--- a/ForgeImporters/forgeimporters/google/__init__.py
+++ b/ForgeImporters/forgeimporters/google/__init__.py
@@ -18,18 +18,21 @@
 import re
 import urllib
 import urllib2
-from urlparse import urlparse
+from urlparse import urlparse, urljoin
 from collections import defaultdict
 try:
     from cStringIO import StringIO
 except ImportError:
     from StringIO import StringIO
+import logging
 
 from BeautifulSoup import BeautifulSoup
 
 from allura import model as M
 
 
+log = logging.getLogger(__name__)
+
 class GoogleCodeProjectExtractor(object):
     RE_REPO_TYPE = re.compile(r'(svn|hg|git)')
 
@@ -61,7 +64,8 @@ class GoogleCodeProjectExtractor(object):
         self.project.short_description = self.page.find(itemprop='description').string.strip()
 
     def get_icon(self):
-        icon_url = self.page.find(itemprop='image').attrMap['src']
+        icon_url = urljoin(self.url, self.page.find(itemprop='image').attrMap['src'])
+        log.info(icon_url)
         icon_name = urllib.unquote(urlparse(icon_url).path).split('/')[-1]
         fp_ish = urllib2.urlopen(icon_url)
         fp = StringIO(fp_ish.read())


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

Posted by br...@apache.org.
[#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())


[2/5] git commit: fixup! [#6487] get fully qualified icon url

Posted by br...@apache.org.
fixup! [#6487] get fully qualified icon url


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

Branch: refs/heads/db/6487
Commit: 332e83715afb2a90979f095b22d2dec02aa0105e
Parents: d086244
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Jul 23 19:58:51 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Jul 23 19:58:51 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/google/__init__.py | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/332e8371/ForgeImporters/forgeimporters/google/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/__init__.py b/ForgeImporters/forgeimporters/google/__init__.py
index d7e341c..3dc959b 100644
--- a/ForgeImporters/forgeimporters/google/__init__.py
+++ b/ForgeImporters/forgeimporters/google/__init__.py
@@ -65,7 +65,6 @@ class GoogleCodeProjectExtractor(object):
 
     def get_icon(self):
         icon_url = urljoin(self.url, self.page.find(itemprop='image').attrMap['src'])
-        log.info(icon_url)
         icon_name = urllib.unquote(urlparse(icon_url).path).split('/')[-1]
         fp_ish = urllib2.urlopen(icon_url)
         fp = StringIO(fp_ish.read())


[3/5] git commit: [#6487] fix license trove names

Posted by br...@apache.org.
[#6487] fix license trove names


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

Branch: refs/heads/db/6487
Commit: 1ac73de74a1169868758c892d664d675180c351f
Parents: 332e837
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Jul 23 19:59:07 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Jul 23 19:59:07 2013 +0000

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


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1ac73de7/ForgeImporters/forgeimporters/google/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/__init__.py b/ForgeImporters/forgeimporters/google/__init__.py
index 3dc959b..332d075 100644
--- a/ForgeImporters/forgeimporters/google/__init__.py
+++ b/ForgeImporters/forgeimporters/google/__init__.py
@@ -45,10 +45,10 @@ class GoogleCodeProjectExtractor(object):
             'Apache License 2.0': 'Apache Software License',
             'Artistic License/GPL': 'Artistic License',
             'Eclipse Public License 1.0': 'Eclipse Public License',
-            'GNU GPL v2': 'GNU General Public License (GPL',
-            'GNU GPL v3': 'GNU General Public License (GPL',
+            'GNU GPL v2': 'GNU General Public License (GPL)',
+            'GNU GPL v3': 'GNU General Public License (GPL)',
             'GNU Lesser GPL': 'GNU Library or Lesser General Public License (LGPL)',
-            'MIT License': 'License :: OSI-Approved Open Source :: MIT License',
+            'MIT License': 'MIT License',
             'Mozilla Public License 1.1': 'Mozilla Public License 1.1 (MPL 1.1)',
             'New BSD License': 'BSD License',
             'Other Open Source': 'Other/Proprietary License',


[4/5] git commit: [#6487] handle more complex content-types, e.g. from http://code.google.com/p/msysgit/logo?cct=1342277278

Posted by br...@apache.org.
[#6487] handle more complex content-types, e.g. from http://code.google.com/p/msysgit/logo?cct=1342277278


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

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

----------------------------------------------------------------------
 Allura/allura/model/filesystem.py                | 1 +
 ForgeImporters/forgeimporters/google/__init__.py | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9fab0e66/Allura/allura/model/filesystem.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/filesystem.py b/Allura/allura/model/filesystem.py
index 1bb0087..dbe1aa7 100644
--- a/Allura/allura/model/filesystem.py
+++ b/Allura/allura/model/filesystem.py
@@ -162,6 +162,7 @@ class File(MappedClass):
         if content_type is None:
             content_type = utils.guess_mime_type(filename)
         if not content_type.lower() in SUPPORTED_BY_PIL:
+            log.debug('Content type %s from file %s not supported', content_type, filename)
             return None, None
 
         try:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/9fab0e66/ForgeImporters/forgeimporters/google/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/__init__.py b/ForgeImporters/forgeimporters/google/__init__.py
index 332d075..f4a7b7a 100644
--- a/ForgeImporters/forgeimporters/google/__init__.py
+++ b/ForgeImporters/forgeimporters/google/__init__.py
@@ -69,8 +69,9 @@ class GoogleCodeProjectExtractor(object):
         fp_ish = urllib2.urlopen(icon_url)
         fp = StringIO(fp_ish.read())
         M.ProjectFile.save_image(
-            icon_name, fp, fp_ish.info()['content-type'], square=True,
-            thumbnail_size=(48,48),
+            icon_name, fp,
+            fp_ish.info()['content-type'].split(';')[0],  # strip off charset=x extra param,
+            square=True, thumbnail_size=(48,48),
             thumbnail_meta={'project_id': self.project._id, 'category': 'icon'})
 
     def get_license(self):