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 2018/09/27 18:03:21 UTC
allura git commit: [#2578] support BMP conversion for project icons
too
Repository: allura
Updated Branches:
refs/heads/master 10b0d7586 -> 61189717d
[#2578] support BMP conversion for project icons too
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/61189717
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/61189717
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/61189717
Branch: refs/heads/master
Commit: 61189717d28ec44ada4b28d4b98e635a9fcff940
Parents: 10b0d75
Author: Dave Brondsema <da...@brondsema.net>
Authored: Thu Sep 27 14:03:16 2018 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Thu Sep 27 14:03:16 2018 -0400
----------------------------------------------------------------------
Allura/allura/lib/validators.py | 4 ++--
Allura/allura/model/project.py | 1 +
Allura/allura/tests/test_validators.py | 4 ++--
3 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/61189717/Allura/allura/lib/validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/validators.py b/Allura/allura/lib/validators.py
index 7331c4e..1a38905 100644
--- a/Allura/allura/lib/validators.py
+++ b/Allura/allura/lib/validators.py
@@ -430,14 +430,14 @@ def convertTime(timestring):
class IconValidator(fev.FancyValidator):
- regex = '(jpg|jpeg|gif|png)$'
+ regex = '(jpg|jpeg|gif|png|bmp)$'
def _to_python(self, value, state):
p = re.compile(self.regex, flags=re.I)
result = p.search(value.filename)
if not result:
raise fe.Invalid(
- 'Project icons must be PNG, GIF, or JPG format.',
+ 'Project icons must be PNG, GIF, JPG, or BMP format.',
value, state)
return value
http://git-wip-us.apache.org/repos/asf/allura/blob/61189717/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index d0c5284..1a70914 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -366,6 +366,7 @@ class Project(SearchIndexable, MappedClass, ActivityNode, ActivityObject):
thumbnail_meta=dict(project_id=self._id, category='icon'),
save_original=True,
original_meta=dict(project_id=self._id, category='icon_original'),
+ convert_bmp=True,
)
# store the dimensions so we don't have to read the whole image each time we need to know
icon_orig_img = PIL.Image.open(icon_orig.rfile())
http://git-wip-us.apache.org/repos/asf/allura/blob/61189717/Allura/allura/tests/test_validators.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_validators.py b/Allura/allura/tests/test_validators.py
index e812655..f482efb 100644
--- a/Allura/allura/tests/test_validators.py
+++ b/Allura/allura/tests/test_validators.py
@@ -312,9 +312,9 @@ class TestIconValidator(unittest.TestCase):
input = self._mock('foo.svg')
with self.assertRaises(fe.Invalid) as cm:
self.val.to_python(input)
- self.assertEqual(str(cm.exception), 'Project icons must be PNG, GIF, or JPG format.')
+ self.assertEqual(str(cm.exception), 'Project icons must be PNG, GIF, JPG, or BMP format.')
input = self._mock('foogif.svg')
with self.assertRaises(fe.Invalid) as cm:
self.assertEqual(input, self.val.to_python(input))
- self.assertEqual(str(cm.exception), 'Project icons must be PNG, GIF, or JPG format.')
+ self.assertEqual(str(cm.exception), 'Project icons must be PNG, GIF, JPG, or BMP format.')