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
679af405
Kaydet (Commit)
679af405
authored
Mar 12, 2013
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Restricted a workaround for a bug in Python to the affected versions.
üst
e1bafdbf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
decorators.py
django/utils/decorators.py
+10
-2
No files found.
django/utils/decorators.py
Dosyayı görüntüle @
679af405
...
@@ -2,12 +2,16 @@
...
@@ -2,12 +2,16 @@
from
functools
import
wraps
,
update_wrapper
,
WRAPPER_ASSIGNMENTS
from
functools
import
wraps
,
update_wrapper
,
WRAPPER_ASSIGNMENTS
from
django.utils
import
six
class
classonlymethod
(
classmethod
):
class
classonlymethod
(
classmethod
):
def
__get__
(
self
,
instance
,
owner
):
def
__get__
(
self
,
instance
,
owner
):
if
instance
is
not
None
:
if
instance
is
not
None
:
raise
AttributeError
(
"This method is available only on the view class."
)
raise
AttributeError
(
"This method is available only on the view class."
)
return
super
(
classonlymethod
,
self
)
.
__get__
(
instance
,
owner
)
return
super
(
classonlymethod
,
self
)
.
__get__
(
instance
,
owner
)
def
method_decorator
(
decorator
):
def
method_decorator
(
decorator
):
"""
"""
Converts a function decorator into a method decorator
Converts a function decorator into a method decorator
...
@@ -68,9 +72,13 @@ def decorator_from_middleware(middleware_class):
...
@@ -68,9 +72,13 @@ def decorator_from_middleware(middleware_class):
def
available_attrs
(
fn
):
def
available_attrs
(
fn
):
"""
"""
Return the list of functools-wrappable attributes on a callable.
Return the list of functools-wrappable attributes on a callable.
This is required as a workaround for http://bugs.python.org/issue3445.
This is required as a workaround for http://bugs.python.org/issue3445
under Python 2.
"""
"""
return
tuple
(
a
for
a
in
WRAPPER_ASSIGNMENTS
if
hasattr
(
fn
,
a
))
if
six
.
PY3
:
return
WRAPPER_ASSIGNMENTS
else
:
return
tuple
(
a
for
a
in
WRAPPER_ASSIGNMENTS
if
hasattr
(
fn
,
a
))
def
make_middleware_decorator
(
middleware_class
):
def
make_middleware_decorator
(
middleware_class
):
...
...
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