Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Django Favicon Plus Reloaded
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Libraries
Django Favicon Plus Reloaded
Commits
c00a9b44
Commit
c00a9b44
authored
9 years ago
by
bashu
Browse files
Options
Downloads
Patches
Plain Diff
fixed python 2 & 3 compatibility
parent
f18ed54e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
favicon/models.py
+5
-6
5 additions, 6 deletions
favicon/models.py
requirements.txt
+1
-1
1 addition, 1 deletion
requirements.txt
with
6 additions
and
7 deletions
favicon/models.py
+
5
−
6
View file @
c00a9b44
from
compat
import
python_2_unicode_compatible
import
sys
from
django.db
import
models
from
django.conf
import
settings
from
django.core.files.uploadedfile
import
InMemoryUploadedFile
from
PIL
import
Image
try
:
from
StringIO
import
StringIO
except
ImportError
:
from
io
import
StringIO
from
compat
import
BytesIO
config
=
{
'
shortcut icon
'
:
[
16
,
32
,
48
,
128
,
192
],
...
...
@@ -66,11 +65,11 @@ class Favicon(models.Model):
tmp
=
Image
.
open
(
self
.
faviconImage
.
path
)
tmp
.
thumbnail
((
size
,
size
),
Image
.
ANTIALIAS
)
tmpIO
=
String
IO
()
tmpIO
=
Bytes
IO
()
tmp
.
save
(
tmpIO
,
format
=
'
PNG
'
)
tmpFile
=
InMemoryUploadedFile
(
tmpIO
,
None
,
'
fav-%s.png
'
%
(
size
,),
'
image/png
'
,
tmpIO
.
len
,
None
)
(
size
,),
'
image/png
'
,
sys
.
getsizeof
(
tmpIO
)
,
None
)
fav
.
faviconImage
=
tmpFile
fav
.
save
()
...
...
This diff is collapsed.
Click to expand it.
requirements.txt
+
1
−
1
View file @
c00a9b44
django
>=1.4.16
django-compat
P
illow
p
illow
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment