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
4c5ed3e6
Kaydet (Commit)
4c5ed3e6
authored
Ock 19, 2017
tarafından
Simon Charette
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #23919 -- Removed __nonzero__() methods (for Python 2).
Thanks Tim for the review.
üst
53f3d53e
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
8 additions
and
34 deletions
+8
-34
context_processors.py
django/contrib/auth/context_processors.py
+0
-3
measure.py
django/contrib/gis/measure.py
+0
-3
base.py
django/core/files/base.py
+0
-6
query.py
django/db/models/query.py
+0
-3
formsets.py
django/forms/formsets.py
+0
-3
datastructures.py
django/utils/datastructures.py
+0
-3
__init__.py
django/utils/translation/__init__.py
+0
-3
tree.py
django/utils/tree.py
+0
-3
models.py
tests/generic_relations_regress/models.py
+2
-3
tests.py
tests/generic_relations_regress/tests.py
+6
-4
No files found.
django/contrib/auth/context_processors.py
Dosyayı görüntüle @
4c5ed3e6
...
@@ -20,9 +20,6 @@ class PermLookupDict:
...
@@ -20,9 +20,6 @@ class PermLookupDict:
def
__bool__
(
self
):
def
__bool__
(
self
):
return
self
.
user
.
has_module_perms
(
self
.
app_label
)
return
self
.
user
.
has_module_perms
(
self
.
app_label
)
def
__nonzero__
(
self
):
# Python 2 compatibility
return
type
(
self
)
.
__bool__
(
self
)
class
PermWrapper
:
class
PermWrapper
:
def
__init__
(
self
,
user
):
def
__init__
(
self
,
user
):
...
...
django/contrib/gis/measure.py
Dosyayı görüntüle @
4c5ed3e6
...
@@ -175,9 +175,6 @@ class MeasureBase:
...
@@ -175,9 +175,6 @@ class MeasureBase:
def
__bool__
(
self
):
def
__bool__
(
self
):
return
bool
(
self
.
standard
)
return
bool
(
self
.
standard
)
def
__nonzero__
(
self
):
# Python 2 compatibility
return
type
(
self
)
.
__bool__
(
self
)
def
default_units
(
self
,
kwargs
):
def
default_units
(
self
,
kwargs
):
"""
"""
Return the unit value and the default units specified
Return the unit value and the default units specified
...
...
django/core/files/base.py
Dosyayı görüntüle @
4c5ed3e6
...
@@ -25,9 +25,6 @@ class File(FileProxyMixin):
...
@@ -25,9 +25,6 @@ class File(FileProxyMixin):
def
__bool__
(
self
):
def
__bool__
(
self
):
return
bool
(
self
.
name
)
return
bool
(
self
.
name
)
def
__nonzero__
(
self
):
# Python 2 compatibility
return
type
(
self
)
.
__bool__
(
self
)
def
__len__
(
self
):
def
__len__
(
self
):
return
self
.
size
return
self
.
size
...
@@ -149,9 +146,6 @@ class ContentFile(File):
...
@@ -149,9 +146,6 @@ class ContentFile(File):
def
__bool__
(
self
):
def
__bool__
(
self
):
return
True
return
True
def
__nonzero__
(
self
):
# Python 2 compatibility
return
type
(
self
)
.
__bool__
(
self
)
def
open
(
self
,
mode
=
None
):
def
open
(
self
,
mode
=
None
):
self
.
seek
(
0
)
self
.
seek
(
0
)
...
...
django/db/models/query.py
Dosyayı görüntüle @
4c5ed3e6
...
@@ -253,9 +253,6 @@ class QuerySet:
...
@@ -253,9 +253,6 @@ class QuerySet:
self
.
_fetch_all
()
self
.
_fetch_all
()
return
bool
(
self
.
_result_cache
)
return
bool
(
self
.
_result_cache
)
def
__nonzero__
(
self
):
# Python 2 compatibility
return
type
(
self
)
.
__bool__
(
self
)
def
__getitem__
(
self
,
k
):
def
__getitem__
(
self
,
k
):
"""
"""
Retrieves an item or slice from the set of results.
Retrieves an item or slice from the set of results.
...
...
django/forms/formsets.py
Dosyayı görüntüle @
4c5ed3e6
...
@@ -78,9 +78,6 @@ class BaseFormSet:
...
@@ -78,9 +78,6 @@ class BaseFormSet:
"""All formsets have a management form which is not included in the length"""
"""All formsets have a management form which is not included in the length"""
return
True
return
True
def
__nonzero__
(
self
):
# Python 2 compatibility
return
type
(
self
)
.
__bool__
(
self
)
@cached_property
@cached_property
def
management_form
(
self
):
def
management_form
(
self
):
"""Returns the ManagementForm instance for this FormSet."""
"""Returns the ManagementForm instance for this FormSet."""
...
...
django/utils/datastructures.py
Dosyayı görüntüle @
4c5ed3e6
...
@@ -32,9 +32,6 @@ class OrderedSet:
...
@@ -32,9 +32,6 @@ class OrderedSet:
def
__bool__
(
self
):
def
__bool__
(
self
):
return
bool
(
self
.
dict
)
return
bool
(
self
.
dict
)
def
__nonzero__
(
self
):
# Python 2 compatibility
return
type
(
self
)
.
__bool__
(
self
)
def
__len__
(
self
):
def
__len__
(
self
):
return
len
(
self
.
dict
)
return
len
(
self
.
dict
)
...
...
django/utils/translation/__init__.py
Dosyayı görüntüle @
4c5ed3e6
...
@@ -114,9 +114,6 @@ def lazy_number(func, resultclass, number=None, **kwargs):
...
@@ -114,9 +114,6 @@ def lazy_number(func, resultclass, number=None, **kwargs):
def
__bool__
(
self
):
def
__bool__
(
self
):
return
bool
(
kwargs
[
'singular'
])
return
bool
(
kwargs
[
'singular'
])
def
__nonzero__
(
self
):
# Python 2 compatibility
return
type
(
self
)
.
__bool__
(
self
)
def
__mod__
(
self
,
rhs
):
def
__mod__
(
self
,
rhs
):
if
isinstance
(
rhs
,
dict
)
and
number
:
if
isinstance
(
rhs
,
dict
)
and
number
:
try
:
try
:
...
...
django/utils/tree.py
Dosyayı görüntüle @
4c5ed3e6
...
@@ -71,9 +71,6 @@ class Node:
...
@@ -71,9 +71,6 @@ class Node:
"""
"""
return
bool
(
self
.
children
)
return
bool
(
self
.
children
)
def
__nonzero__
(
self
):
# Python 2 compatibility
return
type
(
self
)
.
__bool__
(
self
)
def
__contains__
(
self
,
other
):
def
__contains__
(
self
,
other
):
"""
"""
Returns True is 'other' is a direct child of this instance.
Returns True is 'other' is a direct child of this instance.
...
...
tests/generic_relations_regress/models.py
Dosyayı görüntüle @
4c5ed3e6
...
@@ -121,9 +121,8 @@ class Guild(models.Model):
...
@@ -121,9 +121,8 @@ class Guild(models.Model):
name
=
models
.
CharField
(
max_length
=
15
)
name
=
models
.
CharField
(
max_length
=
15
)
members
=
models
.
ManyToManyField
(
Developer
)
members
=
models
.
ManyToManyField
(
Developer
)
def
__nonzero__
(
self
):
def
__bool__
(
self
):
return
False
return
self
.
members
.
count
()
class
Tag
(
models
.
Model
):
class
Tag
(
models
.
Model
):
...
...
tests/generic_relations_regress/tests.py
Dosyayı görüntüle @
4c5ed3e6
...
@@ -119,10 +119,12 @@ class GenericRelationTests(TestCase):
...
@@ -119,10 +119,12 @@ class GenericRelationTests(TestCase):
note
=
Note
(
note
=
'Deserve a bonus'
,
content_object
=
team1
)
note
=
Note
(
note
=
'Deserve a bonus'
,
content_object
=
team1
)
note
.
save
()
note
.
save
()
def
test_target_model_nonzero_false
(
self
):
def
test_target_model_bool_false
(
self
):
"""Test related to #13085"""
"""
# __nonzero__() returns False -- This actually doesn't currently fail.
Saving a model with a GenericForeignKey to a model instance whose
# This test validates that
__bool__ method returns False (Guild.__bool__() here) shouldn't fail
(#13085).
"""
g1
=
Guild
.
objects
.
create
(
name
=
'First guild'
)
g1
=
Guild
.
objects
.
create
(
name
=
'First guild'
)
note
=
Note
(
note
=
'Note for guild'
,
content_object
=
g1
)
note
=
Note
(
note
=
'Note for guild'
,
content_object
=
g1
)
note
.
save
()
note
.
save
()
...
...
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