Re: [Django] #32648: New sitemap 'alternates' generation feature is bugged using default values.

2021-04-14 Thread Django
#32648: New sitemap 'alternates' generation feature is bugged using default 
values.
-+-
 Reporter:  Arthur   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  contrib.sitemaps |  Version:  3.2
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  alternates   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Carlton Gibson ):

 In [changeset:"65dfb06a1ab56c238cc80f5e1c31f61210c4577d" 65dfb06a]:
 {{{
 #!CommitTicketReference repository=""
 revision="65dfb06a1ab56c238cc80f5e1c31f61210c4577d"
 [3.2.x] Fixed #32648 -- Fixed VariableDoesNotExist rendering sitemaps
 template.

 Backport of 08c60cce3b13f6e60d7588206da2d3c71228f378 from main
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.52b410d22e31158f3dc0762b100d52dd%40djangoproject.com.


Re: [Django] #32648: New sitemap 'alternates' generation feature is bugged using default values.

2021-04-14 Thread Django
#32648: New sitemap 'alternates' generation feature is bugged using default 
values.
-+-
 Reporter:  Arthur   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  contrib.sitemaps |  Version:  3.2
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  alternates   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Carlton Gibson ):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"08c60cce3b13f6e60d7588206da2d3c71228f378" 08c60cc]:
 {{{
 #!CommitTicketReference repository=""
 revision="08c60cce3b13f6e60d7588206da2d3c71228f378"
 Fixed #32648 -- Fixed VariableDoesNotExist rendering sitemaps template.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.f4fc57989c95c74de8855b9200244702%40djangoproject.com.


Re: [Django] #32648: New sitemap 'alternates' generation feature is bugged using default values.

2021-04-14 Thread Django
#32648: New sitemap 'alternates' generation feature is bugged using default 
values.
-+-
 Reporter:  Arthur   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  contrib.sitemaps |  Version:  3.2
 Severity:  Release blocker  |   Resolution:
 Keywords:  alternates   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Carlton Gibson):

 * needs_docs:  1 => 0
 * needs_tests:  1 => 0
 * stage:  Accepted => Ready for checkin


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.25aae0e8d01ade764fc00f0ea466033a%40djangoproject.com.


Re: [Django] #32648: New sitemap 'alternates' generation feature is bugged using default values.

2021-04-13 Thread Django
#32648: New sitemap 'alternates' generation feature is bugged using default 
values.
--+
 Reporter:  Arthur|Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  contrib.sitemaps  |  Version:  3.2
 Severity:  Release blocker   |   Resolution:
 Keywords:  alternates| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  1
  Needs tests:  1 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Mariusz Felisiak):

 * cc: Carlton, Gibson (removed)
 * cc: Carlton Gibson, Florian Demmer (added)
 * needs_docs:  0 => 1
 * severity:  Normal => Release blocker
 * needs_tests:  0 => 1
 * stage:  Unreviewed => Accepted


Comment:

 Thanks for this report.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.c3aecefa76805fd36431544076309696%40djangoproject.com.


Re: [Django] #32648: New sitemap 'alternates' generation feature is bugged using default values.

2021-04-13 Thread Django
#32648: New sitemap 'alternates' generation feature is bugged using default 
values.
--+--
 Reporter:  paris-ci  |Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  contrib.sitemaps  |  Version:  3.2
 Severity:  Normal|   Resolution:
 Keywords:  alternates| Triage Stage:  Unreviewed
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+--
Changes (by paris-ci):

 * has_patch:  0 => 1


Comment:

 Here's the pull request that should fix the problem
 https://github.com/django/django/pull/14259.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.54be80caef941c3bcd417109e106afba%40djangoproject.com.


[Django] #32648: New sitemap 'alternates' generation feature is bugged using default values.

2021-04-13 Thread Django
#32648: New sitemap 'alternates' generation feature is bugged using default 
values.
+
   Reporter:  paris-ci  |  Owner:  nobody
   Type:  Bug   | Status:  new
  Component:  contrib.sitemaps  |Version:  3.2
   Severity:  Normal|   Keywords:  alternates
   Triage Stage:  Unreviewed|  Has patch:  0
Needs documentation:  0 |Needs tests:  0
Patch needs improvement:  0 |  Easy pickings:  0
  UI/UX:  0 |
+
 (First time reporting a bug in Django, please be kind)

 Hi,

 When closing ticket #27395 with the following commit
 
https://github.com/django/django/commit/16218c20606d8cd89c5393970c83da04598a3e04#
 a bug was added in Django.

 If alternates is set to False, or if i18n is disabled on the sitemap, this
 line
 
https://github.com/django/django/commit/16218c20606d8cd89c5393970c83da04598a3e04
 #diff-d0316d5baddb3fd017c4a17ac10d784a4668a05ae39bf8a0485ec80da1409c51R189
 will not get executed, meaning `url_info` will not have `alternates` set.

 Later, when rendering in the template, the inner loop
 
(https://github.com/django/django/commit/16218c20606d8cd89c5393970c83da04598a3e04
 #diff-a2c649c9d199c72cb1df4204ce54d92a480f4f077e7b423db91ee1ab421895d8R10)
 will try to access alternates anyway, causing the following stacktrace to
 be printed


 {{{#!python
 [DEBUG   ] (base._resolve_lookup) Exception while resolving variable
 'alternates' in template 'sitemap.xml'.

 Traceback (most recent call last):
   File "/usr/local/lib/python3.9/site-packages/django/template/base.py",
 line 829, in _resolve_lookup
 current = current[bit]
 KeyError: 'alternates'

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/usr/local/lib/python3.9/site-packages/django/template/base.py",
 line 837, in _resolve_lookup
 current = getattr(current, bit)
 AttributeError: 'dict' object has no attribute 'alternates'

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/usr/local/lib/python3.9/site-packages/django/template/base.py",
 line 843, in _resolve_lookup
 current = current[int(bit)]
 ValueError: invalid literal for int() with base 10: 'alternates'

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/usr/local/lib/python3.9/site-packages/django/template/base.py",
 line 848, in _resolve_lookup
 raise VariableDoesNotExist("Failed lookup for key "

 django.template.base.VariableDoesNotExist: Failed lookup for key
 [alternates] in {'item': , 'location': 'https://myurl',
 'lastmod': None, 'changefreq': 'always', 'priority': ''}
 }}}

 A simple fix is the meantime is to redefine the _urls() method in the
 Sitemap to include the alternates attribute to an empty list :

 {{{#!python
 class Sitemap(sitemaps.Sitemap):
 """
 Fixes the Exception while resolving variable 'alternates' in template
 'sitemap.xml'
 """
 def _urls(self, *args, **kwargs):
 urls = super()._urls(*args, **kwargs)

 for url_info in urls:
 url_info['alternates'] = []

 return urls
 }}}

 That said, the patch is probably a 1-liner, to check if url.alternates
 exist before using it.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.601c45294f1bef05cb30e984a8559faf%40djangoproject.com.