Ticket #2109: new_style.diff
File new_style.diff, 35.4 KB (added by , 18 years ago) |
---|
-
django/db/models/options.py
15 15 'unique_together', 'permissions', 'get_latest_by', 16 16 'order_with_respect_to', 'app_label') 17 17 18 class Options :18 class Options(object): 19 19 def __init__(self, meta): 20 20 self.fields, self.many_to_many = [], [] 21 21 self.module_name, self.verbose_name = None, None … … 195 195 self._field_types[field_type] = False 196 196 return self._field_types[field_type] 197 197 198 class AdminOptions :198 class AdminOptions(object): 199 199 def __init__(self, fields=None, js=None, list_display=None, list_filter=None, 200 200 date_hierarchy=None, save_as=False, ordering=None, search_fields=None, 201 201 save_on_top=False, list_select_related=False, manager=None, list_per_page=100): -
django/db/models/fields/__init__.py
9 9 from django.utils.translation import gettext, gettext_lazy, ngettext 10 10 import datetime, os, time 11 11 12 class NOT_PROVIDED :12 class NOT_PROVIDED(object): 13 13 pass 14 14 15 15 # Values for filter_interface. … … 535 535 if not self.blank: 536 536 if rel: 537 537 # This validator makes sure FileFields work in a related context. 538 class RequiredFileField :538 class RequiredFileField(object): 539 539 def __init__(self, other_field_names, other_file_field_name): 540 540 self.other_field_names = other_field_names 541 541 self.other_file_field_name = other_file_field_name -
django/db/models/fields/related.py
667 667 def set_attributes_from_rel(self): 668 668 pass 669 669 670 class ManyToOneRel :670 class ManyToOneRel(object): 671 671 def __init__(self, to, field_name, num_in_admin=3, min_num_in_admin=None, 672 672 max_num_in_admin=None, num_extra_on_change=1, edit_inline=False, 673 673 related_name=None, limit_choices_to=None, lookup_overrides=None, raw_id_admin=False): … … 704 704 self.raw_id_admin = raw_id_admin 705 705 self.multiple = False 706 706 707 class ManyToManyRel :707 class ManyToManyRel(object): 708 708 def __init__(self, to, num_in_admin=0, related_name=None, 709 709 filter_interface=None, limit_choices_to=None, raw_id_admin=False, symmetrical=True): 710 710 self.to = to -
django/db/models/__init__.py
15 15 # Admin stages. 16 16 ADD, CHANGE, BOTH = 1, 2, 3 17 17 18 class LazyDate :18 class LazyDate(object): 19 19 """ 20 20 Use in limit_choices_to to compare the field to dates calculated at run time 21 21 instead of when the model is loaded. For example:: -
django/db/models/query.py
546 546 c._order = self._order 547 547 return c 548 548 549 class QOperator :549 class QOperator(object): 550 550 "Base class for QAnd and QOr" 551 551 def __init__(self, *args): 552 552 self.args = args -
django/db/backends/sqlite3/introspection.py
35 35 # This light wrapper "fakes" a dictionary interface, because some SQLite data 36 36 # types include variables in them -- e.g. "varchar(30)" -- and can't be matched 37 37 # as a simple dictionary lookup. 38 class FlexibleFieldLookupDict :38 class FlexibleFieldLookupDict(object): 39 39 def __getitem__(self, key): 40 40 key = key.lower() 41 41 try: -
django/db/backends/util.py
1 1 import datetime 2 2 from time import time 3 3 4 class CursorDebugWrapper :4 class CursorDebugWrapper(object): 5 5 def __init__(self, cursor, db): 6 6 self.cursor = cursor 7 7 self.db = db -
django/db/backends/mysql/base.py
26 26 27 27 # This is an extra debug layer over MySQL queries, to display warnings. 28 28 # It's only used when DEBUG=True. 29 class MysqlDebugWrapper :29 class MysqlDebugWrapper(object): 30 30 def __init__(self, cursor): 31 31 self.cursor = cursor 32 32 -
django/db/backends/dummy/base.py
15 15 class DatabaseError(Exception): 16 16 pass 17 17 18 class DatabaseWrapper :18 class DatabaseWrapper(object): 19 19 cursor = complain 20 20 _commit = complain 21 21 _rollback = complain -
django/conf/__init__.py
12 12 13 13 ENVIRONMENT_VARIABLE = "DJANGO_SETTINGS_MODULE" 14 14 15 class LazySettings :15 class LazySettings(object): 16 16 """ 17 17 A lazy proxy for either global Django settings or a custom settings object. 18 18 The user can manually configure settings prior to using them. Otherwise, … … 67 67 setattr(holder, name, value) 68 68 self._target = holder 69 69 70 class Settings :70 class Settings(object): 71 71 def __init__(self, settings_module): 72 72 # update this dict from global settings (but only for ALL_CAPS settings) 73 73 for setting in dir(global_settings): … … 112 112 def get_all_members(self): 113 113 return dir(self) 114 114 115 class UserSettingsHolder :115 class UserSettingsHolder(object): 116 116 """ 117 117 Holder for user configured settings. 118 118 """ -
django/forms/__init__.py
101 101 for field in self.fields: 102 102 field.convert_post_data(new_data) 103 103 104 class FormWrapper :104 class FormWrapper(object): 105 105 """ 106 106 A wrapper linking a Manipulator to the template system. 107 107 This allows dictionary-style lookups of formfields. It also handles feeding … … 150 150 151 151 fields = property(_get_fields) 152 152 153 class FormFieldWrapper :153 class FormFieldWrapper(object): 154 154 "A bridge between the template system and an individual form field. Used by FormWrapper." 155 155 def __init__(self, formfield, data, error_list): 156 156 self.formfield, self.data, self.error_list = formfield, data, error_list … … 211 211 def html_combined_error_list(self): 212 212 return ''.join([field.html_error_list() for field in self.formfield_dict.values() if hasattr(field, 'errors')]) 213 213 214 class InlineObjectCollection :214 class InlineObjectCollection(object): 215 215 "An object that acts like a sparse list of form field collections." 216 216 def __init__(self, parent_manipulator, rel_obj, data, errors): 217 217 self.parent_manipulator = parent_manipulator … … 269 269 self._collections = collections 270 270 271 271 272 class FormField :272 class FormField(object): 273 273 """Abstract class representing a form field. 274 274 275 275 Classes that extend FormField should define the following attributes: … … 521 521 {{ option.field }} {{ option.label }}<br /> 522 522 {% endfor %} 523 523 """ 524 class RadioFieldRenderer :524 class RadioFieldRenderer(object): 525 525 def __init__(self, datalist, ul_class): 526 526 self.datalist, self.ul_class = datalist, ul_class 527 527 def __str__(self): -
django/core/servers/basehttp.py
21 21 class WSGIServerException(Exception): 22 22 pass 23 23 24 class FileWrapper :24 class FileWrapper(object): 25 25 """Wrapper to convert file-like objects to iterables""" 26 26 27 27 def __init__(self, filelike, blksize=8192): … … 63 63 else: 64 64 return param 65 65 66 class Headers :66 class Headers(object): 67 67 """Manage a collection of HTTP response headers""" 68 68 def __init__(self,headers): 69 69 if type(headers) is not ListType: … … 218 218 """Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header""" 219 219 return _hoppish(header_name.lower()) 220 220 221 class ServerHandler :221 class ServerHandler(object): 222 222 """Manage the invocation of a WSGI application""" 223 223 224 224 # Configuration parameters; can override per-subclass or per-instance … … 591 591 return 592 592 sys.stderr.write("[%s] %s\n" % (self.log_date_time_string(), format % args)) 593 593 594 class AdminMediaHandler :594 class AdminMediaHandler(object): 595 595 """ 596 596 WSGI middleware that intercepts calls to the admin media directory, as 597 597 defined by the ADMIN_MEDIA_PREFIX setting, and serves those images. -
django/core/context_processors.py
48 48 # PermWrapper and PermLookupDict proxy the permissions system into objects that 49 49 # the template system can understand. 50 50 51 class PermLookupDict :51 class PermLookupDict(object): 52 52 def __init__(self, user, module_name): 53 53 self.user, self.module_name = user, module_name 54 54 def __repr__(self): … … 58 58 def __nonzero__(self): 59 59 return self.user.has_module_perms(self.module_name) 60 60 61 class PermWrapper :61 class PermWrapper(object): 62 62 def __init__(self, user): 63 63 self.user = user 64 64 def __getitem__(self, module_name): -
django/core/urlresolvers.py
83 83 raise NoReverseMatch("Value %r didn't match regular expression %r" % (value, test_regex)) 84 84 return str(value) # TODO: Unicode? 85 85 86 class RegexURLPattern :86 class RegexURLPattern(object): 87 87 def __init__(self, regex, callback, default_args=None): 88 88 # regex is a string representing a regular expression. 89 89 # callback is something like 'foo.views.news.stories.story_detail', -
django/core/validators.py
237 237 "Watch your mouth! The words %s are not allowed here.", plural) % \ 238 238 get_text_list(['"%s%s%s"' % (i[0], '-'*(len(i)-2), i[-1]) for i in words_seen], 'and') 239 239 240 class AlwaysMatchesOtherField :240 class AlwaysMatchesOtherField(object): 241 241 def __init__(self, other_field_name, error_message=None): 242 242 self.other = other_field_name 243 243 self.error_message = error_message or lazy_inter(gettext_lazy("This field must match the '%s' field."), self.other) … … 247 247 if field_data != all_data[self.other]: 248 248 raise ValidationError, self.error_message 249 249 250 class ValidateIfOtherFieldEquals :250 class ValidateIfOtherFieldEquals(object): 251 251 def __init__(self, other_field, other_value, validator_list): 252 252 self.other_field, self.other_value = other_field, other_value 253 253 self.validator_list = validator_list … … 258 258 for v in self.validator_list: 259 259 v(field_data, all_data) 260 260 261 class RequiredIfOtherFieldNotGiven :261 class RequiredIfOtherFieldNotGiven(object): 262 262 def __init__(self, other_field_name, error_message=gettext_lazy("Please enter something for at least one field.")): 263 263 self.other, self.error_message = other_field_name, error_message 264 264 self.always_test = True … … 267 267 if not all_data.get(self.other, False) and not field_data: 268 268 raise ValidationError, self.error_message 269 269 270 class RequiredIfOtherFieldsGiven :270 class RequiredIfOtherFieldsGiven(object): 271 271 def __init__(self, other_field_names, error_message=gettext_lazy("Please enter both fields or leave them both empty.")): 272 272 self.other, self.error_message = other_field_names, error_message 273 273 self.always_test = True … … 282 282 def __init__(self, other_field_name, error_message=gettext_lazy("Please enter both fields or leave them both empty.")): 283 283 RequiredIfOtherFieldsGiven.__init__(self, [other_field_name], error_message) 284 284 285 class RequiredIfOtherFieldEquals :285 class RequiredIfOtherFieldEquals(object): 286 286 def __init__(self, other_field, other_value, error_message=None): 287 287 self.other_field = other_field 288 288 self.other_value = other_value … … 294 294 if all_data.has_key(self.other_field) and all_data[self.other_field] == self.other_value and not field_data: 295 295 raise ValidationError(self.error_message) 296 296 297 class RequiredIfOtherFieldDoesNotEqual :297 class RequiredIfOtherFieldDoesNotEqual(object): 298 298 def __init__(self, other_field, other_value, error_message=None): 299 299 self.other_field = other_field 300 300 self.other_value = other_value … … 306 306 if all_data.has_key(self.other_field) and all_data[self.other_field] != self.other_value and not field_data: 307 307 raise ValidationError(self.error_message) 308 308 309 class IsLessThanOtherField :309 class IsLessThanOtherField(object): 310 310 def __init__(self, other_field_name, error_message): 311 311 self.other, self.error_message = other_field_name, error_message 312 312 … … 314 314 if field_data > all_data[self.other]: 315 315 raise ValidationError, self.error_message 316 316 317 class UniqueAmongstFieldsWithPrefix :317 class UniqueAmongstFieldsWithPrefix(object): 318 318 def __init__(self, field_name, prefix, error_message): 319 319 self.field_name, self.prefix = field_name, prefix 320 320 self.error_message = error_message or gettext_lazy("Duplicate values are not allowed.") … … 324 324 if field_name != self.field_name and value == field_data: 325 325 raise ValidationError, self.error_message 326 326 327 class IsAPowerOf :327 class IsAPowerOf(object): 328 328 """ 329 329 >>> v = IsAPowerOf(2) 330 330 >>> v(4, None) … … 342 342 if val != int(val): 343 343 raise ValidationError, gettext("This value must be a power of %s.") % self.power_of 344 344 345 class IsValidFloat :345 class IsValidFloat(object): 346 346 def __init__(self, max_digits, decimal_places): 347 347 self.max_digits, self.decimal_places = max_digits, decimal_places 348 348 … … 359 359 raise ValidationError, ngettext("Please enter a valid decimal number with at most %s decimal place.", 360 360 "Please enter a valid decimal number with at most %s decimal places.", self.decimal_places) % self.decimal_places 361 361 362 class HasAllowableSize :362 class HasAllowableSize(object): 363 363 """ 364 364 Checks that the file-upload field data is a certain size. min_size and 365 365 max_size are measurements in bytes. … … 379 379 if self.max_size is not None and len(content) > self.max_size: 380 380 raise ValidationError, self.max_error_message 381 381 382 class MatchesRegularExpression :382 class MatchesRegularExpression(object): 383 383 """ 384 384 Checks that the field matches the given regular-expression. The regex 385 385 should be in string format, not already compiled. … … 392 392 if not self.regexp.search(field_data): 393 393 raise ValidationError(self.error_message) 394 394 395 class AnyValidator :395 class AnyValidator(object): 396 396 """ 397 397 This validator tries all given validators. If any one of them succeeds, 398 398 validation passes. If none of them succeeds, the given message is thrown … … 416 416 pass 417 417 raise ValidationError(self.error_message) 418 418 419 class URLMimeTypeCheck :419 class URLMimeTypeCheck(object): 420 420 "Checks that the provided URL points to a document with a listed mime type" 421 421 class CouldNotRetrieve(ValidationError): 422 422 pass … … 441 441 raise URLMimeTypeCheck.InvalidContentType, gettext("The URL %(url)s returned the invalid Content-Type header '%(contenttype)s'.") % { 442 442 'url': field_data, 'contenttype': content_type} 443 443 444 class RelaxNGCompact :444 class RelaxNGCompact(object): 445 445 "Validate against a Relax NG compact schema" 446 446 def __init__(self, schema_path, additional_root_element=None): 447 447 self.schema_path = schema_path -
django/core/handlers/base.py
3 3 from django import http 4 4 import sys 5 5 6 class BaseHandler :6 class BaseHandler(object): 7 7 def __init__(self): 8 8 self._request_middleware = self._view_middleware = self._response_middleware = self._exception_middleware = None 9 9 -
django/core/management.py
28 28 INVALID_PROJECT_NAMES = ('django', 'test') 29 29 30 30 # Set up the terminal color scheme. 31 class dummy : pass31 class dummy(object): pass 32 32 style = dummy() 33 33 style.ERROR = termcolors.make_style(fg='red', opts=('bold',)) 34 34 style.ERROR_OUTPUT = termcolors.make_style(fg='red', opts=('bold',)) … … 39 39 del dummy 40 40 41 41 def disable_termcolors(): 42 class dummy :42 class dummy(object): 43 43 def __getattr__(self, attr): 44 44 return lambda x: x 45 45 global style … … 791 791 inspectdb.help_doc = "Introspects the database tables in the given database and outputs a Django model module." 792 792 inspectdb.args = "" 793 793 794 class ModelErrorCollection :794 class ModelErrorCollection(object): 795 795 def __init__(self, outfile=sys.stdout): 796 796 self.errors = [] 797 797 self.outfile = outfile -
django/core/cache/backends/base.py
5 5 class InvalidCacheBackendError(ImproperlyConfigured): 6 6 pass 7 7 8 class BaseCache :8 class BaseCache(object): 9 9 def __init__(self, params): 10 10 timeout = params.get('timeout', 300) 11 11 try: -
django/core/paginator.py
4 4 class InvalidPage(Exception): 5 5 pass 6 6 7 class ObjectPaginator :7 class ObjectPaginator(object): 8 8 """ 9 9 This class makes pagination easy. Feed it a QuerySet, plus the number of 10 10 objects you want on each page. Then read the hits and pages properties to -
django/dispatch/saferef.py
50 50 weakSelf -- weak reference to the target object 51 51 weakFunc -- weak reference to the target function 52 52 53 Class Attributes :53 Class Attributes(object): 54 54 _allInstances -- class attribute pointing to all live 55 55 BoundMethodWeakref objects indexed by the class's 56 56 calculateKey(target) method applied to the target -
django/dispatch/dispatcher.py
39 39 True = 1==1 40 40 False = 1==0 41 41 42 class _Parameter :42 class _Parameter(object): 43 43 """Used to represent default parameter values.""" 44 44 def __repr__(self): 45 45 return self.__class__.__name__ -
django/utils/feedgenerator.py
36 36 tag = re.sub('#', '/', tag) 37 37 return 'tag:' + tag 38 38 39 class SyndicationFeed :39 class SyndicationFeed(object): 40 40 "Base class for all syndication feeds. Subclasses should provide write()" 41 41 def __init__(self, title, link, description, language=None, author_email=None, 42 42 author_name=None, author_link=None, subtitle=None, categories=None, … … 108 108 else: 109 109 return datetime.datetime.now() 110 110 111 class Enclosure :111 class Enclosure(object): 112 112 "Represents an RSS enclosure" 113 113 def __init__(self, url, length, mime_type): 114 114 "All args are expected to be Python Unicode objects" -
django/utils/datastructures.py
1 class MergeDict :1 class MergeDict(object): 2 2 """ 3 3 A simple class for creating new "virtual" dictionaries that actualy look 4 4 up values in more than one dictionary, passed in the constructor. -
django/utils/synch.py
8 8 9 9 import threading 10 10 11 class RWLock :11 class RWLock(object): 12 12 """ 13 13 Classic implementation of reader-writer lock with preference to writers. 14 14 -
django/utils/dateformat.py
19 19 re_formatchars = re.compile(r'(?<!\\)([aABdDfFgGhHiIjlLmMnNOPrsStTUwWyYzZ])') 20 20 re_escaped = re.compile(r'\\(.)') 21 21 22 class Formatter :22 class Formatter(object): 23 23 def format(self, formatstr): 24 24 pieces = [] 25 25 for i, piece in enumerate(re_formatchars.split(formatstr)): -
django/contrib/auth/middleware.py
12 12 self._user = AnonymousUser() 13 13 return self._user 14 14 15 class AuthenticationMiddleware :15 class AuthenticationMiddleware(object): 16 16 def process_request(self, request): 17 17 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'." 18 18 request.__class__.user = LazyUser() -
django/contrib/redirects/middleware.py
2 2 from django import http 3 3 from django.conf import settings 4 4 5 class RedirectFallbackMiddleware :5 class RedirectFallbackMiddleware(object): 6 6 def process_response(self, request, response): 7 7 if response.status_code != 404: 8 8 return response # No need to check for a redirect for non-404 responses. -
django/contrib/syndication/feeds.py
12 12 class FeedDoesNotExist(ObjectDoesNotExist): 13 13 pass 14 14 15 class Feed :15 class Feed(object): 16 16 item_pubdate = None 17 17 item_enclosure_url = None 18 18 feed_type = feedgenerator.DefaultFeed -
django/contrib/comments/templatetags/comments.py
127 127 context[self.var_name] = comment_list 128 128 return '' 129 129 130 class DoCommentForm :130 class DoCommentForm(object): 131 131 """ 132 132 Displays a comment form for the given params. 133 133 … … 201 201 raise template.TemplateSyntaxError, "%r tag got invalid parameter '%s'" % (tokens[0], option) 202 202 return CommentFormNode(content_type, obj_id_lookup_var, obj_id, self.free, **kwargs) 203 203 204 class DoCommentCount :204 class DoCommentCount(object): 205 205 """ 206 206 Gets comment count for the given params and populates the template context 207 207 with a variable containing that value, whose name is defined by the 'as' … … 251 251 raise template.TemplateSyntaxError, "Fourth argument in %r must be 'as'" % tokens[0] 252 252 return CommentCountNode(package, module, var_name, obj_id, tokens[5], self.free) 253 253 254 class DoGetCommentList :254 class DoGetCommentList(object): 255 255 """ 256 256 Gets comments for the given params and populates the template context with a 257 257 special comment_package variable, whose name is defined by the ``as`` -
django/contrib/flatpages/middleware.py
2 2 from django.http import Http404 3 3 from django.conf import settings 4 4 5 class FlatpageFallbackMiddleware :5 class FlatpageFallbackMiddleware(object): 6 6 def process_response(self, request, response): 7 7 if response.status_code != 404: 8 8 return response # No need to check for a flatpage for non-404 responses. -
django/contrib/sessions/middleware.py
64 64 65 65 _session = property(_get_session) 66 66 67 class SessionMiddleware :67 class SessionMiddleware(object): 68 68 def process_request(self, request): 69 69 request.session = SessionWrapper(request.COOKIES.get(settings.SESSION_COOKIE_NAME, None)) 70 70 -
django/contrib/admin/templatetags/log.py
16 16 context[self.varname] = LogEntry.objects.filter(user__id__exact=self.user).select_related()[:self.limit] 17 17 return '' 18 18 19 class DoGetAdminLog :19 class DoGetAdminLog(object): 20 20 """ 21 21 Populates a template variable with the admin log for the given criteria. 22 22 -
django/template/__init__.py
133 133 def reload(self): 134 134 return self.source 135 135 136 class Template :136 class Template(object): 137 137 def __init__(self, template_string, origin=None): 138 138 "Compilation stage" 139 139 if settings.TEMPLATE_DEBUG and origin == None: … … 157 157 parser = parser_factory(lexer.tokenize()) 158 158 return parser.parse() 159 159 160 class Token :160 class Token(object): 161 161 def __init__(self, token_type, contents): 162 162 "The token_type must be TOKEN_TEXT, TOKEN_VAR or TOKEN_BLOCK" 163 163 self.token_type, self.contents = token_type, contents … … 381 381 return Parser(*args, **kwargs) 382 382 383 383 384 class TokenParser :384 class TokenParser(object): 385 385 """ 386 386 Subclass this and implement the top() method to parse a template line. When 387 387 instantiating the parser, pass in the line from the Django template parser. … … 659 659 del bits[0] 660 660 return current 661 661 662 class Node :662 class Node(object): 663 663 def render(self, context): 664 664 "Return the node rendered as a string" 665 665 pass -
django/template/context.py
7 7 "pop() has been called more times than push()" 8 8 pass 9 9 10 class Context :10 class Context(object): 11 11 "A stack container for variable context" 12 12 def __init__(self, dict_=None): 13 13 dict_ = dict_ or {} -
django/middleware/common.py
3 3 from django.core.mail import mail_managers 4 4 import md5, os 5 5 6 class CommonMiddleware :6 class CommonMiddleware(object): 7 7 """ 8 8 "Common" middleware for taking care of some basic operations: 9 9 -
django/middleware/gzip.py
4 4 5 5 re_accepts_gzip = re.compile(r'\bgzip\b') 6 6 7 class GZipMiddleware :7 class GZipMiddleware(object): 8 8 """ 9 9 This middleware compresses content if the browser allows gzip compression. 10 10 It sets the Vary header accordingly, so that caches will base their storage -
django/middleware/http.py
1 1 import datetime 2 2 3 class ConditionalGetMiddleware :3 class ConditionalGetMiddleware(object): 4 4 """ 5 5 Handles conditional GET operations. If the response has a ETag or 6 6 Last-Modified header, and the request has If-None-Match or -
django/middleware/locale.py
3 3 from django.utils.cache import patch_vary_headers 4 4 from django.utils import translation 5 5 6 class LocaleMiddleware :6 class LocaleMiddleware(object): 7 7 """ 8 8 This is a very simple middleware that parses a request 9 9 and decides what translation object to install in the current -
django/middleware/cache.py
3 3 from django.utils.cache import get_cache_key, learn_cache_key, patch_response_headers 4 4 from django.http import HttpResponseNotModified 5 5 6 class CacheMiddleware :6 class CacheMiddleware(object): 7 7 """ 8 8 Cache middleware. If this is enabled, each Django-powered page will be 9 9 cached for CACHE_MIDDLEWARE_SECONDS seconds. Cache is based on URLs. -
django/middleware/doc.py
1 1 from django.conf import settings 2 2 from django import http 3 3 4 class XViewMiddleware :4 class XViewMiddleware(object): 5 5 """ 6 6 Adds an X-View header to internal HEAD requests -- used by the documentation system. 7 7 """ -
django/middleware/transaction.py
1 1 from django.conf import settings 2 2 from django.db import transaction 3 3 4 class TransactionMiddleware :4 class TransactionMiddleware(object): 5 5 """ 6 6 Transaction middleware. If this is enabled, each view function will be run 7 7 with commit_on_response activated - that way a save() doesn't do a direct -
tests/othertests/templates.py
37 37 class SomeOtherException(Exception): 38 38 pass 39 39 40 class SomeClass :40 class SomeClass(object): 41 41 def __init__(self): 42 42 self.otherclass = OtherClass() 43 43 … … 53 53 def method4(self): 54 54 raise SomeOtherException 55 55 56 class OtherClass :56 class OtherClass(object): 57 57 def method(self): 58 58 return "OtherClass.method" 59 59 -
tests/othertests/cache.py
7 7 # functions/classes for complex data type tests 8 8 def f(): 9 9 return 42 10 class C :10 class C(object): 11 11 def m(n): 12 12 return 24 13 13 -
tests/doctest.py
390 390 ## a string (such as an object's docstring). The DocTest class also 391 391 ## includes information about where the string was extracted from. 392 392 393 class Example :393 class Example(object): 394 394 """ 395 395 A single doctest example, consisting of source code and expected 396 396 output. `Example` defines the following attributes: … … 443 443 self.options = options 444 444 self.exc_msg = exc_msg 445 445 446 class DocTest :446 class DocTest(object): 447 447 """ 448 448 A collection of doctest examples that should be run in a single 449 449 namespace. Each `DocTest` defines the following attributes: … … 503 503 ## 3. DocTestParser 504 504 ###################################################################### 505 505 506 class DocTestParser :506 class DocTestParser(object): 507 507 """ 508 508 A class used to parse strings containing doctest examples. 509 509 """ … … 738 738 ## 4. DocTest Finder 739 739 ###################################################################### 740 740 741 class DocTestFinder :741 class DocTestFinder(object): 742 742 """ 743 743 A class used to extract the DocTests that are relevant to a given 744 744 object, from its docstring and the docstrings of its contained … … 1036 1036 ## 5. DocTest Runner 1037 1037 ###################################################################### 1038 1038 1039 class DocTestRunner :1039 class DocTestRunner(object): 1040 1040 """ 1041 1041 A class used to run DocTest test cases, and accumulate statistics. 1042 1042 The `run` method is used to process a single DocTest case. It … … 1452 1452 t = t + t2 1453 1453 d[name] = f, t 1454 1454 1455 class OutputChecker :1455 class OutputChecker(object): 1456 1456 """ 1457 1457 A class used to check the whether the actual output from a doctest 1458 1458 example matches the expected output. `OutputChecker` defines two … … 1998 1998 # This is provided only for backwards compatibility. It's not 1999 1999 # actually used in any way. 2000 2000 2001 class Tester :2001 class Tester(object): 2002 2002 def __init__(self, mod=None, globs=None, verbose=None, 2003 2003 isprivate=None, optionflags=0): 2004 2004 … … 2563 2563 ###################################################################### 2564 2564 ## 10. Example Usage 2565 2565 ###################################################################### 2566 class _TestClass :2566 class _TestClass(object): 2567 2567 """ 2568 2568 A pointless class, for sanity-checking of docstring testing. 2569 2569 -
tests/runtests.py
72 72 return normalize_long_ints(want) == normalize_long_ints(got) 73 73 return ok 74 74 75 class TestRunner :75 class TestRunner(object): 76 76 def __init__(self, verbosity_level=0, which_tests=None): 77 77 self.verbosity_level = verbosity_level 78 78 self.which_tests = which_tests