Ticket #19692: 19692.diff

File 19692.diff, 7.8 KB (added by Tim Graham, 11 years ago)
  • docs/howto/outputting-csv.txt

    diff --git a/docs/howto/outputting-csv.txt b/docs/howto/outputting-csv.txt
    index bcc6f38..1f9efb5 100644
    a b Here's an example::  
    2020
    2121    def some_view(request):
    2222        # Create the HttpResponse object with the appropriate CSV header.
    23         response = HttpResponse(mimetype='text/csv')
     23        response = HttpResponse(content_type='text/csv')
    2424        response['Content-Disposition'] = 'attachment; filename="somefilename.csv"'
    2525
    2626        writer = csv.writer(response)
    Here's an example, which generates the same CSV file as above::  
    9292
    9393    def some_view(request):
    9494        # Create the HttpResponse object with the appropriate CSV header.
    95         response = HttpResponse(mimetype='text/csv')
     95        response = HttpResponse(content_type='text/csv')
    9696        response['Content-Disposition'] = 'attachment; filename="somefilename.csv"'
    9797
    9898        # The data is hard-coded here, but you could load it from a database or
    Here's an example, which generates the same CSV file as above::  
    111111
    112112The only difference between this example and the previous example is that this
    113113one uses template loading instead of the CSV module. The rest of the code --
    114 such as the ``mimetype='text/csv'`` -- is the same.
     114such as the ``content_type='text/csv'`` -- is the same.
    115115
    116116Then, create the template ``my_template_name.txt``, with this template code:
    117117
  • docs/howto/outputting-pdf.txt

    diff --git a/docs/howto/outputting-pdf.txt b/docs/howto/outputting-pdf.txt
    index 9d87b97..d15f94f 100644
    a b Here's a "Hello World" example::  
    5151
    5252    def some_view(request):
    5353        # Create the HttpResponse object with the appropriate PDF headers.
    54         response = HttpResponse(mimetype='application/pdf')
     54        response = HttpResponse(content_type='application/pdf')
    5555        response['Content-Disposition'] = 'attachment; filename="somefilename.pdf"'
    5656
    5757        # Create the PDF object, using the response object as its "file."
    Here's the above "Hello World" example rewritten to use :mod:`io`::  
    120120
    121121    def some_view(request):
    122122        # Create the HttpResponse object with the appropriate PDF headers.
    123         response = HttpResponse(mimetype='application/pdf')
     123        response = HttpResponse(content_type='application/pdf')
    124124        response['Content-Disposition'] = 'attachment; filename="somefilename.pdf"'
    125125
    126126        buffer = BytesIO()
  • docs/internals/deprecation.txt

    diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt
    index 63d65d1..ee408ba 100644
    a b these changes.  
    290290  specified as a plain string instead of a tuple will be removed and raise an
    291291  exception.
    292292
    293 * The ``mimetype`` argument to :class:`~django.http.HttpResponse` ``__init__``
    294   will be removed (``content_type`` should be used instead).
     293* The ``mimetype`` argument to the ``__init__`` methods of
     294  :class:`~django.http.HttpResponse`,
     295  :class:`~django.template.response.SimpleTemplateResponse`, and
     296  :class:`~django.template.response.TemplateResponse` will be removed
     297  (``content_type`` should be used instead).
    295298
    296299* When :class:`~django.http.HttpResponse` is instantiated with an iterator,
    297300  or when :attr:`~django.http.HttpResponse.content` is set to an iterator,
  • docs/ref/contrib/admin/actions.txt

    diff --git a/docs/ref/contrib/admin/actions.txt b/docs/ref/contrib/admin/actions.txt
    index d7eef62..223f2ff 100644
    a b objects as JSON::  
    223223    from django.core import serializers
    224224
    225225    def export_as_json(modeladmin, request, queryset):
    226         response = HttpResponse(mimetype="text/javascript")
     226        response = HttpResponse(content_type="text/javascript")
    227227        serializers.serialize("json", queryset, stream=response)
    228228        return response
    229229
    Conditionally enabling or disabling actions  
    356356                    if 'delete_selected' in actions:
    357357                        del actions['delete_selected']
    358358                return actions
    359 
    360 
  • docs/ref/template-response.txt

    diff --git a/docs/ref/template-response.txt b/docs/ref/template-response.txt
    index 3f5e772..7b8dff5 100644
    a b Attributes  
    5656Methods
    5757-------
    5858
    59 .. method:: SimpleTemplateResponse.__init__(template, context=None, mimetype=None, status=None, content_type=None)
     59.. method:: SimpleTemplateResponse.__init__(template, context=None, status=None, content_type=None)
    6060
    6161    Instantiates a
    6262    :class:`~django.template.response.SimpleTemplateResponse` object
    63     with the given template, context, MIME type and HTTP status.
     63    with the given template, context, content type, and HTTP status.
    6464
    6565    ``template``
    6666        The full name of a template, or a sequence of template names.
    Methods  
    7575        The HTTP Status code for the response.
    7676
    7777    ``content_type``
    78         An alias for ``mimetype``. Historically, this parameter was only called
    79         ``mimetype``, but since this is actually the value included in the HTTP
    80         ``Content-Type`` header, it can also include the character set encoding,
    81         which makes it more than just a MIME type specification. If ``mimetype``
    82         is specified (not ``None``), that value is used. Otherwise,
    83         ``content_type`` is used. If neither is given,
     78        Historically, this parameter was only called ``mimetype`` (now
     79        deprecated), but since this is actually the value included in the HTTP
     80        ``Content-Type`` header, it can also include the character set
     81        encoding, which makes it more than just a MIME type specification. If
     82        ``mimetype`` is specified (not ``None``), that value is used.
     83        Otherwise, ``content_type`` is used. If neither is given,
    8484        :setting:`DEFAULT_CONTENT_TYPE` is used.
    8585
    8686
    TemplateResponse objects  
    144144Methods
    145145-------
    146146
    147 .. method:: TemplateResponse.__init__(request, template, context=None, mimetype=None, status=None, content_type=None, current_app=None)
     147.. method:: TemplateResponse.__init__(request, template, context=None, status=None, content_type=None, current_app=None)
    148148
    149149    Instantiates an ``TemplateResponse`` object with the given
    150150    template, context, MIME type and HTTP status.
    Methods  
    165165        The HTTP Status code for the response.
    166166
    167167    ``content_type``
    168         An alias for ``mimetype``. Historically, this parameter was only called
    169         ``mimetype``, but since this is actually the value included in the HTTP
    170         ``Content-Type`` header, it can also include the character set encoding,
    171         which makes it more than just a MIME type specification. If ``mimetype``
    172         is specified (not ``None``), that value is used. Otherwise,
    173         ``content_type`` is used. If neither is given,
     168        Historically, this parameter was only called ``mimetype`` (now
     169        deprecated), but since this is actually the value included in the HTTP
     170        ``Content-Type`` header, it can also include the character set
     171        encoding, which makes it more than just a MIME type specification. If
     172        ``mimetype`` is specified (not ``None``), that value is used.
     173        Otherwise, ``content_type`` is used. If neither is given,
    174174        :setting:`DEFAULT_CONTENT_TYPE` is used.
    175175
    176176    ``current_app``
  • docs/topics/http/shortcuts.txt

    diff --git a/docs/topics/http/shortcuts.txt b/docs/topics/http/shortcuts.txt
    index b1b4700..1a82723 100644
    a b This example is equivalent to::  
    148148        t = loader.get_template('myapp/template.html')
    149149        c = Context({'foo': 'bar'})
    150150        return HttpResponse(t.render(c),
    151             mimetype="application/xhtml+xml")
     151            content_type="application/xhtml+xml")
    152152
    153153``redirect``
    154154============
Back to Top