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
cec11a33
Kaydet (Commit)
cec11a33
authored
Eki 10, 2013
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Used "is" for comparisons with None.
üst
ff9e8ecc
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
17 additions
and
16 deletions
+17
-16
message.py
django/core/mail/message.py
+2
-1
widgets.py
django/forms/widgets.py
+1
-1
cache.py
django/middleware/cache.py
+1
-1
defaulttags.py
django/template/defaulttags.py
+1
-1
_doctest.py
django/test/_doctest.py
+1
-1
tests.py
tests/basic/tests.py
+2
-2
test_comment_view.py
tests/comment_tests/tests/test_comment_view.py
+7
-7
tests.py
tests/signals_regress/tests.py
+2
-2
No files found.
django/core/mail/message.py
Dosyayı görüntüle @
cec11a33
...
...
@@ -292,7 +292,8 @@ class EmailMessage(object):
into the resulting message attachments.
"""
if
isinstance
(
filename
,
MIMEBase
):
assert
content
==
mimetype
==
None
assert
content
is
None
assert
mimetype
is
None
self
.
attachments
.
append
(
filename
)
else
:
assert
content
is
not
None
...
...
django/forms/widgets.py
Dosyayı görüntüle @
cec11a33
...
...
@@ -508,7 +508,7 @@ class Select(Widget):
return
mark_safe
(
'
\n
'
.
join
(
output
))
def
render_option
(
self
,
selected_choices
,
option_value
,
option_label
):
if
option_value
==
None
:
if
option_value
is
None
:
option_value
=
''
option_value
=
force_text
(
option_value
)
if
option_value
in
selected_choices
:
...
...
django/middleware/cache.py
Dosyayı görüntüle @
cec11a33
...
...
@@ -96,7 +96,7 @@ class UpdateCacheMiddleware(object):
# Control" header before reverting to using the default cache_timeout
# length.
timeout
=
get_max_age
(
response
)
if
timeout
==
None
:
if
timeout
is
None
:
timeout
=
self
.
cache_timeout
elif
timeout
==
0
:
# max-age was set to 0, don't bother caching.
...
...
django/template/defaulttags.py
Dosyayı görüntüle @
cec11a33
...
...
@@ -315,7 +315,7 @@ class RegroupNode(Node):
def
render
(
self
,
context
):
obj_list
=
self
.
target
.
resolve
(
context
,
True
)
if
obj_list
==
None
:
if
obj_list
is
None
:
# target variable wasn't found in context; fail silently.
context
[
self
.
var_name
]
=
[]
return
''
...
...
django/test/_doctest.py
Dosyayı görüntüle @
cec11a33
...
...
@@ -1345,7 +1345,7 @@ class DocTestRunner:
# exception message will be in group(2)
m
=
re
.
match
(
r'(.*)\.(\w+:.+\s)'
,
exc_msg
)
# make sure there's a match
if
m
!=
None
:
if
m
is
not
None
:
f_name
=
m
.
group
(
1
)
# check to see if m.group(1) contains the module name
if
f_name
==
exception
[
0
]
.
__module__
:
...
...
tests/basic/tests.py
Dosyayı görüntüle @
cec11a33
...
...
@@ -33,7 +33,7 @@ class ModelTest(TestCase):
a
.
save
()
# Now it has an ID.
self
.
assertTrue
(
a
.
id
!=
None
)
self
.
assertTrue
(
a
.
id
is
not
None
)
# Models have a pk property that is an alias for the primary key
# attribute (by default, the 'id' attribute).
...
...
@@ -585,7 +585,7 @@ class ModelTest(TestCase):
f3
=
Field
()
self
.
assertTrue
(
f2
<
f1
)
self
.
assertTrue
(
f3
>
f1
)
self
.
assertFalse
(
f1
==
None
)
self
.
assertFalse
(
f1
is
None
)
self
.
assertFalse
(
f2
in
(
None
,
1
,
''
))
def
test_extra_method_select_argument_with_dashes_and_values
(
self
):
...
...
tests/comment_tests/tests/test_comment_view.py
Dosyayı görüntüle @
cec11a33
...
...
@@ -243,21 +243,21 @@ class CommentViewTests(CommentTestCase):
response
=
self
.
client
.
post
(
"/post/"
,
data
)
location
=
response
[
"Location"
]
match
=
post_redirect_re
.
match
(
location
)
self
.
assertTrue
(
match
!=
None
,
"Unexpected redirect location:
%
s"
%
location
)
self
.
assertTrue
(
match
is
not
None
,
"Unexpected redirect location:
%
s"
%
location
)
data
[
"next"
]
=
"/somewhere/else/"
data
[
"comment"
]
=
"This is another comment"
response
=
self
.
client
.
post
(
"/post/"
,
data
)
location
=
response
[
"Location"
]
match
=
re
.
search
(
r"^http://testserver/somewhere/else/\?c=\d+$"
,
location
)
self
.
assertTrue
(
match
!=
None
,
"Unexpected redirect location:
%
s"
%
location
)
self
.
assertTrue
(
match
is
not
None
,
"Unexpected redirect location:
%
s"
%
location
)
data
[
"next"
]
=
"http://badserver/somewhere/else/"
data
[
"comment"
]
=
"This is another comment with an unsafe next url"
response
=
self
.
client
.
post
(
"/post/"
,
data
)
location
=
response
[
"Location"
]
match
=
post_redirect_re
.
match
(
location
)
self
.
assertTrue
(
match
!=
None
,
"Unsafe redirection to:
%
s"
%
location
)
self
.
assertTrue
(
match
is
not
None
,
"Unsafe redirection to:
%
s"
%
location
)
def
testCommentDoneView
(
self
):
a
=
Article
.
objects
.
get
(
pk
=
1
)
...
...
@@ -265,7 +265,7 @@ class CommentViewTests(CommentTestCase):
response
=
self
.
client
.
post
(
"/post/"
,
data
)
location
=
response
[
"Location"
]
match
=
post_redirect_re
.
match
(
location
)
self
.
assertTrue
(
match
!=
None
,
"Unexpected redirect location:
%
s"
%
location
)
self
.
assertTrue
(
match
is
not
None
,
"Unexpected redirect location:
%
s"
%
location
)
pk
=
int
(
match
.
group
(
'pk'
))
response
=
self
.
client
.
get
(
location
)
self
.
assertTemplateUsed
(
response
,
"comments/posted.html"
)
...
...
@@ -282,7 +282,7 @@ class CommentViewTests(CommentTestCase):
response
=
self
.
client
.
post
(
"/post/"
,
data
)
location
=
response
[
"Location"
]
match
=
re
.
search
(
r"^http://testserver/somewhere/else/\?foo=bar&c=\d+$"
,
location
)
self
.
assertTrue
(
match
!=
None
,
"Unexpected redirect location:
%
s"
%
location
)
self
.
assertTrue
(
match
is
not
None
,
"Unexpected redirect location:
%
s"
%
location
)
def
testCommentPostRedirectWithInvalidIntegerPK
(
self
):
"""
...
...
@@ -311,7 +311,7 @@ class CommentViewTests(CommentTestCase):
response
=
self
.
client
.
post
(
"/post/"
,
data
)
location
=
response
[
"Location"
]
match
=
re
.
search
(
r"^http://testserver/somewhere/else/\?foo=bar&c=\d+#baz$"
,
location
)
self
.
assertTrue
(
match
!=
None
,
"Unexpected redirect location:
%
s"
%
location
)
self
.
assertTrue
(
match
is
not
None
,
"Unexpected redirect location:
%
s"
%
location
)
# Without a query string
a
=
Article
.
objects
.
get
(
pk
=
1
)
...
...
@@ -321,4 +321,4 @@ class CommentViewTests(CommentTestCase):
response
=
self
.
client
.
post
(
"/post/"
,
data
)
location
=
response
[
"Location"
]
match
=
re
.
search
(
r"^http://testserver/somewhere/else/\?c=\d+#baz$"
,
location
)
self
.
assertTrue
(
match
!=
None
,
"Unexpected redirect location:
%
s"
%
location
)
self
.
assertTrue
(
match
is
not
None
,
"Unexpected redirect location:
%
s"
%
location
)
tests/signals_regress/tests.py
Dosyayı görüntüle @
cec11a33
...
...
@@ -34,11 +34,11 @@ class SignalsRegressTests(TestCase):
def
pre_delete_test
(
self
,
signal
,
sender
,
instance
,
**
kwargs
):
self
.
signal_output
.
append
(
'pre_save signal,
%
s'
%
instance
)
self
.
signal_output
.
append
(
'instance.id is not None:
%
s'
%
(
instance
.
id
!=
None
))
self
.
signal_output
.
append
(
'instance.id is not None:
%
s'
%
(
instance
.
id
is
not
None
))
def
post_delete_test
(
self
,
signal
,
sender
,
instance
,
**
kwargs
):
self
.
signal_output
.
append
(
'post_delete signal,
%
s'
%
instance
)
self
.
signal_output
.
append
(
'instance.id is not None:
%
s'
%
(
instance
.
id
!=
None
))
self
.
signal_output
.
append
(
'instance.id is not None:
%
s'
%
(
instance
.
id
is
not
None
))
def
setUp
(
self
):
self
.
signal_output
=
[]
...
...
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