#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)
Change History (4)
by , 15 years ago
| Attachment: | patch.diff added |
|---|
comment:1 by , 15 years ago
comment:2 by , 15 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:3 by , 15 years ago
Note:
See TracTickets
for help on using tickets.
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'])