Changeset 6051
- Timestamp:
- 09/05/07 15:01:24 (1 year ago)
- Files:
-
- django/branches/newforms-admin (modified) (1 prop)
- django/branches/newforms-admin/AUTHORS (modified) (1 diff)
- django/branches/newforms-admin/django/contrib/csrf/middleware.py (modified) (1 diff)
- django/branches/newforms-admin/django/contrib/localflavor/it/it_province.py (modified) (1 diff)
- django/branches/newforms-admin/django/core/management/base.py (modified) (5 diffs)
- django/branches/newforms-admin/django/core/management/color.py (modified) (1 diff)
- django/branches/newforms-admin/django/core/management/commands/runserver.py (modified) (1 diff)
- django/branches/newforms-admin/django/core/management/commands/startproject.py (modified) (1 diff)
- django/branches/newforms-admin/django/core/management/commands/validate.py (modified) (1 diff)
- django/branches/newforms-admin/django/db/backends/sqlite3/base.py (modified) (1 diff)
- django/branches/newforms-admin/django/template/defaultfilters.py (modified) (2 diffs)
- django/branches/newforms-admin/django/test/client.py (modified) (3 diffs)
- django/branches/newforms-admin/django/test/testcases.py (modified) (3 diffs)
- django/branches/newforms-admin/docs/authentication.txt (modified) (1 diff)
- django/branches/newforms-admin/docs/cache.txt (modified) (1 diff)
- django/branches/newforms-admin/docs/db-api.txt (modified) (1 diff)
- django/branches/newforms-admin/docs/distributions.txt (modified) (3 diffs)
- django/branches/newforms-admin/docs/django-admin.txt (modified) (1 diff)
- django/branches/newforms-admin/docs/modpython.txt (modified) (1 diff)
- django/branches/newforms-admin/docs/templates.txt (modified) (2 diffs)
- django/branches/newforms-admin/docs/testing.txt (modified) (3 diffs)
- django/branches/newforms-admin/docs/tutorial01.txt (modified) (2 diffs)
- django/branches/newforms-admin/tests/modeltests/test_client/models.py (modified) (3 diffs)
- django/branches/newforms-admin/tests/modeltests/test_client/views.py (modified) (10 diffs)
- django/branches/newforms-admin/tests/regressiontests/defaultfilters/tests.py (modified) (2 diffs)
- django/branches/newforms-admin/tests/regressiontests/test_client_regress/fixtures (copied) (copied from django/trunk/tests/regressiontests/test_client_regress/fixtures)
- django/branches/newforms-admin/tests/regressiontests/test_client_regress/fixtures/testdata.json (copied) (copied from django/trunk/tests/regressiontests/test_client_regress/fixtures/testdata.json)
- django/branches/newforms-admin/tests/regressiontests/test_client_regress/models.py (modified) (5 diffs)
- django/branches/newforms-admin/tests/regressiontests/test_client_regress/urls.py (modified) (1 diff)
- django/branches/newforms-admin/tests/regressiontests/test_client_regress/views.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/newforms-admin
- Property svnmerge-integrated changed from /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6015 to /django/trunk:1-4345,4350-4357,4359-4365,4371-4372,4374-4377,4380-4386,4388,4390-4391,4400-4402,4404-4408,4410,4412-4419,4426-4427,4430-4432,4434,4441,4443-4444,4446-4447,4450,4452-4453,4455-4458,4476,4503,4546,4564-4569,4580-4586,4617,4630,4641-6050
django/branches/newforms-admin/AUTHORS
r6014 r6051 261 261 Thomas Steinacher <http://www.eggdrop.ch/> 262 262 nowell strite 263 Thomas Stromberg <tstromberg@google.com> 263 264 Sundance 264 265 SuperJared django/branches/newforms-admin/django/contrib/csrf/middleware.py
r4265 r6051 41 41 42 42 def process_request(self, request): 43 if request. POST:43 if request.method == 'POST': 44 44 try: 45 45 session_id = request.COOKIES[settings.SESSION_COOKIE_NAME] django/branches/newforms-admin/django/contrib/localflavor/it/it_province.py
r5918 r6051 46 46 ('IS', 'Isernia'), 47 47 ('SP', 'La Spezia'), 48 ('AQ', u'L’A cquila'),48 ('AQ', u'L’Aquila'), 49 49 ('LT', 'Latina'), 50 50 ('LE', 'Lecce'), django/branches/newforms-admin/django/core/management/base.py
r5984 r6051 2 2 from django.core.management.color import color_style 3 3 import sys 4 import os 4 5 5 6 class CommandError(Exception): … … 45 46 sys.exit(1) 46 47 47 def validate(self, app=None ):48 def validate(self, app=None, display_num_errors=False): 48 49 """ 49 50 Validates the given app, raising CommandError for any errors. … … 62 63 error_text = s.read() 63 64 raise CommandError("One or more models did not validate:\n%s" % error_text) 65 if display_num_errors: 66 print "%s error%s found" % (num_errors, num_errors != 1 and 's' or '') 64 67 65 68 def handle(self, *args, **options): … … 120 123 def copy_helper(style, app_or_project, name, directory, other_name=''): 121 124 import django 122 import os123 125 import re 124 126 import shutil … … 156 158 try: 157 159 shutil.copymode(path_old, path_new) 160 _make_writeable(path_new) 158 161 except OSError: 159 162 sys.stderr.write(style.NOTICE("Notice: Couldn't set permission bits on %s. You're probably using an uncommon filesystem setup. No problem.\n" % path_new)) 163 164 def _make_writeable(filename): 165 "Makes sure that the file is writeable. Useful if our source is read-only." 166 import stat 167 if not os.access(filename, os.W_OK): 168 st = os.stat(filename) 169 new_permissions = stat.S_IMODE(st.st_mode) | stat.S_IWUSR 170 os.chmod(filename, new_permissions) 171 django/branches/newforms-admin/django/core/management/color.py
r5918 r6051 8 8 def color_style(): 9 9 "Returns a Style object with the Django color scheme." 10 if sys.platform == 'win32' or sys.platform == 'Pocket PC' or not sys.stdout.isatty():10 if sys.platform == 'win32' or sys.platform == 'Pocket PC' or sys.platform.startswith('java') or not sys.stdout.isatty(): 11 11 return no_style() 12 12 class dummy: pass django/branches/newforms-admin/django/core/management/commands/runserver.py
r6014 r6051 38 38 from django.conf import settings 39 39 print "Validating models..." 40 self.validate( )40 self.validate(display_num_errors=True) 41 41 print "\nDjango version %s, using settings %r" % (django.get_version(), settings.SETTINGS_MODULE) 42 42 print "Development server is running at http://%s:%s/" % (addr, port) django/branches/newforms-admin/django/core/management/commands/startproject.py
r5918 r6051 29 29 main_settings_file = os.path.join(directory, project_name, 'settings.py') 30 30 settings_contents = open(main_settings_file, 'r').read() 31 32 # If settings.py was copied from a read-only source, make it writeable.33 if not os.access(main_settings_file, os.W_OK):34 os.chmod(main_settings_file, 0600)35 36 31 fp = open(main_settings_file, 'w') 37 32 secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)]) django/branches/newforms-admin/django/core/management/commands/validate.py
r5918 r6051 7 7 8 8 def handle_noargs(self, **options): 9 self.validate( )9 self.validate(display_num_errors=True) django/branches/newforms-admin/django/db/backends/sqlite3/base.py
r5984 r6051 1 1 """ 2 SQLite3 backend for django. Requires pysqlite2 (http://pysqlite.org/). 2 SQLite3 backend for django. 3 4 Python 2.3 and 2.4 require pysqlite2 (http://pysqlite.org/). 5 6 Python 2.5 and later use the sqlite3 module in the standard library. 3 7 """ 4 8 django/branches/newforms-admin/django/template/defaultfilters.py
r5828 r6051 356 356 WITHOUT opening and closing <ul> tags. 357 357 358 The list is assumed to be in the proper format. For example, if ``var`` contains359 ``['States', [['Kansas', [['Lawrence', []], ['Topeka', []]]], ['Illinois', []]]]``,358 The list is assumed to be in the proper format. For example, if ``var`` 359 contains: ``['States', ['Kansas', ['Lawrence', 'Topeka'], 'Illinois']]``, 360 360 then ``{{ var|unordered_list }}`` would return:: 361 361 … … 372 372 </li> 373 373 """ 374 def _helper(value, tabs): 374 def convert_old_style_list(list_): 375 """ 376 Converts old style lists to the new easier to understand format. 377 378 The old list format looked like: 379 ['Item 1', [['Item 1.1', []], ['Item 1.2', []]] 380 381 And it is converted to: 382 ['Item 1', ['Item 1.1', 'Item 1.2]] 383 """ 384 if not isinstance(list_, (tuple, list)) or len(list_) != 2: 385 return list_, False 386 first_item, second_item = list_ 387 if second_item == []: 388 return [first_item], True 389 old_style_list = True 390 new_second_item = [] 391 for sublist in second_item: 392 item, old_style_list = convert_old_style_list(sublist) 393 if not old_style_list: 394 break 395 new_second_item.extend(item) 396 if old_style_list: 397 second_item = new_second_item 398 return [first_item, second_item], old_style_list 399 def _helper(list_, tabs=1): 375 400 indent = u'\t' * tabs 376 if value[1]: 377 return u'%s<li>%s\n%s<ul>\n%s\n%s</ul>\n%s</li>' % (indent, force_unicode(value[0]), indent, 378 u'\n'.join([_helper(v, tabs+1) for v in value[1]]), indent, indent) 379 else: 380 return u'%s<li>%s</li>' % (indent, force_unicode(value[0])) 381 return _helper(value, 1) 401 output = [] 402 403 list_length = len(list_) 404 i = 0 405 while i < list_length: 406 title = list_[i] 407 sublist = '' 408 sublist_item = None 409 if isinstance(title, (list, tuple)): 410 sublist_item = title 411 title = '' 412 elif i < list_length - 1: 413 next_item = list_[i+1] 414 if next_item and isinstance(next_item, (list, tuple)): 415 # The next item is a sub-list. 416 sublist_item = next_item 417 # We've processed the next item now too. 418 i += 1 419 if sublist_item: 420 sublist = _helper(sublist_item, tabs+1) 421 sublist = '\n%s<ul>\n%s\n%s</ul>\n%s' % (indent, sublist, 422 indent, indent) 423 output.append('%s<li>%s%s</li>' % (indent, force_unicode(title), 424 sublist)) 425 i += 1 426 return '\n'.join(output) 427 value, converted = convert_old_style_list(value) 428 return _helper(value) 382 429 383 430 ################### django/branches/newforms-admin/django/test/client.py
r5918 r6051 12 12 from django.dispatch import dispatcher 13 13 from django.http import SimpleCookie, HttpRequest 14 from django.template import TemplateDoesNotExist 14 15 from django.test import signals 15 16 from django.utils.functional import curry … … 166 167 dispatcher.connect(self.store_exc_info, signal=got_request_exception) 167 168 168 response = self.handler(environ) 169 try: 170 response = self.handler(environ) 171 except TemplateDoesNotExist, e: 172 # If the view raises an exception, Django will attempt to show 173 # the 500.html template. If that template is not available, 174 # we should ignore the error in favor of re-raising the 175 # underlying exception that caused the 500 error. Any other 176 # template found to be missing during view error handling 177 # should be reported as-is. 178 if e.args != ('500.html',): 179 raise 180 181 # Look for a signalled exception and reraise it 182 if self.exc_info: 183 raise self.exc_info[1], None, self.exc_info[2] 184 185 # Save the client and request that stimulated the response 186 response.client = self 187 response.request = request 169 188 170 189 # Add any rendered template detail to the response … … 180 199 setattr(response, detail, None) 181 200 182 # Look for a signalled exception and reraise it183 if self.exc_info:184 raise self.exc_info[1], None, self.exc_info[2]185 186 201 # Update persistent cookie data 187 202 if response.cookies: django/branches/newforms-admin/django/test/testcases.py
r5918 r6051 1 import re, unittest 2 from urlparse import urlparse 1 import re 2 import unittest 3 from urlparse import urlsplit 4 5 from django.http import QueryDict 3 6 from django.db import transaction 4 7 from django.core import mail 5 8 from django.core.management import call_command 6 from django.db.models import get_apps7 9 from django.test import _doctest as doctest 8 10 from django.test.client import Client 9 11 10 12 normalize_long_ints = lambda s: re.sub(r'(?<![\w])(\d+)L(?![\w])', '\\1', s) 13 14 def to_list(value): 15 """ 16 Puts value into a list if it's not already one. 17 Returns an empty list if value is None. 18 """ 19 if value is None: 20 value = [] 21 elif not isinstance(value, list): 22 value = [value] 23 return value 24 11 25 12 26 class OutputChecker(doctest.OutputChecker): … … 21 35 return normalize_long_ints(want) == normalize_long_ints(got) 22 36 return ok 23 37 24 38 class DocTestRunner(doctest.DocTestRunner): 25 39 def __init__(self, *args, **kwargs): 26 40 doctest.DocTestRunner.__init__(self, *args, **kwargs) 27 41 self.optionflags = doctest.ELLIPSIS 28 42 29 43 def report_unexpected_exception(self, out, test, example, exc_info): 30 doctest.DocTestRunner.report_unexpected_exception(self, out,test,example,exc_info)31 44 doctest.DocTestRunner.report_unexpected_exception(self, out, test, 45 example, exc_info) 32 46 # Rollback, in case of database errors. Otherwise they'd have 33 47 # side effects on other tests. 34 from django.db import transaction35 48 transaction.rollback_unless_managed() 36 49 37 class TestCase(unittest.TestCase): 50 class TestCase(unittest.TestCase): 38 51 def _pre_setup(self): 39 """Perform any pre-test setup. This includes: 40 41 * If the Test Case class has a 'fixtures' member, clearing the 42 database and installing the named fixtures at the start of each test. 52 """Performs any pre-test setup. This includes: 53 54 * If the Test Case class has a 'fixtures' member, clearing the 55 database and installing the named fixtures at the start of each 56 test. 43 57 * Clearing the mail test outbox. 44 45 58 """ 46 59 call_command('flush', verbosity=0, interactive=False) … … 61 74 super(TestCase, self).__call__(result) 62 75 63 def assertRedirects(self, response, expected_path, status_code=302, target_status_code=200): 64 """Assert that a response redirected to a specific URL, and that the 76 def assertRedirects(self, response, expected_url, status_code=302, 77 target_status_code=200): 78 """Asserts that a response redirected to a specific URL, and that the 65 79 redirect URL can be loaded. 66 67 """ 68 self.assertEqual(response.status_code, status_code, 69 "Response didn't redirect as expected: Response code was %d (expected %d)" % 70 (response.status_code, status_code)) 71 scheme, netloc, path, params, query, fragment = urlparse(response['Location']) 72 self.assertEqual(path, expected_path, 73 "Response redirected to '%s', expected '%s'" % (path, expected_path)) 74 redirect_response = self.client.get(path) 75 self.assertEqual(redirect_response.status_code, target_status_code, 76 "Couldn't retrieve redirection page '%s': response code was %d (expected %d)" % 77 (path, redirect_response.status_code, target_status_code)) 78 79 def assertContains(self, response, text, count=None, status_code=200): 80 """Assert that a response indicates that a page was retreived successfully, 81 (i.e., the HTTP status code was as expected), and that ``text`` occurs ``count`` 82 times in the content of the response. If ``count`` is None, the count doesn't 83 matter - the assertion is true if the text occurs at least once in the response. 84 80 81 Note that assertRedirects won't work for external links since it uses 82 TestClient to do a request. 85 83 """ 86 84 self.assertEqual(response.status_code, status_code, 87 "Couldn't retrieve page: Response code was %d (expected %d)'" % 85 ("Response didn't redirect as expected: Response code was %d" 86 " (expected %d)" % (response.status_code, status_code))) 87 scheme, netloc, path, query, fragment = urlsplit(response['Location']) 88 url = path 89 if query: 90 url += '?' + query 91 if fragment: 92 url += '#' + fragment 93 self.assertEqual(url, expected_url, 94 "Response redirected to '%s', expected '%s'" % (url, expected_url)) 95 96 # Get the redirection page, using the same client that was used 97 # to obtain the original response. 98 redirect_response = response.client.get(path, QueryDict(query)) 99 self.assertEqual(redirect_response.status_code, target_status_code, 100 ("Couldn't retrieve redirection page '%s': response code was %d" 101 " (expected %d)") % 102 (path, redirect_response.status_code, target_status_code)) 103 104 def assertContains(self, response, text, count=None, status_code=200): 105 """ 106 Asserts that a response indicates that a page was retreived 107 successfully, (i.e., the HTTP status code was as expected), and that 108 ``text`` occurs ``count`` times in the content of the response. 109 If ``count`` is None, the count doesn't matter - the assertion is true 110 if the text occurs at least once in the response. 111 """ 112 self.assertEqual(response.status_code, status_code, 113 "Couldn't retrieve page: Response code was %d (expected %d)'" % 88 114 (response.status_code, status_code)) 89 115 real_count = response.content.count(text) 90 116 if count is not None: 91 117 self.assertEqual(real_count, count, 92 "Found %d instances of '%s' in response (expected %d)" % (real_count, text, count)) 118 "Found %d instances of '%s' in response (expected %d)" % 119 (real_count, text, count)) 93 120 else: 94 self.failUnless(real_count != 0, "Couldn't find '%s' in response" % text) 95 121 self.failUnless(real_count != 0, 122 "Couldn't find '%s' in response" % text) 123 96 124 def assertFormError(self, response, form, field, errors): 97 "Assert that a form used to render the response has a specific field error" 98 if not response.context: 99 self.fail('Response did not use any contexts to render the response') 125 """ 126 Asserts that a form used to render the response has a specific field 127 error. 128 """ 129 # Put context(s) into a list to simplify processing. 130 contexts = to_list(response.context) 131 if not contexts: 132 self.fail('Response did not use any contexts to render the' 133 ' response') 100 134 101 # If there is a single context, put it into a list to simplify processing 102 if not isinstance(response.context, list): 103 contexts = [response.context] 104 else: 105 contexts = response.context 135 # Put error(s) into a list to simplify processing. 136 errors = to_list(errors) 106 137 107 # If a single error string is provided, make it a list to simplify processing108 if not isinstance(errors, list):109 errors = [errors]110 111 138 # Search all contexts for the error. 112 139 found_form = False 113 140 for i,context in enumerate(contexts): 114 if form in context: 115 found_form = True 116 for err in errors: 117 if field: 118 if field in context[form].errors: 119 self.failUnless(err in context[form].errors[field], 120 "The field '%s' on form '%s' in context %d does not contain the error '%s' (actual errors: %s)" % 121 (field, form, i, err, list(context[form].errors[field]))) 122 elif field in context[form].fields: 123 self.fail("The field '%s' on form '%s' in context %d contains no errors" % 124 (field, form, i)) 125 else: 126 self.fail("The form '%s' in context %d does not contain the field '%s'" % (form, i, field)) 141 if form not in context: 142 continue 143 found_form = True 144 for err in errors: 145 if field: 146 if field in context[form].errors: 147 field_errors = context[form].errors[field] 148 self.failUnless(err in field_errors, 149 "The field '%s' on form '%s' in" 150 " context %d does not contain the" 151 " error '%s' (actual errors: %s)" % 152 (field, form, i, err, 153 list(field_errors))) 154 elif field in context[form].fields: 155 self.fail("The field '%s' on form '%s' in context %d" 156 " contains no errors" % (field, form, i)) 127 157 else: 128 self.failUnless(err in context[form].non_field_errors(), 129 "The form '%s' in context %d does not contain the non-field error '%s' (actual errors: %s)" % 130 (form, i, err, list(context[form].non_field_errors()))) 158 self.fail("The form '%s' in context %d does not" 159 " contain the field '%s'" % 160 (form, i, field)) 161 else: 162 non_field_errors = context[form].non_field_errors() 163 self.failUnless(err in non_field_errors, 164 "The form '%s' in context %d does not contain the" 165 " non-field error '%s' (actual errors: %s)" % 166 (form, i, err, non_field_errors)) 131 167 if not found_form: 132 self.fail("The form '%s' was not used to render the response" % form) 133 168 self.fail("The form '%s' was not used to render the response" % 169 form) 170 134 171 def assertTemplateUsed(self, response, template_name): 135 "Assert that the template with the provided name was used in rendering the response" 136 if isinstance(response.template, list): 137 template_names = [t.name for t in response.template] 138 self.failUnless(template_name in template_names, 139 u"Template '%s' was not one of the templates used to render the response. Templates used: %s" % 140 (template_name, u', '.join(template_names))) 141 elif response.template: 142 self.assertEqual(template_name, response.template.name, 143 u"Template '%s' was not used to render the response. Actual template was '%s'" % 144 (template_name, response.template.name)) 145 else: 172 """ 173 Asserts that the template with the provided name was used in rendering 174 the response. 175 """ 176 template_names = [t.name for t in to_list(response.template)] 177 if not template_names: 146 178 self.fail('No templates used to render the response') 179 self.failUnless(template_name in template_names, 180 (u"Template '%s' was not a template used to render the response." 181 u" Actual template(s) used: %s") % (template_name, 182 u', '.join(template_names))) 147 183 148 184 def assertTemplateNotUsed(self, response, template_name): 149 " Assert that the template with the provided name was NOT used in rendering the response"150 if isinstance(response.template, list):151 self.failIf(template_name in [t.name for t in response.template],152 u"Template '%s' was used unexpectedly in rendering the response" % template_name)153 elif response.template:154 self.assertNotEqual(template_name, response.template.name,155 u"Template '%s' was used unexpectedly in rendering the response" % template_name)156 185 """ 186 Asserts that the template with the provided name was NOT used in 187 rendering the response. 188 """ 189 template_names = [t.name for t in to_list(response.template)] 190 self.failIf(template_name in template_names, 191 (u"Template '%s' was used unexpectedly in rendering the" 192 u" response") % template_name) django/branches/newforms-admin/docs/authentication.txt
r5918 r6051 191 191 >>> user = User.objects.create_user('john', 'lennon@thebeatles.com', 'johnpassword') 192 192 193 # At this point, user is a User object ready to besaved193 # At this point, user is a User object that has already been saved 194 194 # to the database. You can continue to change its attributes 195 195 # if you want to change other fields. django/branches/newforms-admin/docs/cache.txt
r5828 r6051 177 177 This is useful if you have a production site that uses heavy-duty caching in 178 178 various places but a development/test environment on which you don't want to 179 cache. In that case, set ``CACHE_BACKEND`` to ``"dummy:///"`` in the settings 180 file for your development environment. As a result, your development 181 environment won't use caching and your production environment still will. 179 cache. As a result, your development environment won't use caching and your 180 production environment still will. To activate dummy caching, set 181 ``CACHE_BACKEND`` like so:: 182 183 CACHE_BACKEND = 'dummy:///' 182 184 183 185 CACHE_BACKEND arguments django/branches/newforms-admin/docs/db-api.txt
r6014 r6051 161 161 saved. (These signals are not yet documented.) 162 162 163 Raw Saves163 Raw saves 164 164 ~~~~~~~~~ 165 165 django/branches/newforms-admin/docs/distributions.txt
r5828 r6051 15 15 16 16 .. _installing the development version: ../install/#installing-the-development-version 17 18 FreeBSD 19 ======= 20 21 The `FreeBSD`_ ports system offers both Django 0.96 (`py-django`_) and a more 22 recent, but not current, version based on Django's trunk (`py-django-devel`_). 23 These are installed in the normal FreeBSD way; for Django 0.96, for example, type: 24 ``cd /usr/ports/www/py-django && sudo make install clean``. 25 26 .. _FreeBSD: http://www.freebsd.org/ 27 .. _py-django: http://www.freebsd.org/cgi/cvsweb.cgi/ports/www/py-django/ 28 .. _py-django-devel: http://www.freebsd.org/cgi/cvsweb.cgi/ports/www/py-django-devel/ 17 29 18 30 Linux distributions … … 33 45 .. _Debian GNU/Linux: http://www.debian.org/ 34 46 .. _packaged version of Django: http://packages.debian.org/stable/python/python-django 35 36 Ubuntu37 ------38 39 The Debian ``python-django`` package is also available for `Ubuntu Linux`_, in40 the "universe" repository for Ubuntu 7.04 ("Feisty Fawn"). The `current Ubuntu41 package`_ is also based on Django 0.95.1 and can be installed in the same42 fashion as for Debian.43 44 .. _Ubuntu Linux: http://www.ubuntu.com/45 .. _current Ubuntu package: http://packages.ubuntu.com/feisty/python/python-django46 47 47 48 Fedora … … 65 66 .. _Gentoo Linux: http://www.gentoo.org/ 66 67 .. _current Gentoo build: http://packages.gentoo.org/packages/?category=dev-python;name=django 68 69 Ubuntu 70 ------ 71 72 The Debian ``python-django`` package is also available for `Ubuntu Linux`_, in 73 the "universe" repository for Ubuntu 7.04 ("Feisty Fawn"). The `current Ubuntu 74 package`_ is also based on Django 0.95.1 and can be installed in the same 75 fashion as for Debian. 76 77 .. _Ubuntu Linux: http://www.ubuntu.com/ 78 .. _current Ubuntu package: http://packages.ubuntu.com/feisty/python/python-django 79 67 80 68 81 Mac OS X django/branches/newforms-admin/docs/django-admin.txt
r6014 r6051 480 480 not yet accept a ``host`` or ``port`` parameter. 481 481 482 Also note that it does *not* automatically detect changes to your Python source 483 code (as ``runserver`` does). It does, however, detect changes to templates. 484 482 485 .. _unit tests: ../testing/ 483 486 django/branches/newforms-admin/docs/modpython.txt
r5918 r6051 263 263 mod_python as described above__ (you need to do this even if you aren't 264 264 serving multiple installations in this case). Then add the ``PythonImport`` 265 line inside the ``Location`` or ``VirtualHost`` section. For example:: 265 line in the main server configuration (i.e., outside the ``Location`` or 266 ``VirtualHost`` sections). For example:: 266 267 267 268 PythonInterpreter my_django django/branches/newforms-admin/docs/templates.txt
r5984 r6051 1302 1302 WITHOUT opening and closing <ul> tags. 1303 1303 1304 **Changed in Django development version** 1305 1306 The format accepted by ``unordered_list`` has changed to an easier to 1307 understand format. 1308 1304 1309 The list is assumed to be in the proper format. For example, if ``var`` contains 1305 ``['States', [ ['Kansas', [['Lawrence', []], ['Topeka', []]]], ['Illinois', []]]]``,1306 then``{{ var|unordered_list }}`` would return::1310 ``['States', ['Kansas', ['Lawrence', 'Topeka'], 'Illinois']]``, then 1311 ``{{ var|unordered_list }}`` would return:: 1307 1312 1308 1313 <li>States … … 1318 1323 </li> 1319 1324 1325 Note: the previous more restrictive and verbose format is still supported: 1326 ``['States', [['Kansas', [['Lawrence', []], ['Topeka', []]]], ['Illinois', []]]]``, 1327 1320 1328 upper 1321 1329 ~~~~~ django/branches/newforms-admin/docs/testing.txt
r6014 r6051 578 578 Attribute Description 579 579 =============== ========================================================== 580 `` status_code`` The HTTP status of the response, as an integer. See581 RFC2616_ for a full list of HTTP status codes.580 ``client`` The test client that was used to make the request that 581 resulted in the response. 582 582 583 583 ``content`` The body of the response, as a string. This is the final 584 584 page content as rendered by the view, or any error 585 585 message (such as the URL for a 302 redirect). 586 587 ``context`` The template ``Context`` instance that was used to render 588 the template that produced the response content. 589 590 If the rendered page used multiple templates, then 591 ``context`` will be a list of ``Context`` 592 objects, in the order in which they were rendered. 593 594 ``request`` The request data that stimulated the response. 595 596 ``status_code`` The HTTP status of the response, as an integer. See 597 RFC2616_ for a full list of HTTP status codes. 586 598 587 599 ``template`` The ``Template`` instance that was used to render the … … 595 607 be a list of ``Template`` instances, in the order in 596 608 which they were rendered. 597 598 ``context`` The template ``Context`` instance that was used to render599 the template that produced the response content.600 601 As with ``template``, if the rendered page used multiple602 templates, then ``context`` will be a list of ``Context``603 objects, in the order in which they were rendered.604 609 =============== ========================================================== 605 610 … … 827 832 the response. 828 833 829 ``assertRedirects(response, expected_ path, status_code=302, target_status_code=200)``834 ``assertRedirects(response, expected_url, status_code=302, target_status_code=200)`` 830 835 Asserts that the response return a ``status_code`` redirect status, 831 it redirected to ``expected_ path`` and the subsequent page was received with832 ``target_status_code``.836 it redirected to ``expected_url`` (including any GET data), and the subsequent 837 page was received with ``target_status_code``. 833 838 834 839 ``assertTemplateUsed(response, template_name)`` django/branches/newforms-admin/docs/tutorial01.txt
r6014 r6051 260 260 votes = models.IntegerField() 261 261 262 .. adm inition:: Errors about ``max_length``262 .. admonition:: Errors about ``max_length`` 263 263 264 264 If Django gives you an error message saying that ``max_length`` is … … 384 384 385 385 If you're interested, also run the following commands: 386 * ``python manage.py validate polls`` -- Checks for any errors in the386 * ``python manage.py validate`` -- Checks for any errors in the 387 387 construction of your models. 388 388 django/branches/newforms-admin/tests/modeltests/test_client/models.py
r5984 r6051 87 87 # Check that the response was a 302 (redirect) 88 88 self.assertRedirects(response, '/test_client/get_view/') 89 90 def test_redirect_with_query(self): 91 "GET a URL that redirects with given GET parameters" 92 response = self.client.get('/test_client/redirect_view/', {'var': 'value'}) 93 94 # Check if parameters are intact 95 self.assertRedirects(response, '/test_client/get_view/?var=value') 89 96 90 97 def test_permanent_redirect(self): … … 225 232 # Get the page without logging in. Should result in 302. 226 233 response = self.client.get('/test_client/login_protected_view/')&
