Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#14198 closed (fixed)

« None » appears in priority field of sitemaps when using GenericSitemap without specify priority (#14164 related)

Reported by: palkeo Owned by: nobody
Component: Internationalization Version: dev
Severity: Keywords: internationalization L10N sitemaps none
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When using GenericSitemap class, and without specifying priority, the template generate an invalid sitemap.
The sitemap contains « <priority>None</priority> »

I think it's because of the #14164 patch : It will apply str() on the priority, even if the priority is None ! Then the priority will be « None ».

To reproduce the problem, apply the #14164 patch and then create a sitemap using GenericSitemap, without specifying priority.

For example :

sitemaps = {
    [...]
    'example': GenericSitemap({
            'queryset': Example.objects.all(),
        },
    ),
    [...]
}

Attachments (1)

patch.diff (278 bytes ) - added by palkeo 14 years ago.

Download all attachments as: .zip

Change History (4)

by palkeo, 14 years ago

Attachment: patch.diff added

comment:1 by palkeo, 14 years ago

Here is the patch, that can be applied to django/contrib/sitemaps/init.py :

72c72
<                 'priority':   str(self.__get('priority', item, ''))
---
>                 'priority':   self.__get('priority', item, None)
73a74,75
>             if type(url_info['priority']) == float:
>                 url_info['priority'] = str(url_info['priority'])

comment:2 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: newclosed

(In [13676]) Fixed #14198 -- Corrected rendering of generic sitemaps when no priority is specified. Thanks to palkeo for the report.

comment:3 by Russell Keith-Magee, 14 years ago

(In [13677]) [1.2.X] Fixed #14198 -- Corrected rendering of generic sitemaps when no priority is specified. Thanks to palkeo for the report.

Backport of r13676 from trunk.

Note: See TracTickets for help on using tickets.
Back to Top