Ticket #2109: new_style.diff

File new_style.diff, 35.4 KB (added by nico@…, 20 years ago)
  • django/db/models/options.py

     
    1515                 'unique_together', 'permissions', 'get_latest_by',
    1616                 'order_with_respect_to', 'app_label')
    1717
    18 class Options:
     18class Options(object):
    1919    def __init__(self, meta):
    2020        self.fields, self.many_to_many = [], []
    2121        self.module_name, self.verbose_name = None, None
    … …  
    195195                self._field_types[field_type] = False
    196196        return self._field_types[field_type]
    197197
    198 class AdminOptions:
     198class AdminOptions(object):
    199199    def __init__(self, fields=None, js=None, list_display=None, list_filter=None,
    200200        date_hierarchy=None, save_as=False, ordering=None, search_fields=None,
    201201        save_on_top=False, list_select_related=False, manager=None, list_per_page=100):
  • django/db/models/fields/__init__.py

     
    99from django.utils.translation import gettext, gettext_lazy, ngettext
    1010import datetime, os, time
    1111
    12 class NOT_PROVIDED:
     12class NOT_PROVIDED(object):
    1313    pass
    1414
    1515# Values for filter_interface.
    … …  
    535535        if not self.blank:
    536536            if rel:
    537537                # This validator makes sure FileFields work in a related context.
    538                 class RequiredFileField:
     538                class RequiredFileField(object):
    539539                    def __init__(self, other_field_names, other_file_field_name):
    540540                        self.other_field_names = other_field_names
    541541                        self.other_file_field_name = other_file_field_name
  • django/db/models/fields/related.py

     
    667667    def set_attributes_from_rel(self):
    668668        pass
    669669
    670 class ManyToOneRel:
     670class ManyToOneRel(object):
    671671    def __init__(self, to, field_name, num_in_admin=3, min_num_in_admin=None,
    672672        max_num_in_admin=None, num_extra_on_change=1, edit_inline=False,
    673673        related_name=None, limit_choices_to=None, lookup_overrides=None, raw_id_admin=False):
    … …  
    704704        self.raw_id_admin = raw_id_admin
    705705        self.multiple = False
    706706
    707 class ManyToManyRel:
     707class ManyToManyRel(object):
    708708    def __init__(self, to, num_in_admin=0, related_name=None,
    709709        filter_interface=None, limit_choices_to=None, raw_id_admin=False, symmetrical=True):
    710710        self.to = to
  • django/db/models/__init__.py

     
    1515# Admin stages.
    1616ADD, CHANGE, BOTH = 1, 2, 3
    1717
    18 class LazyDate:
     18class LazyDate(object):
    1919    """
    2020    Use in limit_choices_to to compare the field to dates calculated at run time
    2121    instead of when the model is loaded.  For example::
  • django/db/models/query.py

     
    546546        c._order = self._order
    547547        return c
    548548
    549 class QOperator:
     549class QOperator(object):
    550550    "Base class for QAnd and QOr"
    551551    def __init__(self, *args):
    552552        self.args = args
  • django/db/backends/sqlite3/introspection.py

     
    3535# This light wrapper "fakes" a dictionary interface, because some SQLite data
    3636# types include variables in them -- e.g. "varchar(30)" -- and can't be matched
    3737# as a simple dictionary lookup.
    38 class FlexibleFieldLookupDict:
     38class FlexibleFieldLookupDict(object):
    3939    def __getitem__(self, key):
    4040        key = key.lower()
    4141        try:
  • django/db/backends/util.py

     
    11import datetime
    22from time import time
    33
    4 class CursorDebugWrapper:
     4class CursorDebugWrapper(object):
    55    def __init__(self, cursor, db):
    66        self.cursor = cursor
    77        self.db = db
  • django/db/backends/mysql/base.py

     
    2626
    2727# This is an extra debug layer over MySQL queries, to display warnings.
    2828# It's only used when DEBUG=True.
    29 class MysqlDebugWrapper:
     29class MysqlDebugWrapper(object):
    3030    def __init__(self, cursor):
    3131        self.cursor = cursor
    3232
  • django/db/backends/dummy/base.py

     
    1515class DatabaseError(Exception):
    1616    pass
    1717
    18 class DatabaseWrapper:
     18class DatabaseWrapper(object):
    1919    cursor = complain
    2020    _commit = complain
    2121    _rollback = complain
  • django/conf/__init__.py

     
    1212
    1313ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE"
    1414
    15 class LazySettings:
     15class LazySettings(object):
    1616    """
    1717    A lazy proxy for either global Django settings or a custom settings object.
    1818    The user can manually configure settings prior to using them. Otherwise,
    … …  
    6767            setattr(holder, name, value)
    6868        self._target = holder
    6969
    70 class Settings:
     70class Settings(object):
    7171    def __init__(self, settings_module):
    7272        # update this dict from global settings (but only for ALL_CAPS settings)
    7373        for setting in dir(global_settings):
    … …  
    112112    def get_all_members(self):
    113113        return dir(self)
    114114
    115 class UserSettingsHolder:
     115class UserSettingsHolder(object):
    116116    """
    117117    Holder for user configured settings.
    118118    """
  • django/forms/__init__.py

     
    101101        for field in self.fields:
    102102            field.convert_post_data(new_data)
    103103
    104 class FormWrapper:
     104class FormWrapper(object):
    105105    """
    106106    A wrapper linking a Manipulator to the template system.
    107107    This allows dictionary-style lookups of formfields. It also handles feeding
    … …  
    150150
    151151    fields = property(_get_fields)
    152152
    153 class FormFieldWrapper:
     153class FormFieldWrapper(object):
    154154    "A bridge between the template system and an individual form field. Used by FormWrapper."
    155155    def __init__(self, formfield, data, error_list):
    156156        self.formfield, self.data, self.error_list = formfield, data, error_list
    … …  
    211211    def html_combined_error_list(self):
    212212        return ''.join([field.html_error_list() for field in self.formfield_dict.values() if hasattr(field, 'errors')])
    213213
    214 class InlineObjectCollection:
     214class InlineObjectCollection(object):
    215215    "An object that acts like a sparse list of form field collections."
    216216    def __init__(self, parent_manipulator, rel_obj, data, errors):
    217217        self.parent_manipulator = parent_manipulator
    … …  
    269269            self._collections = collections
    270270
    271271
    272 class FormField:
     272class FormField(object):
    273273    """Abstract class representing a form field.
    274274
    275275    Classes that extend FormField should define the following attributes:
    … …  
    521521                {{ option.field }} {{ option.label }}<br />
    522522            {% endfor %}
    523523        """
    524         class RadioFieldRenderer:
     524        class RadioFieldRenderer(object):
    525525            def __init__(self, datalist, ul_class):
    526526                self.datalist, self.ul_class = datalist, ul_class
    527527            def __str__(self):
  • django/core/servers/basehttp.py

     
    2121class WSGIServerException(Exception):
    2222    pass
    2323
    24 class FileWrapper:
     24class FileWrapper(object):
    2525    """Wrapper to convert file-like objects to iterables"""
    2626
    2727    def __init__(self, filelike, blksize=8192):
    … …  
    6363    else:
    6464        return param
    6565
    66 class Headers:
     66class Headers(object):
    6767    """Manage a collection of HTTP response headers"""
    6868    def __init__(self,headers):
    6969        if type(headers) is not ListType:
    … …  
    218218    """Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header"""
    219219    return _hoppish(header_name.lower())
    220220
    221 class ServerHandler:
     221class ServerHandler(object):
    222222    """Manage the invocation of a WSGI application"""
    223223
    224224    # Configuration parameters; can override per-subclass or per-instance
    … …  
    591591            return
    592592        sys.stderr.write("[%s] %s\n" % (self.log_date_time_string(), format % args))
    593593
    594 class AdminMediaHandler:
     594class AdminMediaHandler(object):
    595595    """
    596596    WSGI middleware that intercepts calls to the admin media directory, as
    597597    defined by the ADMIN_MEDIA_PREFIX setting, and serves those images.
  • django/core/context_processors.py

     
    4848# PermWrapper and PermLookupDict proxy the permissions system into objects that
    4949# the template system can understand.
    5050
    51 class PermLookupDict:
     51class PermLookupDict(object):
    5252    def __init__(self, user, module_name):
    5353        self.user, self.module_name = user, module_name
    5454    def __repr__(self):
    … …  
    5858    def __nonzero__(self):
    5959        return self.user.has_module_perms(self.module_name)
    6060
    61 class PermWrapper:
     61class PermWrapper(object):
    6262    def __init__(self, user):
    6363        self.user = user
    6464    def __getitem__(self, module_name):
  • django/core/urlresolvers.py

     
    8383            raise NoReverseMatch("Value %r didn't match regular expression %r" % (value, test_regex))
    8484        return str(value) # TODO: Unicode?
    8585
    86 class RegexURLPattern:
     86class RegexURLPattern(object):
    8787    def __init__(self, regex, callback, default_args=None):
    8888        # regex is a string representing a regular expression.
    8989        # callback is something like 'foo.views.news.stories.story_detail',
  • django/core/validators.py

     
    237237            "Watch your mouth! The words %s are not allowed here.", plural) % \
    238238            get_text_list(['"%s%s%s"' % (i[0], '-'*(len(i)-2), i[-1]) for i in words_seen], 'and')
    239239
    240 class AlwaysMatchesOtherField:
     240class AlwaysMatchesOtherField(object):
    241241    def __init__(self, other_field_name, error_message=None):
    242242        self.other = other_field_name
    243243        self.error_message = error_message or lazy_inter(gettext_lazy("This field must match the '%s' field."), self.other)
    … …  
    247247        if field_data != all_data[self.other]:
    248248            raise ValidationError, self.error_message
    249249
    250 class ValidateIfOtherFieldEquals:
     250class ValidateIfOtherFieldEquals(object):
    251251    def __init__(self, other_field, other_value, validator_list):
    252252        self.other_field, self.other_value = other_field, other_value
    253253        self.validator_list = validator_list
    … …  
    258258            for v in self.validator_list:
    259259                v(field_data, all_data)
    260260
    261 class RequiredIfOtherFieldNotGiven:
     261class RequiredIfOtherFieldNotGiven(object):
    262262    def __init__(self, other_field_name, error_message=gettext_lazy("Please enter something for at least one field.")):
    263263        self.other, self.error_message = other_field_name, error_message
    264264        self.always_test = True
    … …  
    267267        if not all_data.get(self.other, False) and not field_data:
    268268            raise ValidationError, self.error_message
    269269
    270 class RequiredIfOtherFieldsGiven:
     270class RequiredIfOtherFieldsGiven(object):
    271271    def __init__(self, other_field_names, error_message=gettext_lazy("Please enter both fields or leave them both empty.")):
    272272        self.other, self.error_message = other_field_names, error_message
    273273        self.always_test = True
    … …  
    282282    def __init__(self, other_field_name, error_message=gettext_lazy("Please enter both fields or leave them both empty.")):
    283283        RequiredIfOtherFieldsGiven.__init__(self, [other_field_name], error_message)
    284284
    285 class RequiredIfOtherFieldEquals:
     285class RequiredIfOtherFieldEquals(object):
    286286    def __init__(self, other_field, other_value, error_message=None):
    287287        self.other_field = other_field
    288288        self.other_value = other_value
    … …  
    294294        if all_data.has_key(self.other_field) and all_data[self.other_field] == self.other_value and not field_data:
    295295            raise ValidationError(self.error_message)
    296296
    297 class RequiredIfOtherFieldDoesNotEqual:
     297class RequiredIfOtherFieldDoesNotEqual(object):
    298298    def __init__(self, other_field, other_value, error_message=None):
    299299        self.other_field = other_field
    300300        self.other_value = other_value
    … …  
    306306        if all_data.has_key(self.other_field) and all_data[self.other_field] != self.other_value and not field_data:
    307307            raise ValidationError(self.error_message)
    308308
    309 class IsLessThanOtherField:
     309class IsLessThanOtherField(object):
    310310    def __init__(self, other_field_name, error_message):
    311311        self.other, self.error_message = other_field_name, error_message
    312312
    … …  
    314314        if field_data > all_data[self.other]:
    315315            raise ValidationError, self.error_message
    316316
    317 class UniqueAmongstFieldsWithPrefix:
     317class UniqueAmongstFieldsWithPrefix(object):
    318318    def __init__(self, field_name, prefix, error_message):
    319319        self.field_name, self.prefix = field_name, prefix
    320320        self.error_message = error_message or gettext_lazy("Duplicate values are not allowed.")
    … …  
    324324            if field_name != self.field_name and value == field_data:
    325325                raise ValidationError, self.error_message
    326326
    327 class IsAPowerOf:
     327class IsAPowerOf(object):
    328328    """
    329329    >>> v = IsAPowerOf(2)
    330330    >>> v(4, None)
    … …  
    342342        if val != int(val):
    343343            raise ValidationError, gettext("This value must be a power of %s.") % self.power_of
    344344
    345 class IsValidFloat:
     345class IsValidFloat(object):
    346346    def __init__(self, max_digits, decimal_places):
    347347        self.max_digits, self.decimal_places = max_digits, decimal_places
    348348
    … …  
    359359            raise ValidationError, ngettext("Please enter a valid decimal number with at most %s decimal place.",
    360360                "Please enter a valid decimal number with at most %s decimal places.", self.decimal_places) % self.decimal_places
    361361
    362 class HasAllowableSize:
     362class HasAllowableSize(object):
    363363    """
    364364    Checks that the file-upload field data is a certain size. min_size and
    365365    max_size are measurements in bytes.
    … …  
    379379        if self.max_size is not None and len(content) > self.max_size:
    380380            raise ValidationError, self.max_error_message
    381381
    382 class MatchesRegularExpression:
     382class MatchesRegularExpression(object):
    383383    """
    384384    Checks that the field matches the given regular-expression. The regex
    385385    should be in string format, not already compiled.
    … …  
    392392        if not self.regexp.search(field_data):
    393393            raise ValidationError(self.error_message)
    394394
    395 class AnyValidator:
     395class AnyValidator(object):
    396396    """
    397397    This validator tries all given validators. If any one of them succeeds,
    398398    validation passes. If none of them succeeds, the given message is thrown
    … …  
    416416                pass
    417417        raise ValidationError(self.error_message)
    418418
    419 class URLMimeTypeCheck:
     419class URLMimeTypeCheck(object):
    420420    "Checks that the provided URL points to a document with a listed mime type"
    421421    class CouldNotRetrieve(ValidationError):
    422422        pass
    … …  
    441441            raise URLMimeTypeCheck.InvalidContentType, gettext("The URL %(url)s returned the invalid Content-Type header '%(contenttype)s'.") % {
    442442                'url': field_data, 'contenttype': content_type}
    443443
    444 class RelaxNGCompact:
     444class RelaxNGCompact(object):
    445445    "Validate against a Relax NG compact schema"
    446446    def __init__(self, schema_path, additional_root_element=None):
    447447        self.schema_path = schema_path
  • django/core/handlers/base.py

     
    33from django import http
    44import sys
    55
    6 class BaseHandler:
     6class BaseHandler(object):
    77    def __init__(self):
    88        self._request_middleware = self._view_middleware = self._response_middleware = self._exception_middleware = None
    99
  • django/core/management.py

     
    2828INVALID_PROJECT_NAMES = ('django', 'test')
    2929
    3030# Set up the terminal color scheme.
    31 class dummy: pass
     31class dummy(object): pass
    3232style = dummy()
    3333style.ERROR = termcolors.make_style(fg='red', opts=('bold',))
    3434style.ERROR_OUTPUT = termcolors.make_style(fg='red', opts=('bold',))
    … …  
    3939del dummy
    4040
    4141def disable_termcolors():
    42     class dummy:
     42    class dummy(object):
    4343        def __getattr__(self, attr):
    4444            return lambda x: x
    4545    global style
    … …  
    791791inspectdb.help_doc = "Introspects the database tables in the given database and outputs a Django model module."
    792792inspectdb.args = ""
    793793
    794 class ModelErrorCollection:
     794class ModelErrorCollection(object):
    795795    def __init__(self, outfile=sys.stdout):
    796796        self.errors = []
    797797        self.outfile = outfile
  • django/core/cache/backends/base.py

     
    55class InvalidCacheBackendError(ImproperlyConfigured):
    66    pass
    77
    8 class BaseCache:
     8class BaseCache(object):
    99    def __init__(self, params):
    1010        timeout = params.get('timeout', 300)
    1111        try:
  • django/core/paginator.py

     
    44class InvalidPage(Exception):
    55    pass
    66
    7 class ObjectPaginator:
     7class ObjectPaginator(object):
    88    """
    99    This class makes pagination easy. Feed it a QuerySet, plus the number of
    1010    objects you want on each page. Then read the hits and pages properties to
  • django/dispatch/saferef.py

     
    5050                weakSelf -- weak reference to the target object
    5151                weakFunc -- weak reference to the target function
    5252
    53         Class Attributes:
     53        Class Attributes(object):
    5454                _allInstances -- class attribute pointing to all live
    5555                        BoundMethodWeakref objects indexed by the class's
    5656                        calculateKey(target) method applied to the target
  • django/dispatch/dispatcher.py

     
    3939        True = 1==1
    4040        False = 1==0
    4141
    42 class _Parameter:
     42class _Parameter(object):
    4343        """Used to represent default parameter values."""
    4444        def __repr__(self):
    4545                return self.__class__.__name__
  • django/utils/feedgenerator.py

     
    3636    tag = re.sub('#', '/', tag)
    3737    return 'tag:' + tag
    3838
    39 class SyndicationFeed:
     39class SyndicationFeed(object):
    4040    "Base class for all syndication feeds. Subclasses should provide write()"
    4141    def __init__(self, title, link, description, language=None, author_email=None,
    4242            author_name=None, author_link=None, subtitle=None, categories=None,
    … …  
    108108        else:
    109109            return datetime.datetime.now()
    110110
    111 class Enclosure:
     111class Enclosure(object):
    112112    "Represents an RSS enclosure"
    113113    def __init__(self, url, length, mime_type):
    114114        "All args are expected to be Python Unicode objects"
  • django/utils/datastructures.py

     
    1 class MergeDict:
     1class MergeDict(object):
    22    """
    33    A simple class for creating new "virtual" dictionaries that actualy look
    44    up values in more than one dictionary, passed in the constructor.
  • django/utils/synch.py

     
    88
    99import threading
    1010
    11 class RWLock:
     11class RWLock(object):
    1212    """
    1313    Classic implementation of reader-writer lock with preference to writers.
    1414   
  • django/utils/dateformat.py

     
    1919re_formatchars = re.compile(r'(?<!\\)([aABdDfFgGhHiIjlLmMnNOPrsStTUwWyYzZ])')
    2020re_escaped = re.compile(r'\\(.)')
    2121
    22 class Formatter:
     22class Formatter(object):
    2323    def format(self, formatstr):
    2424        pieces = []
    2525        for i, piece in enumerate(re_formatchars.split(formatstr)):
  • django/contrib/auth/middleware.py

     
    1212                self._user = AnonymousUser()
    1313        return self._user
    1414
    15 class AuthenticationMiddleware:
     15class AuthenticationMiddleware(object):
    1616    def process_request(self, request):
    1717        assert hasattr(request, 'session'), "The Django authentication middleware requires session middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to insert 'django.contrib.sessions.middleware.SessionMiddleware'."
    1818        request.__class__.user = LazyUser()
  • django/contrib/redirects/middleware.py

     
    22from django import http
    33from django.conf import settings
    44
    5 class RedirectFallbackMiddleware:
     5class RedirectFallbackMiddleware(object):
    66    def process_response(self, request, response):
    77        if response.status_code != 404:
    88            return response # No need to check for a redirect for non-404 responses.
  • django/contrib/syndication/feeds.py

     
    1212class FeedDoesNotExist(ObjectDoesNotExist):
    1313    pass
    1414
    15 class Feed:
     15class Feed(object):
    1616    item_pubdate = None
    1717    item_enclosure_url = None
    1818    feed_type = feedgenerator.DefaultFeed
  • django/contrib/comments/templatetags/comments.py

     
    127127        context[self.var_name] = comment_list
    128128        return ''
    129129
    130 class DoCommentForm:
     130class DoCommentForm(object):
    131131    """
    132132    Displays a comment form for the given params.
    133133
    … …  
    201201                    raise template.TemplateSyntaxError, "%r tag got invalid parameter '%s'" % (tokens[0], option)
    202202        return CommentFormNode(content_type, obj_id_lookup_var, obj_id, self.free, **kwargs)
    203203
    204 class DoCommentCount:
     204class DoCommentCount(object):
    205205    """
    206206    Gets comment count for the given params and populates the template context
    207207    with a variable containing that value, whose name is defined by the 'as'
    … …  
    251251            raise template.TemplateSyntaxError, "Fourth argument in %r must be 'as'" % tokens[0]
    252252        return CommentCountNode(package, module, var_name, obj_id, tokens[5], self.free)
    253253
    254 class DoGetCommentList:
     254class DoGetCommentList(object):
    255255    """
    256256    Gets comments for the given params and populates the template context with a
    257257    special comment_package variable, whose name is defined by the ``as``
  • django/contrib/flatpages/middleware.py

     
    22from django.http import Http404
    33from django.conf import settings
    44
    5 class FlatpageFallbackMiddleware:
     5class FlatpageFallbackMiddleware(object):
    66    def process_response(self, request, response):
    77        if response.status_code != 404:
    88            return response # No need to check for a flatpage for non-404 responses.
  • django/contrib/sessions/middleware.py

     
    6464
    6565    _session = property(_get_session)
    6666
    67 class SessionMiddleware:
     67class SessionMiddleware(object):
    6868    def process_request(self, request):
    6969        request.session = SessionWrapper(request.COOKIES.get(settings.SESSION_COOKIE_NAME, None))
    7070
  • django/contrib/admin/templatetags/log.py

     
    1616        context[self.varname] = LogEntry.objects.filter(user__id__exact=self.user).select_related()[:self.limit]
    1717        return ''
    1818
    19 class DoGetAdminLog:
     19class DoGetAdminLog(object):
    2020    """
    2121    Populates a template variable with the admin log for the given criteria.
    2222
  • django/template/__init__.py

     
    133133    def reload(self):
    134134        return self.source
    135135
    136 class Template:
     136class Template(object):
    137137    def __init__(self, template_string, origin=None):
    138138        "Compilation stage"
    139139        if settings.TEMPLATE_DEBUG and origin == None:
    … …  
    157157    parser = parser_factory(lexer.tokenize())
    158158    return parser.parse()
    159159
    160 class Token:
     160class Token(object):
    161161    def __init__(self, token_type, contents):
    162162        "The token_type must be TOKEN_TEXT, TOKEN_VAR or TOKEN_BLOCK"
    163163        self.token_type, self.contents = token_type, contents
    … …  
    381381        return Parser(*args, **kwargs)
    382382
    383383
    384 class TokenParser:
     384class TokenParser(object):
    385385    """
    386386    Subclass this and implement the top() method to parse a template line. When
    387387    instantiating the parser, pass in the line from the Django template parser.
    … …  
    659659            del bits[0]
    660660    return current
    661661
    662 class Node:
     662class Node(object):
    663663    def render(self, context):
    664664        "Return the node rendered as a string"
    665665        pass
  • django/template/context.py

     
    77    "pop() has been called more times than push()"
    88    pass
    99
    10 class Context:
     10class Context(object):
    1111    "A stack container for variable context"
    1212    def __init__(self, dict_=None):
    1313        dict_ = dict_ or {}
  • django/middleware/common.py

     
    33from django.core.mail import mail_managers
    44import md5, os
    55
    6 class CommonMiddleware:
     6class CommonMiddleware(object):
    77    """
    88    "Common" middleware for taking care of some basic operations:
    99
  • django/middleware/gzip.py

     
    44
    55re_accepts_gzip = re.compile(r'\bgzip\b')
    66
    7 class GZipMiddleware:
     7class GZipMiddleware(object):
    88    """
    99    This middleware compresses content if the browser allows gzip compression.
    1010    It sets the Vary header accordingly, so that caches will base their storage
  • django/middleware/http.py

     
    11import datetime
    22
    3 class ConditionalGetMiddleware:
     3class ConditionalGetMiddleware(object):
    44    """
    55    Handles conditional GET operations. If the response has a ETag or
    66    Last-Modified header, and the request has If-None-Match or
  • django/middleware/locale.py

     
    33from django.utils.cache import patch_vary_headers
    44from django.utils import translation
    55
    6 class LocaleMiddleware:
     6class LocaleMiddleware(object):
    77    """
    88    This is a very simple middleware that parses a request
    99    and decides what translation object to install in the current
  • django/middleware/cache.py

     
    33from django.utils.cache import get_cache_key, learn_cache_key, patch_response_headers
    44from django.http import HttpResponseNotModified
    55
    6 class CacheMiddleware:
     6class CacheMiddleware(object):
    77    """
    88    Cache middleware. If this is enabled, each Django-powered page will be
    99    cached for CACHE_MIDDLEWARE_SECONDS seconds. Cache is based on URLs.
  • django/middleware/doc.py

     
    11from django.conf import settings
    22from django import http
    33
    4 class XViewMiddleware:
     4class XViewMiddleware(object):
    55    """
    66    Adds an X-View header to internal HEAD requests -- used by the documentation system.
    77    """
  • django/middleware/transaction.py

     
    11from django.conf import settings
    22from django.db import transaction
    33
    4 class TransactionMiddleware:
     4class TransactionMiddleware(object):
    55    """
    66    Transaction middleware. If this is enabled, each view function will be run
    77    with commit_on_response activated - that way a save() doesn't do a direct
  • tests/othertests/templates.py

     
    3737class SomeOtherException(Exception):
    3838    pass
    3939
    40 class SomeClass:
     40class SomeClass(object):
    4141    def __init__(self):
    4242        self.otherclass = OtherClass()
    4343
    … …  
    5353    def method4(self):
    5454        raise SomeOtherException
    5555
    56 class OtherClass:
     56class OtherClass(object):
    5757    def method(self):
    5858        return "OtherClass.method"
    5959
  • tests/othertests/cache.py

     
    77# functions/classes for complex data type tests       
    88def f():
    99    return 42
    10 class C:
     10class C(object):
    1111    def m(n):
    1212        return 24
    1313
  • tests/doctest.py

     
    390390##   a string (such as an object's docstring).  The DocTest class also
    391391##   includes information about where the string was extracted from.
    392392
    393 class Example:
     393class Example(object):
    394394    """
    395395    A single doctest example, consisting of source code and expected
    396396    output.  `Example` defines the following attributes:
    … …  
    443443        self.options = options
    444444        self.exc_msg = exc_msg
    445445
    446 class DocTest:
     446class DocTest(object):
    447447    """
    448448    A collection of doctest examples that should be run in a single
    449449    namespace.  Each `DocTest` defines the following attributes:
    … …  
    503503## 3. DocTestParser
    504504######################################################################
    505505
    506 class DocTestParser:
     506class DocTestParser(object):
    507507    """
    508508    A class used to parse strings containing doctest examples.
    509509    """
    … …  
    738738## 4. DocTest Finder
    739739######################################################################
    740740
    741 class DocTestFinder:
     741class DocTestFinder(object):
    742742    """
    743743    A class used to extract the DocTests that are relevant to a given
    744744    object, from its docstring and the docstrings of its contained
    … …  
    10361036## 5. DocTest Runner
    10371037######################################################################
    10381038
    1039 class DocTestRunner:
     1039class DocTestRunner(object):
    10401040    """
    10411041    A class used to run DocTest test cases, and accumulate statistics.
    10421042    The `run` method is used to process a single DocTest case.  It
    … …  
    14521452                t = t + t2
    14531453            d[name] = f, t
    14541454
    1455 class OutputChecker:
     1455class OutputChecker(object):
    14561456    """
    14571457    A class used to check the whether the actual output from a doctest
    14581458    example matches the expected output.  `OutputChecker` defines two
    … …  
    19981998# This is provided only for backwards compatibility.  It's not
    19991999# actually used in any way.
    20002000
    2001 class Tester:
     2001class Tester(object):
    20022002    def __init__(self, mod=None, globs=None, verbose=None,
    20032003                 isprivate=None, optionflags=0):
    20042004
    … …  
    25632563######################################################################
    25642564## 10. Example Usage
    25652565######################################################################
    2566 class _TestClass:
     2566class _TestClass(object):
    25672567    """
    25682568    A pointless class, for sanity-checking of docstring testing.
    25692569
  • tests/runtests.py

     
    7272            return normalize_long_ints(want) == normalize_long_ints(got)
    7373        return ok
    7474
    75 class TestRunner:
     75class TestRunner(object):
    7676    def __init__(self, verbosity_level=0, which_tests=None):
    7777        self.verbosity_level = verbosity_level
    7878        self.which_tests = which_tests
Back to Top