Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
a2fb2b3a
Kaydet (Commit)
a2fb2b3a
authored
Agu 04, 2016
tarafından
Ville Skyttä
Kaydeden (comit)
Tim Graham
Agu 04, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #27020 -- Used a context manager to close files.
üst
50e299db
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
21 deletions
+21
-21
views.py
django/contrib/admindocs/views.py
+6
-1
password_validation.py
django/contrib/auth/password_validation.py
+2
-1
shortcuts.py
django/contrib/gis/shortcuts.py
+2
-3
text.py
django/utils/text.py
+10
-12
test_conditional_content_removal.py
tests/test_client/test_conditional_content_removal.py
+1
-4
No files found.
django/contrib/admindocs/views.py
Dosyayı görüntüle @
a2fb2b3a
...
...
@@ -324,10 +324,15 @@ class TemplateDetailView(BaseAdminDocsView):
# This doesn't account for template loaders (#24128).
for
index
,
directory
in
enumerate
(
default_engine
.
dirs
):
template_file
=
os
.
path
.
join
(
directory
,
template
)
if
os
.
path
.
exists
(
template_file
):
with
open
(
template_file
)
as
f
:
template_contents
=
f
.
read
()
else
:
template_contents
=
''
templates
.
append
({
'file'
:
template_file
,
'exists'
:
os
.
path
.
exists
(
template_file
),
'contents'
:
lambda
:
open
(
template_file
)
.
read
()
if
os
.
path
.
exists
(
template_file
)
else
''
,
'contents'
:
template_contents
,
'order'
:
index
,
})
kwargs
.
update
({
...
...
django/contrib/auth/password_validation.py
Dosyayı görüntüle @
a2fb2b3a
...
...
@@ -169,7 +169,8 @@ class CommonPasswordValidator(object):
def
__init__
(
self
,
password_list_path
=
DEFAULT_PASSWORD_LIST_PATH
):
try
:
common_passwords_lines
=
gzip
.
open
(
password_list_path
)
.
read
()
.
decode
(
'utf-8'
)
.
splitlines
()
with
gzip
.
open
(
password_list_path
)
as
f
:
common_passwords_lines
=
f
.
read
()
.
decode
(
'utf-8'
)
.
splitlines
()
except
IOError
:
with
open
(
password_list_path
)
as
f
:
common_passwords_lines
=
f
.
readlines
()
...
...
django/contrib/gis/shortcuts.py
Dosyayı görüntüle @
a2fb2b3a
...
...
@@ -15,9 +15,8 @@ except ImportError:
def
compress_kml
(
kml
):
"Returns compressed KMZ from the given KML string."
kmz
=
BytesIO
()
zf
=
zipfile
.
ZipFile
(
kmz
,
'a'
,
zipfile
.
ZIP_DEFLATED
)
zf
.
writestr
(
'doc.kml'
,
kml
.
encode
(
settings
.
DEFAULT_CHARSET
))
zf
.
close
()
with
zipfile
.
ZipFile
(
kmz
,
'a'
,
zipfile
.
ZIP_DEFLATED
)
as
zf
:
zf
.
writestr
(
'doc.kml'
,
kml
.
encode
(
settings
.
DEFAULT_CHARSET
))
kmz
.
seek
(
0
)
return
kmz
.
read
()
...
...
django/utils/text.py
Dosyayı görüntüle @
a2fb2b3a
...
...
@@ -291,9 +291,8 @@ def phone2numeric(phone):
# Used with permission.
def
compress_string
(
s
):
zbuf
=
BytesIO
()
zfile
=
GzipFile
(
mode
=
'wb'
,
compresslevel
=
6
,
fileobj
=
zbuf
)
zfile
.
write
(
s
)
zfile
.
close
()
with
GzipFile
(
mode
=
'wb'
,
compresslevel
=
6
,
fileobj
=
zbuf
)
as
zfile
:
zfile
.
write
(
s
)
return
zbuf
.
getvalue
()
...
...
@@ -321,15 +320,14 @@ class StreamingBuffer(object):
# Like compress_string, but for iterators of strings.
def
compress_sequence
(
sequence
):
buf
=
StreamingBuffer
()
zfile
=
GzipFile
(
mode
=
'wb'
,
compresslevel
=
6
,
fileobj
=
buf
)
# Output headers...
yield
buf
.
read
()
for
item
in
sequence
:
zfile
.
write
(
item
)
data
=
buf
.
read
()
if
data
:
yield
data
zfile
.
close
()
with
GzipFile
(
mode
=
'wb'
,
compresslevel
=
6
,
fileobj
=
buf
)
as
zfile
:
# Output headers...
yield
buf
.
read
()
for
item
in
sequence
:
zfile
.
write
(
item
)
data
=
buf
.
read
()
if
data
:
yield
data
yield
buf
.
read
()
...
...
tests/test_client/test_conditional_content_removal.py
Dosyayı görüntüle @
a2fb2b3a
...
...
@@ -11,11 +11,8 @@ from django.test.client import conditional_content_removal
# based on Python 3.3's gzip.compress
def
gzip_compress
(
data
):
buf
=
io
.
BytesIO
()
f
=
gzip
.
GzipFile
(
fileobj
=
buf
,
mode
=
'wb'
,
compresslevel
=
0
)
try
:
with
gzip
.
GzipFile
(
fileobj
=
buf
,
mode
=
'wb'
,
compresslevel
=
0
)
as
f
:
f
.
write
(
data
)
finally
:
f
.
close
()
return
buf
.
getvalue
()
...
...
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