Django

Code

Ticket #11252 (closed: fixed)

Opened 10 months ago

Last modified 6 months ago

Invalid XHTML when filtering a paginated list

Reported by: daemondazz Assigned to: nobody
Milestone: Component: django.contrib.admin
Version: SVN Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

The admin sites generates invalid XHTML when viewing a filtered list of objects and that list needs to be paginated. The invalid tags are the links for jumping to different pages in the result set which have query string like "?p=2&domain__exact=1" instead of "?p=2&domain__exact=1".

This manifests if the site has

DEFAULT_CONTENT_TYPE = 'application/xhtml+xml'

set in the settings file: Firefox displays an error message about the invalid XHTML code and is not able to show the page.

The culprit in this case is passing the results of urllib.urlencode directly back to the HTML without fixing the amperstands.

Patch to be attached in a moment.

Attachments

django_admin_pagination_fixamperstands.patch (1.2 kB) - added by daemondazz on 06/02/09 22:56:20.
Patch to wrap the return of urllib.urlencode in fix_amperstands
django_admin_pagination_escape.patch (0.8 kB) - added by daemondazz on 06/09/09 01:01:15.
Updated patch using escape()

Change History

06/02/09 22:56:20 changed by daemondazz

  • attachment django_admin_pagination_fixamperstands.patch added.

Patch to wrap the return of urllib.urlencode in fix_amperstands

06/03/09 01:59:16 changed by SmileyChris

  • needs_better_patch set to 1.
  • stage changed from Unreviewed to Accepted.
  • version changed from 1.0 to SVN.
  • needs_tests changed.
  • needs_docs changed.

Should just use escape

06/09/09 01:01:15 changed by daemondazz

  • attachment django_admin_pagination_escape.patch added.

Updated patch using escape()

06/09/09 01:01:50 changed by daemondazz

Update to use escape() as suggested.

06/09/09 18:11:43 changed by SmileyChris

  • needs_better_patch deleted.
  • stage changed from Accepted to Ready for checkin.

08/06/09 23:06:46 changed by daemondazz

Any movement on this ticket? I still need to apply the patch against 1.1

08/06/09 23:15:07 changed by SmileyChris

Bring up requests like this in the django developers google group.

If you wanted to make this patch better, you could write a test too.

09/10/09 10:36:33 changed by lukeplant

  • status changed from new to closed.
  • resolution set to fixed.

(In [11486]) Fixed #11252: Invalid XHTML when filtering a paginated list. Thanks daemondazz


Add/Change #11252 (Invalid XHTML when filtering a paginated list)




Change Properties
Action