Skip to content

Commit 351a3ca

Browse files
committed
Removed several deprecated features for 1.0 (refs #7830):
* "simple" cache backend * `ObjectPaginator` * `edit_inline_type` argument for `ForeignKey` fields * `QOperator`, `QNot`, `QAnd` and `QOr` * `maxlength` argument git-svn-id: http://code.djangoproject.com/svn/django/trunk@8191 bcc190cf-cafb-0310-a4f2-bffc1f526a37
1 parent cbbd54d commit 351a3ca

File tree

17 files changed

+10
-464
lines changed

17 files changed

+10
-464
lines changed

django/core/cache/__init__.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,12 @@
3030
'dummy': 'dummy',
3131
}
3232

33-
DEPRECATED_BACKENDS = {
34-
# deprecated backend --> replacement module
35-
'simple': 'locmem',
36-
}
37-
3833
def get_cache(backend_uri):
3934
if backend_uri.find(':') == -1:
4035
raise InvalidCacheBackendError, "Backend URI must start with scheme://"
4136
scheme, rest = backend_uri.split(':', 1)
4237
if not rest.startswith('//'):
4338
raise InvalidCacheBackendError, "Backend URI must start with scheme://"
44-
if scheme in DEPRECATED_BACKENDS:
45-
import warnings
46-
warnings.warn("'%s' backend is deprecated. Use '%s' instead." %
47-
(scheme, DEPRECATED_BACKENDS[scheme]), DeprecationWarning)
48-
scheme = DEPRECATED_BACKENDS[scheme]
4939

5040
host = rest[2:]
5141
qpos = rest.find('?')

django/core/paginator.py

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -118,65 +118,3 @@ def end_index(self):
118118
if self.number == self.paginator.num_pages:
119119
return self.paginator.count
120120
return self.number * self.paginator.per_page
121-
122-
class ObjectPaginator(Paginator):
123-
"""
124-
Legacy ObjectPaginator class, for backwards compatibility.
125-
126-
Note that each method on this class that takes page_number expects a
127-
zero-based page number, whereas the new API (Paginator/Page) uses one-based
128-
page numbers.
129-
"""
130-
def __init__(self, query_set, num_per_page, orphans=0):
131-
Paginator.__init__(self, query_set, num_per_page, orphans)
132-
import warnings
133-
warnings.warn("The ObjectPaginator is deprecated. Use django.core.paginator.Paginator instead.", DeprecationWarning)
134-
135-
# Keep these attributes around for backwards compatibility.
136-
self.query_set = query_set
137-
self.num_per_page = num_per_page
138-
self._hits = self._pages = None
139-
140-
def validate_page_number(self, page_number):
141-
try:
142-
page_number = int(page_number) + 1
143-
except ValueError:
144-
raise PageNotAnInteger
145-
return self.validate_number(page_number)
146-
147-
def get_page(self, page_number):
148-
try:
149-
page_number = int(page_number) + 1
150-
except ValueError:
151-
raise PageNotAnInteger
152-
return self.page(page_number).object_list
153-
154-
def has_next_page(self, page_number):
155-
return page_number < self.pages - 1
156-
157-
def has_previous_page(self, page_number):
158-
return page_number > 0
159-
160-
def first_on_page(self, page_number):
161-
"""
162-
Returns the 1-based index of the first object on the given page,
163-
relative to total objects found (hits).
164-
"""
165-
page_number = self.validate_page_number(page_number)
166-
return (self.num_per_page * (page_number - 1)) + 1
167-
168-
def last_on_page(self, page_number):
169-
"""
170-
Returns the 1-based index of the last object on the given page,
171-
relative to total objects found (hits).
172-
"""
173-
page_number = self.validate_page_number(page_number)
174-
if page_number == self.num_pages:
175-
return self.count
176-
return page_number * self.num_per_page
177-
178-
# The old API called it "hits" instead of "count".
179-
hits = Paginator.count
180-
181-
# The old API called it "pages" instead of "num_pages".
182-
pages = Paginator.num_pages

django/db/models/fields/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from django.utils.text import capfirst
2323
from django.utils.translation import ugettext_lazy, ugettext as _
2424
from django.utils.encoding import smart_unicode, force_unicode, smart_str
25-
from django.utils.maxlength import LegacyMaxlength
2625
from django.utils import datetime_safe
2726

2827
class NOT_PROVIDED:
@@ -62,10 +61,6 @@ def manipulator_validator_unique(f, opts, self, field_data, all_data):
6261
# getattr(obj, opts.pk.attname)
6362

6463
class Field(object):
65-
# Provide backwards compatibility for the maxlength attribute and
66-
# argument for this class and all subclasses.
67-
__metaclass__ = LegacyMaxlength
68-
6964
# Designates whether empty strings fundamentally are allowed at the
7065
# database level.
7166
empty_strings_allowed = True

django/db/models/fields/related.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -626,11 +626,6 @@ def __init__(self, to, to_field=None, rel_class=ManyToOneRel, **kwargs):
626626
to_field = to_field or to._meta.pk.name
627627
kwargs['verbose_name'] = kwargs.get('verbose_name', None)
628628

629-
if 'edit_inline_type' in kwargs:
630-
import warnings
631-
warnings.warn("edit_inline_type is deprecated. Use edit_inline instead.", DeprecationWarning)
632-
kwargs['edit_inline'] = kwargs.pop('edit_inline_type')
633-
634629
kwargs['rel'] = rel_class(to, to_field,
635630
num_in_admin=kwargs.pop('num_in_admin', 3),
636631
min_num_in_admin=kwargs.pop('min_num_in_admin', None),

django/db/models/fields/subclassing.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
to_python() and the other necessary methods and everything will work seamlessly.
66
"""
77

8-
from django.utils.maxlength import LegacyMaxlength
9-
10-
class SubfieldBase(LegacyMaxlength):
8+
class SubfieldBase(type):
119
"""
1210
A metaclass for custom Field subclasses. This ensures the model's attribute
1311
has the descriptor protocol attached to it.
@@ -50,4 +48,3 @@ def contribute_to_class(self, cls, name):
5048
setattr(cls, self.name, Creator(self))
5149

5250
return contribute_to_class
53-

django/db/models/query.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -757,22 +757,6 @@ def iterator(self):
757757
yield iter([]).next()
758758

759759

760-
# QOperator, QNot, QAnd and QOr are temporarily retained for backwards
761-
# compatibility. All the old functionality is now part of the 'Q' class.
762-
class QOperator(Q):
763-
def __init__(self, *args, **kwargs):
764-
warnings.warn('Use Q instead of QOr, QAnd or QOperation.',
765-
DeprecationWarning, stacklevel=2)
766-
super(QOperator, self).__init__(*args, **kwargs)
767-
768-
QOr = QAnd = QOperator
769-
770-
771-
def QNot(q):
772-
warnings.warn('Use ~q instead of QNot(q)', DeprecationWarning, stacklevel=2)
773-
return ~q
774-
775-
776760
def get_cached_row(klass, row, index_start, max_depth=0, cur_depth=0,
777761
requested=None):
778762
"""

django/oldforms/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from django.conf import settings
66
from django.utils.translation import ugettext, ungettext
77
from django.utils.encoding import smart_unicode, force_unicode
8-
from django.utils.maxlength import LegacyMaxlength
98

109
FORM_FIELD_ID_PREFIX = 'id_'
1110

@@ -304,9 +303,6 @@ class FormField(object):
304303
Subclasses should also implement a render(data) method, which is responsible
305304
for rending the form field in XHTML.
306305
"""
307-
# Provide backwards compatibility for the maxlength attribute and
308-
# argument for this class and all subclasses.
309-
__metaclass__ = LegacyMaxlength
310306

311307
def __str__(self):
312308
return unicode(self).encode('utf-8')

django/utils/maxlength.py

Lines changed: 0 additions & 65 deletions
This file was deleted.

docs/cache.txt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -159,19 +159,6 @@ cache is multi-process and thread-safe. To use it, set ``CACHE_BACKEND`` to
159159

160160
CACHE_BACKEND = 'locmem:///'
161161

162-
Simple caching (for development)
163-
--------------------------------
164-
165-
A simple, single-process memory cache is available as ``"simple:///"``. This
166-
merely saves cached data in-process, which means it should only be used in
167-
development or testing environments. For example::
168-
169-
CACHE_BACKEND = 'simple:///'
170-
171-
**New in Django development version:** This cache backend is deprecated and
172-
will be removed in a future release. New code should use the ``locmem`` backend
173-
instead.
174-
175162
Dummy caching (for development)
176163
-------------------------------
177164

docs/model-api.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,6 @@ The admin represents this as an ``<input type="text">`` (a single-line input).
144144
(in characters) of the field. The max_length is enforced at the database level
145145
and in Django's validation.
146146

147-
Django veterans: Note that the argument is now called ``max_length`` to
148-
provide consistency throughout Django. There is full legacy support for
149-
the old ``maxlength`` argument, but ``max_length`` is preferred.
150-
151147
``CommaSeparatedIntegerField``
152148
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
153149

0 commit comments

Comments
 (0)