allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject allura git commit: Allow a legacy icon (no original stored) to still be served when a larger width is requested; same behavior as when an original is present but it is small. Tangental tests
Date Wed, 29 Nov 2017 18:17:34 GMT
Repository: allura
Updated Branches:
  refs/heads/master d6171e085 -> e391f0b51


Allow a legacy icon (no original stored) to still be served when a larger width is requested;
same behavior as when an original is present but it is small.  Tangental tests


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

Branch: refs/heads/master
Commit: e391f0b515c4912163e8bbb28d68aa1a0ac060c3
Parents: d6171e0
Author: Dave Brondsema <dave@brondsema.net>
Authored: Wed Nov 29 12:54:09 2017 -0500
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Wed Nov 29 12:54:09 2017 -0500

----------------------------------------------------------------------
 Allura/allura/model/project.py               | 5 +----
 Allura/allura/tests/functional/test_admin.py | 4 ++++
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/e391f0b5/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index 92f4d9b..99d4d78 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -387,10 +387,7 @@ class Project(SearchIndexable, MappedClass, ActivityNode, ActivityObject):
         if not sized and w != DEFAULT_ICON_WIDTH:
             orig = self.icon_original
             if not orig:
-                if w > DEFAULT_ICON_WIDTH:
-                    return None
-                else:
-                    orig = self.icon
+                return self.icon
             sized = orig.save_thumbnail(filename='',
                                         image=PIL.Image.open(orig.rfile()),
                                         content_type=orig.content_type,

http://git-wip-us.apache.org/repos/asf/allura/blob/e391f0b5/Allura/allura/tests/functional/test_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_admin.py b/Allura/allura/tests/functional/test_admin.py
index 98dda1b..c7136ae 100644
--- a/Allura/allura/tests/functional/test_admin.py
+++ b/Allura/allura/tests/functional/test_admin.py
@@ -394,6 +394,10 @@ class TestProjectAdmin(TestController):
         assert image.size == (48, 48)
 
         r = self.app.get('/p/test/icon?foo=bar')
+        r = self.app.get('/p/test/icon?w=96')
+        image = PIL.Image.open(StringIO.StringIO(r.body))
+        assert image.size == (96, 96)
+        r = self.app.get('/p/test/icon?w=12345', status=404)
 
     def test_project_screenshot(self):
         file_name = 'neo-icon-set-454545-256x350.png'


Mime
View raw message