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
e84f79f0
Kaydet (Commit)
e84f79f0
authored
May 03, 2012
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #18042 -- Advanced deprecation warnings.
Thanks Ramiro for the patch.
üst
227cec68
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
75 additions
and
38 deletions
+75
-38
__init__.py
django/conf/__init__.py
+1
-1
defaults.py
django/conf/urls/defaults.py
+1
-1
adminmedia.py
django/contrib/admin/templatetags/adminmedia.py
+1
-1
__init__.py
django/contrib/databrowse/__init__.py
+1
-2
__init__.py
django/contrib/formtools/tests/__init__.py
+9
-0
legacy.py
django/contrib/formtools/wizard/legacy.py
+1
-1
geoip.py
django/contrib/gis/utils/geoip.py
+1
-1
forms.py
django/contrib/localflavor/uk/forms.py
+1
-1
uk_regions.py
django/contrib/localflavor/uk/uk_regions.py
+1
-1
memcached.py
django/core/cache/backends/memcached.py
+1
-1
__init__.py
django/core/management/__init__.py
+2
-2
__init__.py
django/http/__init__.py
+1
-1
common.py
django/middleware/common.py
+2
-4
defaultfilters.py
django/template/defaultfilters.py
+1
-1
copycompat.py
django/utils/copycompat.py
+1
-1
hashcompat.py
django/utils/hashcompat.py
+1
-1
itercompat.py
django/utils/itercompat.py
+2
-4
text.py
django/utils/text.py
+2
-2
cache.py
django/views/decorators/cache.py
+2
-2
csrf.py
django/views/decorators/csrf.py
+2
-2
tests.py
tests/regressiontests/cache/tests.py
+6
-0
tests.py
tests/regressiontests/decorators/tests.py
+1
-1
tests.py
tests/regressiontests/logging_tests/tests.py
+9
-2
tests.py
tests/regressiontests/requests/tests.py
+7
-2
tests.py
tests/regressiontests/settings_tests/tests.py
+5
-0
text.py
tests/regressiontests/utils/text.py
+12
-2
runtests.py
tests/runtests.py
+1
-1
No files found.
django/conf/__init__.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -181,7 +181,7 @@ def compat_patch_logging_config(logging_config):
"handler: adding implicit debug-false-only filter. "
"See http://docs.djangoproject.com/en/dev/releases/1.4/"
"#request-exceptions-are-now-always-logged"
,
Pending
DeprecationWarning
)
DeprecationWarning
)
filter_name
=
"require_debug_false"
...
...
django/conf/urls/defaults.py
Dosyayı görüntüle @
e84f79f0
import
warnings
warnings
.
warn
(
"django.conf.urls.defaults is deprecated; use django.conf.urls instead"
,
Pending
DeprecationWarning
)
DeprecationWarning
)
from
django.conf.urls
import
(
handler403
,
handler404
,
handler500
,
include
,
patterns
,
url
)
django/contrib/admin/templatetags/adminmedia.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -11,5 +11,5 @@ def admin_media_prefix():
"""
warnings
.
warn
(
"The admin_media_prefix template tag is deprecated. "
"Use the static template tag instead."
,
Pending
DeprecationWarning
)
"Use the static template tag instead."
,
DeprecationWarning
)
return
PrefixNode
.
handle_simple
(
"ADMIN_MEDIA_PREFIX"
)
django/contrib/databrowse/__init__.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -2,5 +2,4 @@ import warnings
from
django.contrib.databrowse.sites
import
DatabrowsePlugin
,
ModelDatabrowse
,
DatabrowseSite
,
site
warnings
.
warn
(
"The Databrowse contrib app is deprecated"
,
PendingDeprecationWarning
)
warnings
.
warn
(
"The Databrowse contrib app is deprecated"
,
DeprecationWarning
)
django/contrib/formtools/tests/__init__.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -7,6 +7,7 @@ from django.conf import settings
from
django.contrib.formtools
import
preview
,
utils
from
django.contrib.formtools.wizard
import
FormWizard
from
django.test
import
TestCase
from
django.test.utils
import
get_warnings_state
,
restore_warnings_state
from
django.test.utils
import
override_settings
from
django.utils
import
unittest
...
...
@@ -40,12 +41,20 @@ class PreviewTests(TestCase):
def
setUp
(
self
):
super
(
PreviewTests
,
self
)
.
setUp
()
self
.
save_warnings_state
()
warnings
.
filterwarnings
(
'ignore'
,
category
=
DeprecationWarning
,
module
=
'django.contrib.formtools.wizard.legacy'
)
# Create a FormPreview instance to share between tests
self
.
preview
=
preview
.
FormPreview
(
TestForm
)
input_template
=
'<input type="hidden" name="
%
s" value="
%
s" />'
self
.
input
=
input_template
%
(
self
.
preview
.
unused_name
(
'stage'
),
"
%
d"
)
self
.
test_data
=
{
'field1'
:
u'foo'
,
'field1_'
:
u'asdf'
}
def
tearDown
(
self
):
super
(
PreviewTests
,
self
)
.
tearDown
()
self
.
restore_warnings_state
()
def
test_unused_name
(
self
):
"""
Verifies name mangling to get uniue field name.
...
...
django/contrib/formtools/wizard/legacy.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -39,7 +39,7 @@ class FormWizard(object):
warnings
.
warn
(
'Old-style form wizards have been deprecated; use the class-based '
'views in django.contrib.formtools.wizard.views instead.'
,
Pending
DeprecationWarning
)
DeprecationWarning
)
def
__repr__
(
self
):
return
"step:
%
d
\n
form_list:
%
s
\n
initial_data:
%
s"
%
(
self
.
step
,
self
.
form_list
,
self
.
initial
)
...
...
django/contrib/gis/utils/geoip.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -10,5 +10,5 @@ if HAS_GEOIP:
def
__init__
(
self
,
*
args
,
**
kwargs
):
warnings
.
warn
(
'GeoIP class has been moved to `django.contrib.gis.geoip`, and '
'this shortcut will disappear in Django v1.6.'
,
Pending
DeprecationWarning
,
stacklevel
=
2
)
DeprecationWarning
,
stacklevel
=
2
)
super
(
GeoIP
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
django/contrib/localflavor/uk/forms.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -3,7 +3,7 @@ from django.contrib.localflavor.gb import forms
import
warnings
warnings
.
warn
(
'The "UK" prefix for United Kingdom has been deprecated in favour of the '
'GB code. Please use the new GB-prefixed names.'
,
Pending
DeprecationWarning
)
'GB code. Please use the new GB-prefixed names.'
,
DeprecationWarning
)
UKPostcodeField
=
forms
.
GBPostcodeField
UKCountySelect
=
forms
.
GBCountySelect
...
...
django/contrib/localflavor/uk/uk_regions.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -6,7 +6,7 @@ from django.contrib.localflavor.gb.gb_regions import (
import
warnings
warnings
.
warn
(
'The "UK" prefix for United Kingdom has been deprecated in favour of the '
'GB code. Please use the new GB-prefixed names.'
,
Pending
DeprecationWarning
)
'GB code. Please use the new GB-prefixed names.'
,
DeprecationWarning
)
UK_NATIONS_CHOICES
=
GB_NATIONS_CHOICES
UK_REGION_CHOICES
=
GB_REGION_CHOICES
django/core/cache/backends/memcached.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -130,7 +130,7 @@ class CacheClass(BaseMemcachedCache):
import
warnings
warnings
.
warn
(
"memcached.CacheClass has been split into memcached.MemcachedCache and memcached.PyLibMCCache. Please update your cache backend setting."
,
Pending
DeprecationWarning
DeprecationWarning
)
try
:
import
memcache
...
...
django/core/management/__init__.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -395,7 +395,7 @@ def setup_environ(settings_mod, original_settings_path=None):
"you likely need to update your 'manage.py'; "
"please see the Django 1.4 release notes "
"(https://docs.djangoproject.com/en/dev/releases/1.4/)."
,
Pending
DeprecationWarning
)
DeprecationWarning
)
# Add this project to sys.path so that it's importable in the conventional
# way. For example, if this file (manage.py) lives in a directory
...
...
@@ -451,7 +451,7 @@ def execute_manager(settings_mod, argv=None):
"you likely need to update your 'manage.py'; "
"please see the Django 1.4 release notes "
"(https://docs.djangoproject.com/en/dev/releases/1.4/)."
,
Pending
DeprecationWarning
)
DeprecationWarning
)
setup_environ
(
settings_mod
)
utility
=
ManagementUtility
(
argv
)
...
...
django/http/__init__.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -297,7 +297,7 @@ class HttpRequest(object):
@property
def
raw_post_data
(
self
):
warnings
.
warn
(
'HttpRequest.raw_post_data has been deprecated. Use HttpRequest.body instead.'
,
Pending
DeprecationWarning
)
warnings
.
warn
(
'HttpRequest.raw_post_data has been deprecated. Use HttpRequest.body instead.'
,
DeprecationWarning
)
return
self
.
body
def
_mark_post_parse_error
(
self
):
...
...
django/middleware/common.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -130,16 +130,14 @@ def _is_ignorable_404(uri):
if
getattr
(
settings
,
'IGNORABLE_404_STARTS'
,
()):
import
warnings
warnings
.
warn
(
'The IGNORABLE_404_STARTS setting has been deprecated '
'in favor of IGNORABLE_404_URLS.'
,
PendingDeprecationWarning
)
'in favor of IGNORABLE_404_URLS.'
,
DeprecationWarning
)
for
start
in
settings
.
IGNORABLE_404_STARTS
:
if
uri
.
startswith
(
start
):
return
True
if
getattr
(
settings
,
'IGNORABLE_404_ENDS'
,
()):
import
warnings
warnings
.
warn
(
'The IGNORABLE_404_ENDS setting has been deprecated '
'in favor of IGNORABLE_404_URLS.'
,
PendingDeprecationWarning
)
'in favor of IGNORABLE_404_URLS.'
,
DeprecationWarning
)
for
end
in
settings
.
IGNORABLE_404_ENDS
:
if
uri
.
endswith
(
end
):
return
True
...
...
django/template/defaultfilters.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -53,7 +53,7 @@ def stringfilter(func):
warnings
.
warn
(
"Setting the
%
s attribute of a template filter "
"function is deprecated; use @register.filter(
%
s=
%
s) "
"instead"
%
(
attr
,
attr
,
getattr
(
func
,
attr
)),
Pending
DeprecationWarning
)
DeprecationWarning
)
setattr
(
_dec
,
attr
,
getattr
(
func
,
attr
))
return
wraps
(
func
)(
_dec
)
...
...
django/utils/copycompat.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -7,7 +7,7 @@ import types
import
warnings
warnings
.
warn
(
"django.utils.copycompat is deprecated; use the native copy module instead"
,
Pending
DeprecationWarning
)
DeprecationWarning
)
# Monkeypatch copy's deepcopy registry to handle functions correctly.
if
(
hasattr
(
copy
,
'_deepcopy_dispatch'
)
and
types
.
FunctionType
not
in
copy
.
_deepcopy_dispatch
):
...
...
django/utils/hashcompat.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -6,7 +6,7 @@ interface to the md5 and sha constructors, depending on system version.
import
warnings
warnings
.
warn
(
"django.utils.hashcompat is deprecated; use hashlib instead"
,
Pending
DeprecationWarning
)
DeprecationWarning
)
import
hashlib
md5_constructor
=
hashlib
.
md5
...
...
django/utils/itercompat.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -18,18 +18,16 @@ def is_iterable(x):
return
True
def
product
(
*
args
,
**
kwds
):
# PendingDeprecationWarning in 1.5, remove this comment when the Deprecations
# will have been advanced for 1.5
warnings
.
warn
(
"django.utils.itercompat.product is deprecated; use the native version instead"
,
PendingDeprecationWarning
)
return
itertools
.
product
(
*
args
,
**
kwds
)
def
all
(
iterable
):
warnings
.
warn
(
"django.utils.itercompat.all is deprecated; use the native version instead"
,
Pending
DeprecationWarning
)
DeprecationWarning
)
return
__builtin__
.
all
(
iterable
)
def
any
(
iterable
):
warnings
.
warn
(
"django.utils.itercompat.any is deprecated; use the native version instead"
,
Pending
DeprecationWarning
)
DeprecationWarning
)
return
__builtin__
.
any
(
iterable
)
django/utils/text.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -206,14 +206,14 @@ class Truncator(SimpleLazyObject):
def
truncate_words
(
s
,
num
,
end_text
=
'...'
):
warnings
.
warn
(
'This function has been deprecated. Use the Truncator class '
'in django.utils.text instead.'
,
category
=
Pending
DeprecationWarning
)
'in django.utils.text instead.'
,
category
=
DeprecationWarning
)
truncate
=
end_text
and
'
%
s'
%
end_text
or
''
return
Truncator
(
s
)
.
words
(
num
,
truncate
=
truncate
)
truncate_words
=
allow_lazy
(
truncate_words
,
unicode
)
def
truncate_html_words
(
s
,
num
,
end_text
=
'...'
):
warnings
.
warn
(
'This function has been deprecated. Use the Truncator class '
'in django.utils.text instead.'
,
category
=
Pending
DeprecationWarning
)
'in django.utils.text instead.'
,
category
=
DeprecationWarning
)
truncate
=
end_text
and
'
%
s'
%
end_text
or
''
return
Truncator
(
s
)
.
words
(
num
,
truncate
=
truncate
,
html
=
True
)
truncate_html_words
=
allow_lazy
(
truncate_html_words
,
unicode
)
...
...
django/views/decorators/cache.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -44,8 +44,8 @@ def cache_page(*args, **kwargs):
warnings
.
warn
(
'The cache_page decorator must be called like: '
'cache_page(timeout, [cache=cache name], [key_prefix=key prefix]). '
'All other ways are deprecated.'
,
Pending
DeprecationWarning
,
stacklevel
=
3
)
DeprecationWarning
,
stacklevel
=
2
)
if
len
(
args
)
>
1
:
assert
len
(
args
)
==
2
,
"cache_page accepts at most 2 arguments"
...
...
django/views/decorators/csrf.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -55,7 +55,7 @@ def csrf_response_exempt(view_func):
"""
warnings
.
warn
(
"csrf_response_exempt is deprecated. It no longer performs a "
"function, and calls to it can be removed."
,
Pending
DeprecationWarning
)
DeprecationWarning
)
return
view_func
def
csrf_view_exempt
(
view_func
):
...
...
@@ -63,7 +63,7 @@ def csrf_view_exempt(view_func):
Marks a view function as being exempt from CSRF view protection.
"""
warnings
.
warn
(
"csrf_view_exempt is deprecated. Use csrf_exempt instead."
,
Pending
DeprecationWarning
)
DeprecationWarning
)
return
csrf_exempt
(
view_func
)
def
csrf_exempt
(
view_func
):
...
...
tests/regressiontests/cache/tests.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -1442,12 +1442,18 @@ def hello_world_view(request, value):
)
class
CacheMiddlewareTest
(
TestCase
):
# The following tests will need to be modified in Django 1.6 to not use
# deprecated ways of using the cache_page decorator that will be removed in
# such version
def
setUp
(
self
):
self
.
factory
=
RequestFactory
()
self
.
default_cache
=
get_cache
(
'default'
)
self
.
other_cache
=
get_cache
(
'other'
)
self
.
save_warnings_state
()
warnings
.
filterwarnings
(
'ignore'
,
category
=
DeprecationWarning
,
module
=
'django.views.decorators.cache'
)
def
tearDown
(
self
):
self
.
restore_warnings_state
()
self
.
default_cache
.
clear
()
self
.
other_cache
.
clear
()
...
...
tests/regressiontests/decorators/tests.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -70,7 +70,7 @@ class DecoratorsTest(TestCase):
def
setUp
(
self
):
self
.
warning_state
=
get_warnings_state
()
warnings
.
filterwarnings
(
'ignore'
,
category
=
Pending
DeprecationWarning
,
warnings
.
filterwarnings
(
'ignore'
,
category
=
DeprecationWarning
,
module
=
'django.views.decorators.cache'
)
def
tearDown
(
self
):
...
...
tests/regressiontests/logging_tests/tests.py
Dosyayı görüntüle @
e84f79f0
import
copy
import
warnings
from
django.conf
import
compat_patch_logging_config
from
django.core
import
mail
from
django.test
import
TestCase
,
RequestFactory
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
,
get_warnings_state
,
restore_warnings_state
from
django.utils.log
import
CallbackFilter
,
RequireDebugFalse
,
getLogger
...
...
@@ -40,7 +41,13 @@ class PatchLoggingConfigTest(TestCase):
"""
config
=
copy
.
deepcopy
(
OLD_LOGGING
)
compat_patch_logging_config
(
config
)
warnings_state
=
get_warnings_state
()
warnings
.
filterwarnings
(
'ignore'
,
category
=
DeprecationWarning
,
module
=
'django.conf'
)
try
:
compat_patch_logging_config
(
config
)
finally
:
restore_warnings_state
(
warnings_state
)
self
.
assertEqual
(
config
[
"handlers"
][
"mail_admins"
][
"filters"
],
...
...
tests/regressiontests/requests/tests.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -420,5 +420,10 @@ class RequestsTests(unittest.TestCase):
'CONTENT_LENGTH'
:
len
(
payload
),
'wsgi.input'
:
ExplodingStringIO
(
payload
)})
with
self
.
assertRaises
(
UnreadablePostError
):
request
.
raw_post_data
warnings_state
=
get_warnings_state
()
warnings
.
filterwarnings
(
'ignore'
,
category
=
DeprecationWarning
,
module
=
'django.http'
)
try
:
with
self
.
assertRaises
(
UnreadablePostError
):
request
.
raw_post_data
finally
:
restore_warnings_state
(
warnings_state
)
tests/regressiontests/settings_tests/tests.py
Dosyayı görüntüle @
e84f79f0
import
os
import
warnings
from
django.conf
import
settings
,
global_settings
from
django.core.exceptions
import
ImproperlyConfigured
...
...
@@ -274,10 +275,14 @@ class EnvironmentVariableTest(TestCase):
Ensures proper settings file is used in setup_environ if
DJANGO_SETTINGS_MODULE is set in the environment.
"""
# Decide what to do with these tests when setup_environ() gets removed in Django 1.6
def
setUp
(
self
):
self
.
original_value
=
os
.
environ
.
get
(
'DJANGO_SETTINGS_MODULE'
)
self
.
save_warnings_state
()
warnings
.
filterwarnings
(
'ignore'
,
category
=
DeprecationWarning
,
module
=
'django.core.management'
)
def
tearDown
(
self
):
self
.
restore_warnings_state
()
if
self
.
original_value
:
os
.
environ
[
'DJANGO_SETTINGS_MODULE'
]
=
self
.
original_value
elif
'DJANGO_SETTINGS_MODULE'
in
os
.
environ
:
...
...
tests/regressiontests/utils/text.py
Dosyayı görüntüle @
e84f79f0
# -*- coding: utf-8 -*-
import
unittest
import
warnings
from
django.test
import
SimpleTestCase
from
django.utils
import
text
class
TestUtilsText
(
unittest
.
TestCase
):
class
TestUtilsText
(
SimpleTestCase
):
# In Django 1.6 truncate_words() and truncate_html_words() will be removed
# so these tests will need to be adapted accordingly
def
setUp
(
self
):
self
.
save_warnings_state
()
warnings
.
filterwarnings
(
'ignore'
,
category
=
DeprecationWarning
,
module
=
'django.utils.text'
)
def
tearDown
(
self
):
self
.
restore_warnings_state
()
def
test_truncate_chars
(
self
):
truncator
=
text
.
Truncator
(
...
...
tests/runtests.py
Dosyayı görüntüle @
e84f79f0
...
...
@@ -10,7 +10,7 @@ from django import contrib
# databrowse is deprecated, but we still want to run its tests
warnings
.
filterwarnings
(
'ignore'
,
"The Databrowse contrib app is deprecated"
,
Pending
DeprecationWarning
,
'django.contrib.databrowse'
)
DeprecationWarning
,
'django.contrib.databrowse'
)
CONTRIB_DIR_NAME
=
'django.contrib'
MODEL_TESTS_DIR_NAME
=
'modeltests'
...
...
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