Django

Code

Changeset 6051

Show
Ignore:
Timestamp:
09/05/07 15:01:24 (1 year ago)
Author:
adrian
Message:

newforms-admin: Merged to [6050]

Files:

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  
    261261    Thomas Steinacher <http://www.eggdrop.ch/> 
    262262    nowell strite 
     263    Thomas Stromberg <tstromberg@google.com> 
    263264    Sundance 
    264265    SuperJared 
  • django/branches/newforms-admin/django/contrib/csrf/middleware.py

    r4265 r6051  
    4141     
    4242    def process_request(self, request): 
    43         if request.POST
     43        if request.method == 'POST'
    4444            try: 
    4545                session_id = request.COOKIES[settings.SESSION_COOKIE_NAME] 
  • django/branches/newforms-admin/django/contrib/localflavor/it/it_province.py

    r5918 r6051  
    4646    ('IS', 'Isernia'), 
    4747    ('SP', 'La Spezia'), 
    48     ('AQ', u'L’Acquila'), 
     48    ('AQ', u'L’Aquila'), 
    4949    ('LT', 'Latina'), 
    5050    ('LE', 'Lecce'), 
  • django/branches/newforms-admin/django/core/management/base.py

    r5984 r6051  
    22from django.core.management.color import color_style 
    33import sys 
     4import os 
    45 
    56class CommandError(Exception): 
     
    4546            sys.exit(1) 
    4647 
    47     def validate(self, app=None): 
     48    def validate(self, app=None, display_num_errors=False): 
    4849        """ 
    4950        Validates the given app, raising CommandError for any errors. 
     
    6263            error_text = s.read() 
    6364            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 '') 
    6467 
    6568    def handle(self, *args, **options): 
     
    120123def copy_helper(style, app_or_project, name, directory, other_name=''): 
    121124    import django 
    122     import os 
    123125    import re 
    124126    import shutil 
     
    156158            try: 
    157159                shutil.copymode(path_old, path_new) 
     160                _make_writeable(path_new) 
    158161            except OSError: 
    159162                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 
     164def _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  
    88def color_style(): 
    99    "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(): 
    1111        return no_style() 
    1212    class dummy: pass 
  • django/branches/newforms-admin/django/core/management/commands/runserver.py

    r6014 r6051  
    3838            from django.conf import settings 
    3939            print "Validating models..." 
    40             self.validate(
     40            self.validate(display_num_errors=True
    4141            print "\nDjango version %s, using settings %r" % (django.get_version(), settings.SETTINGS_MODULE) 
    4242            print "Development server is running at http://%s:%s/" % (addr, port) 
  • django/branches/newforms-admin/django/core/management/commands/startproject.py

    r5918 r6051  
    2929        main_settings_file = os.path.join(directory, project_name, 'settings.py') 
    3030        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  
    3631        fp = open(main_settings_file, 'w') 
    3732        secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)]) 
  • django/branches/newforms-admin/django/core/management/commands/validate.py

    r5918 r6051  
    77 
    88    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  
    11""" 
    2 SQLite3 backend for django.  Requires pysqlite2 (http://pysqlite.org/). 
     2SQLite3 backend for django. 
     3 
     4Python 2.3 and 2.4 require pysqlite2 (http://pysqlite.org/). 
     5 
     6Python 2.5 and later use the sqlite3 module in the standard library. 
    37""" 
    48 
  • django/branches/newforms-admin/django/template/defaultfilters.py

    r5828 r6051  
    356356    WITHOUT opening and closing <ul> tags. 
    357357 
    358     The list is assumed to be in the proper format. For example, if ``var`` contains 
    359     ``['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']]``, 
    360360    then ``{{ var|unordered_list }}`` would return:: 
    361361 
     
    372372        </li> 
    373373    """ 
    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): 
    375400        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) 
    382429 
    383430################### 
  • django/branches/newforms-admin/django/test/client.py

    r5918 r6051  
    1212from django.dispatch import dispatcher 
    1313from django.http import SimpleCookie, HttpRequest 
     14from django.template import TemplateDoesNotExist 
    1415from django.test import signals 
    1516from django.utils.functional import curry 
     
    166167        dispatcher.connect(self.store_exc_info, signal=got_request_exception) 
    167168 
    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 
    169188 
    170189        # Add any rendered template detail to the response 
     
    180199                setattr(response, detail, None) 
    181200 
    182         # Look for a signalled exception and reraise it 
    183         if self.exc_info: 
    184             raise self.exc_info[1], None, self.exc_info[2] 
    185  
    186201        # Update persistent cookie data 
    187202        if response.cookies: 
  • django/branches/newforms-admin/django/test/testcases.py

    r5918 r6051  
    1 import re, unittest 
    2 from urlparse import urlparse 
     1import re 
     2import unittest 
     3from urlparse import urlsplit 
     4 
     5from django.http import QueryDict 
    36from django.db import transaction 
    47from django.core import mail 
    58from django.core.management import call_command 
    6 from django.db.models import get_apps 
    79from django.test import _doctest as doctest 
    810from django.test.client import Client 
    911 
    1012normalize_long_ints = lambda s: re.sub(r'(?<![\w])(\d+)L(?![\w])', '\\1', s) 
     13 
     14def 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 
    1125 
    1226class OutputChecker(doctest.OutputChecker): 
     
    2135            return normalize_long_ints(want) == normalize_long_ints(got) 
    2236        return ok 
    23                    
     37 
    2438class DocTestRunner(doctest.DocTestRunner): 
    2539    def __init__(self, *args, **kwargs): 
    2640        doctest.DocTestRunner.__init__(self, *args, **kwargs) 
    2741        self.optionflags = doctest.ELLIPSIS 
    28          
     42 
    2943    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) 
    3246        # Rollback, in case of database errors. Otherwise they'd have 
    3347        # side effects on other tests. 
    34         from django.db import transaction 
    3548        transaction.rollback_unless_managed() 
    3649 
    37 class TestCase(unittest.TestCase):     
     50class TestCase(unittest.TestCase): 
    3851    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. 
    4357            * Clearing the mail test outbox. 
    44              
    4558        """ 
    4659        call_command('flush', verbosity=0, interactive=False) 
     
    6174        super(TestCase, self).__call__(result) 
    6275 
    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 
    6579        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. 
    8583        """ 
    8684        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)'" % 
    88114                (response.status_code, status_code)) 
    89115        real_count = response.content.count(text) 
    90116        if count is not None: 
    91117            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)) 
    93120        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 
    96124    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') 
    100134 
    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) 
    106137 
    107         # If a single error string is provided, make it a list to simplify processing 
    108         if not isinstance(errors, list): 
    109             errors = [errors] 
    110          
    111138        # Search all contexts for the error. 
    112139        found_form = False 
    113140        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)) 
    127157                    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)) 
    131167        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 
    134171    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: 
    146178            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))) 
    147183 
    148184    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  
    191191    >>> user = User.objects.create_user('john', 'lennon@thebeatles.com', 'johnpassword') 
    192192 
    193     # At this point, user is a User object ready to be saved 
     193    # At this point, user is a User object that has already been saved 
    194194    # to the database. You can continue to change its attributes 
    195195    # if you want to change other fields. 
  • django/branches/newforms-admin/docs/cache.txt

    r5828 r6051  
    177177This is useful if you have a production site that uses heavy-duty caching in 
    178178various 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. 
     179cache. As a result, your development environment won't use caching and your 
     180production environment still will. To activate dummy caching, set 
     181``CACHE_BACKEND`` like so:: 
     182 
     183    CACHE_BACKEND = 'dummy:///' 
    182184 
    183185CACHE_BACKEND arguments 
  • django/branches/newforms-admin/docs/db-api.txt

    r6014 r6051  
    161161       saved. (These signals are not yet documented.) 
    162162 
    163 Raw Saves 
     163Raw saves 
    164164~~~~~~~~~ 
    165165 
  • django/branches/newforms-admin/docs/distributions.txt

    r5828 r6051  
    1515 
    1616.. _installing the development version: ../install/#installing-the-development-version 
     17 
     18FreeBSD 
     19======= 
     20 
     21The `FreeBSD`_ ports system offers both Django 0.96 (`py-django`_) and a more  
     22recent, but not current, version based on Django's trunk (`py-django-devel`_).  
     23These 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/ 
    1729 
    1830Linux distributions 
     
    3345.. _Debian GNU/Linux: http://www.debian.org/ 
    3446.. _packaged version of Django: http://packages.debian.org/stable/python/python-django 
    35  
    36 Ubuntu 
    37 ------ 
    38  
    39 The Debian ``python-django`` package is also available for `Ubuntu Linux`_, in 
    40 the "universe" repository for Ubuntu 7.04 ("Feisty Fawn"). The `current Ubuntu 
    41 package`_ is also based on Django 0.95.1 and can be installed in the same 
    42 fashion as for Debian. 
    43  
    44 .. _Ubuntu Linux: http://www.ubuntu.com/ 
    45 .. _current Ubuntu package: http://packages.ubuntu.com/feisty/python/python-django 
    4647 
    4748Fedora 
     
    6566.. _Gentoo Linux: http://www.gentoo.org/ 
    6667.. _current Gentoo build: http://packages.gentoo.org/packages/?category=dev-python;name=django 
     68 
     69Ubuntu 
     70------ 
     71 
     72The Debian ``python-django`` package is also available for `Ubuntu Linux`_, in 
     73the "universe" repository for Ubuntu 7.04 ("Feisty Fawn"). The `current Ubuntu 
     74package`_ is also based on Django 0.95.1 and can be installed in the same 
     75fashion as for Debian. 
     76 
     77.. _Ubuntu Linux: http://www.ubuntu.com/ 
     78.. _current Ubuntu package: http://packages.ubuntu.com/feisty/python/python-django 
     79 
    6780 
    6881Mac OS X 
  • django/branches/newforms-admin/docs/django-admin.txt

    r6014 r6051  
    480480not yet accept a ``host`` or ``port`` parameter. 
    481481 
     482Also note that it does *not* automatically detect changes to your Python source 
     483code (as ``runserver`` does). It does, however, detect changes to templates. 
     484 
    482485.. _unit tests: ../testing/ 
    483486 
  • django/branches/newforms-admin/docs/modpython.txt

    r5918 r6051  
    263263mod_python as described above__ (you need to do this even if you aren't 
    264264serving multiple installations in this case). Then add the ``PythonImport`` 
    265 line inside the ``Location`` or ``VirtualHost`` section. For example:: 
     265line in the main server configuration (i.e., outside the ``Location`` or 
     266``VirtualHost`` sections). For example:: 
    266267 
    267268    PythonInterpreter my_django 
  • django/branches/newforms-admin/docs/templates.txt

    r5984 r6051  
    13021302WITHOUT opening and closing <ul> tags. 
    13031303 
     1304**Changed in Django development version** 
     1305 
     1306The format accepted by ``unordered_list`` has changed to an easier to 
     1307understand format. 
     1308 
    13041309The 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:: 
    13071312 
    13081313    <li>States 
     
    13181323    </li> 
    13191324 
     1325Note: the previous more restrictive and verbose format is still supported: 
     1326``['States', [['Kansas', [['Lawrence', []], ['Topeka', []]]], ['Illinois', []]]]``, 
     1327 
    13201328upper 
    13211329~~~~~ 
  • django/branches/newforms-admin/docs/testing.txt

    r6014 r6051  
    578578    Attribute        Description 
    579579    ===============  ========================================================== 
    580     ``status_code``  The HTTP status of the response, as an integer. See 
    581                      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
    582582 
    583583    ``content``      The body of the response, as a string. This is the final 
    584584                     page content as rendered by the view, or any error 
    585585                     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. 
    586598 
    587599    ``template``     The ``Template`` instance that was used to render the 
     
    595607                     be a list of ``Template`` instances, in the order in 
    596608                     which they were rendered. 
    597  
    598     ``context``      The template ``Context`` instance that was used to render 
    599                      the template that produced the response content. 
    600  
    601                      As with ``template``, if the rendered page used multiple 
    602                      templates, then ``context`` will be a list of ``Context`` 
    603                      objects, in the order in which they were rendered. 
    604609    ===============  ========================================================== 
    605610 
     
    827832    the response. 
    828833 
    829 ``assertRedirects(response, expected_path, status_code=302, target_status_code=200)`` 
     834``assertRedirects(response, expected_url, status_code=302, target_status_code=200)`` 
    830835    Asserts that the response return a ``status_code`` redirect status, 
    831     it redirected to ``expected_path`` and the subsequent page was received with 
    832     ``target_status_code``. 
     836    it redirected to ``expected_url`` (including any GET data), and the subsequent 
     837    page was received with ``target_status_code``. 
    833838 
    834839``assertTemplateUsed(response, template_name)`` 
  • django/branches/newforms-admin/docs/tutorial01.txt

    r6014 r6051  
    260260        votes = models.IntegerField() 
    261261 
    262 .. adminition:: Errors about ``max_length`` 
     262.. admonition:: Errors about ``max_length`` 
    263263 
    264264   If Django gives you an error message saying that ``max_length`` is 
     
    384384 
    385385If you're interested, also run the following commands: 
    386     * ``python manage.py validate polls`` -- Checks for any errors in the 
     386    * ``python manage.py validate`` -- Checks for any errors in the 
    387387      construction of your models. 
    388388 
  • django/branches/newforms-admin/tests/modeltests/test_client/models.py

    r5984 r6051  
    8787        # Check that the response was a 302 (redirect) 
    8888        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') 
    8996 
    9097    def test_permanent_redirect(self): 
     
    225232        # Get the page without logging in. Should result in 302. 
    226233        response = self.client.get('/test_client/login_protected_view/')&