Re: [Django] #28721: Cannot use the variable name "inf" in templates

2017-10-21 Thread Django
#28721: Cannot use the variable name "inf" in templates
-+--
 Reporter:  Fraser Nevett|Owner:  Levi Payne
 Type:  Bug  |   Status:  closed
Component:  Template system  |  Version:  1.11
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+--
Changes (by Tim Graham):

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


-- 
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.514a5ab5863a7673ce1e7d2ce4c8411e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #28721: Cannot use the variable name "inf" in templates

2017-10-21 Thread Django
#28721: Cannot use the variable name "inf" in templates
-+--
 Reporter:  Fraser Nevett|Owner:  Levi Payne
 Type:  Bug  |   Status:  assigned
Component:  Template system  |  Version:  1.11
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+--

Comment (by Tim Graham ):

 In [changeset:"6c3104221b2cb9f068c07adf3ef24c9f49627834" 6c31042]:
 {{{
 #!CommitTicketReference repository=""
 revision="6c3104221b2cb9f068c07adf3ef24c9f49627834"
 Refs #28721 -- Added test for variations of 'inf'/'infinity' as a template
 variable names.

 Fixed by 9ec7d8e514e09636b0ab4bcac74b5f7a5be335a3.
 }}}

-- 
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.3489fa60bda3c1bf158d9a9d512d7bb6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #28721: Cannot use the variable name "inf" in templates

2017-10-20 Thread Django
#28721: Cannot use the variable name "inf" in templates
-+--
 Reporter:  Fraser Nevett|Owner:  Levi Payne
 Type:  Bug  |   Status:  assigned
Component:  Template system  |  Version:  1.11
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+--

Comment (by Fraser Nevett):

 See also #28730

-- 
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.2dba1c800af50613f94e6195544d8b3c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #28721: Cannot use the variable name "inf" in templates

2017-10-20 Thread Django
#28721: Cannot use the variable name "inf" in templates
-+--
 Reporter:  Fraser Nevett|Owner:  Levi Payne
 Type:  Bug  |   Status:  assigned
Component:  Template system  |  Version:  1.11
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+--
Changes (by Tim Graham):

 * needs_better_patch:  0 => 1


-- 
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.684e6c2dfaa4aa6ea9fc7d10a37576a7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #28721: Cannot use the variable name "inf" in templates

2017-10-18 Thread Django
#28721: Cannot use the variable name "inf" in templates
-+--
 Reporter:  Fraser Nevett|Owner:  Levi Payne
 Type:  Bug  |   Status:  assigned
Component:  Template system  |  Version:  1.11
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--

Comment (by Levi Payne):

 Pull Request is ready for review.

-- 
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.e979fb21a93e75bb293aa6eee5710922%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #28721: Cannot use the variable name "inf" in templates

2017-10-18 Thread Django
#28721: Cannot use the variable name "inf" in templates
-+--
 Reporter:  Fraser Nevett|Owner:  Levi Payne
 Type:  Bug  |   Status:  assigned
Component:  Template system  |  Version:  1.11
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--
Changes (by Levi Payne):

 * has_patch:  0 => 1


-- 
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.e96e1a097305fe83247fa1ab12314f9e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #28721: Cannot use the variable name "inf" in templates

2017-10-18 Thread Django
#28721: Cannot use the variable name "inf" in templates
-+--
 Reporter:  Fraser Nevett|Owner:  Levi Payne
 Type:  Bug  |   Status:  assigned
Component:  Template system  |  Version:  1.11
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--

Comment (by Levi Payne):

 [https://github.com/django/django/pull/9258 WIP Pull Request]

-- 
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.b64e97318a928a0c322337e96dbf3741%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #28721: Cannot use the variable name "inf" in templates

2017-10-18 Thread Django
#28721: Cannot use the variable name "inf" in templates
-+--
 Reporter:  Fraser Nevett|Owner:  Levi Payne
 Type:  Bug  |   Status:  assigned
Component:  Template system  |  Version:  1.11
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+--
Changes (by Levi Payne):

 * owner:  nobody => Levi Payne
 * status:  new => assigned


-- 
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.ec3b6cc3129748edfb00f08ab5912979%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #28721: Cannot use the variable name "inf" in templates

2017-10-18 Thread Django
#28721: Cannot use the variable name "inf" in templates
-+
 Reporter:  Fraser Nevett|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Template system  |  Version:  1.11
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+
Changes (by Tim Graham):

 * stage:  Unreviewed => Accepted


-- 
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.bade184c33c4716c980e0320aeeab506%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #28721: Cannot use the variable name "inf" in templates

2017-10-18 Thread Django
#28721: Cannot use the variable name "inf" in templates
---+
   Reporter:  Fraser Nevett|  Owner:  nobody
   Type:  Bug  | Status:  new
  Component:  Template system  |Version:  1.11
   Severity:  Normal   |   Keywords:
   Triage Stage:  Unreviewed   |  Has patch:  0
Needs documentation:  0|Needs tests:  0
Patch needs improvement:  0|  Easy pickings:  0
  UI/UX:  0|
---+
 Trying to render a template variable named **inf** does not work:

 {{{#!python
 >>> from django.template import Template, Context
 >>> Template('{{ inf }}').render(Context({'inf': 'xxx'}))
 Traceback (most recent call last):
   File "", line 1, in 
   File "/tmp/venv/lib/python2.7/site-packages/django/template/base.py",
 line 191, in __init__
 self.nodelist = self.compile_nodelist()
   File "/tmp/venv/lib/python2.7/site-packages/django/template/base.py",
 line 233, in compile_nodelist
 e.template_debug = self.get_exception_info(e, e.token)
 AttributeError: 'exceptions.OverflowError' object has no attribute 'token'
 }}}

 It also fails if the variable is undefined in the context:
 {{{#!python
 >>> Template('{{ inf }}').render(Context())
 Traceback (most recent call last):
   File "", line 1, in 
   File "/tmp/venv/lib/python2.7/site-packages/django/template/base.py",
 line 191, in __init__
 self.nodelist = self.compile_nodelist()
   File "/tmp/venv/lib/python2.7/site-packages/django/template/base.py",
 line 233, in compile_nodelist
 e.template_debug = self.get_exception_info(e, e.token)
 AttributeError: 'exceptions.OverflowError' object has no attribute 'token'
 }}}

 This is happening because `'inf'` is used in Python to represent infinity:

 {{{#!python
 >>> float('inf')
 inf
 }}}


 The problem appears to be with
 [https://github.com/django/django/blob/1.11.6/django/template/base.py#L809-L819
 this bit of the code]:
 {{{#!python
 # First try to treat this variable as a number.
 #
 # Note that this could cause an OverflowError here that we're
 not
 # catching. Since this should only happen at compile time,
 that's
 # probably OK.
 self.literal = float(var)

 # So it's a float... is it an int? If the original value
 contained a
 # dot or an "e" then it was a float, not an int.
 if '.' not in var and 'e' not in var.lower():
 self.literal = int(self.literal)
 }}}

 It successfully converts the string `'inf'` to a float with value of
 infinity, but then trying to convert this float to an int causes the
 OverflowError:

 {{{#!python
 >>> int(float('inf'))
 Traceback (most recent call last):
   File "", line 1, in 
 OverflowError: cannot convert float infinity to integer
 }}}

 Python also supports floats of `'-inf'` and `'nan'`. Using `'-inf'` as a
 template variable name doesn't work because it isn't a valid variable
 name. Using `'nan'` as a template variable name works OK:

 {{{#!python
 >>> Template('{{ nan }}').render(Context({'nan': 'xxx'}))
 u'xxx'
 }}}

 I think the fix is to allow variables named **inf**, rather than to
 support using **inf** as a float literal within templates.

-- 
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.2e14334d8ff7aa678a3ed964646ed5dc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.