Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
82345810
Commit
82345810
authored
Nov 06, 2016
by
Syed Hasan raza
Committed by
GitHub
Nov 06, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13853 from edx/shr/bug/TNL-5591-update-orientation-with-None-value
fix None value for orientation update
parents
d59ab18b
178e497c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletions
+17
-1
openedx/core/djangoapps/profile_images/images.py
+2
-1
openedx/core/djangoapps/profile_images/tests/test_images.py
+15
-0
No files found.
openedx/core/djangoapps/profile_images/images.py
View file @
82345810
...
@@ -205,7 +205,8 @@ def _update_exif_orientation(exif, orientation):
...
@@ -205,7 +205,8 @@ def _update_exif_orientation(exif, orientation):
the exif orientation, return a new exif with the orientation set.
the exif orientation, return a new exif with the orientation set.
"""
"""
exif_dict
=
piexif
.
load
(
exif
)
exif_dict
=
piexif
.
load
(
exif
)
exif_dict
[
'0th'
][
piexif
.
ImageIFD
.
Orientation
]
=
orientation
if
orientation
:
exif_dict
[
'0th'
][
piexif
.
ImageIFD
.
Orientation
]
=
orientation
return
piexif
.
dump
(
exif_dict
)
return
piexif
.
dump
(
exif_dict
)
...
...
openedx/core/djangoapps/profile_images/tests/test_images.py
View file @
82345810
...
@@ -24,6 +24,7 @@ from ..images import (
...
@@ -24,6 +24,7 @@ from ..images import (
validate_uploaded_image
,
validate_uploaded_image
,
_get_exif_orientation
,
_get_exif_orientation
,
_get_valid_file_types
,
_get_valid_file_types
,
_update_exif_orientation
)
)
from
.helpers
import
make_image_file
,
make_uploaded_file
from
.helpers
import
make_image_file
,
make_uploaded_file
...
@@ -186,6 +187,20 @@ class TestGenerateProfileImages(TestCase):
...
@@ -186,6 +187,20 @@ class TestGenerateProfileImages(TestCase):
for
_
,
image
in
self
.
_create_mocked_profile_images
(
imfile
,
requested_images
):
for
_
,
image
in
self
.
_create_mocked_profile_images
(
imfile
,
requested_images
):
self
.
check_exif_orientation
(
image
,
None
)
self
.
check_exif_orientation
(
image
,
None
)
def
test_update_exif_orientation_without_orientation
(
self
):
"""
Test the update_exif_orientation without orientation will not throw exception.
"""
requested_images
=
{
10
:
"ten.jpg"
}
with
make_image_file
(
extension
=
'.jpg'
)
as
imfile
:
for
_
,
image
in
self
.
_create_mocked_profile_images
(
imfile
,
requested_images
):
self
.
check_exif_orientation
(
image
,
None
)
exif
=
image
.
info
.
get
(
'exif'
,
piexif
.
dump
({}))
self
.
assertEqual
(
_update_exif_orientation
(
exif
,
None
),
image
.
info
.
get
(
'exif'
,
piexif
.
dump
({}))
)
def
_create_mocked_profile_images
(
self
,
image_file
,
requested_images
):
def
_create_mocked_profile_images
(
self
,
image_file
,
requested_images
):
"""
"""
Create image files with mocked-out storage.
Create image files with mocked-out storage.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment