Re: [Django] #27258: Raise an exception if RequestContext is used with template.backends.django.Template.render()

2017-08-14 Thread Django
#27258: Raise an exception if RequestContext is used with
template.backends.django.Template.render()
-+-
 Reporter:  Andi Albrecht|Owner:  reficul31
 Type:   |   Status:  closed
  Cleanup/optimization   |
Component:  Template system  |  Version:  1.10
 Severity:  Normal   |   Resolution:  fixed
 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 Tim Graham):

 Comments 12 and 13 stem from #28491. I replied with a solution there.

-- 
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/070.4a7c35d5b13c2500eac58a72c53f33a7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27258: Raise an exception if RequestContext is used with template.backends.django.Template.render()

2017-08-13 Thread Django
#27258: Raise an exception if RequestContext is used with
template.backends.django.Template.render()
-+-
 Reporter:  Andi Albrecht|Owner:  reficul31
 Type:   |   Status:  closed
  Cleanup/optimization   |
Component:  Template system  |  Version:  1.10
 Severity:  Normal   |   Resolution:  fixed
 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 Mark Jones):

 And just to add insult to injury I decided I would quit griping and update
 the code to build out it's own Engine instance like so:
 {{{
 from django.template.backends.django import Engine
 from django.template import Context

 engine = Engine(dirs=settings.TEMPLATES[0]['DIRS'],
 app_dirs=True, debug=settings.DEBUG,
 autoescape=False,
 libraries={'deployment_tags':
 'deployment.templatetags.deployment_tags'})
 }}}
 Then I still had to go back and use the Context object anyway
 {{{
 context = Context({"settings": settings,
"sys": sys, "os": os,
"options": options,
"username": getpass.getuser(),
"wsgi_path": wsgi_path,
"ssl": using_ssl,
}, autoescape=False)
 }}}
 Instead of just passing a dict.

 There is  a serious impedance mismatch in the interface around templates
 now.

-- 
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/070.c6a9b68c99575cd90295b96850230d57%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27258: Raise an exception if RequestContext is used with template.backends.django.Template.render()

2017-08-13 Thread Django
#27258: Raise an exception if RequestContext is used with
template.backends.django.Template.render()
-+-
 Reporter:  Andi Albrecht|Owner:  reficul31
 Type:   |   Status:  closed
  Cleanup/optimization   |
Component:  Template system  |  Version:  1.10
 Severity:  Normal   |   Resolution:  fixed
 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 Mark Jones):

 This was never about a RequestContext (although I can see that being a
 problem).  It had to do with a Context being passed to make_context and
 that causing a type error.  The whole point of me passing a Context was to
 specify turn off auto_escape
 {{{
 context = Context({"settings": settings,
"sys": sys, "os": os,
"options": options,
"username": getpass.getuser(),
"wsgi_path": wsgi_path,
"ssl": using_ssl,
},
   autoescape=False)
 }}}

 I'm rendering a text file on the server in a management command where I'm
 selecting the template based on:

 {{{
 servertemplate = loader.select_template(["deployment/%s" %
 options['webserver'],
 "deployment/default_%s" % options['webserver']])

 }}}
 Because Jinja is incapable of using a context, we've broken the ability to
 pass a context.  The fix I proposed was to let that context on thru,
 instead the context is banned and the only way to get autoescape in now is
 to build out a whole template Engine (where the autoescape flag can be
 passed).

 I've never understood people's fascination with jinja templates but
 nothing made me use them.  But now they are actively thwarting me, I begin
 to dislike them.

-- 
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/070.f8a9a76afd98e75db8cb90c11e3387c4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27258: Raise an exception if RequestContext is used with template.backends.django.Template.render()

2016-12-28 Thread Django
#27258: Raise an exception if RequestContext is used with
template.backends.django.Template.render()
-+-
 Reporter:  Andi Albrecht|Owner:  reficul31
 Type:   |   Status:  closed
  Cleanup/optimization   |
Component:  Template system  |  Version:  1.10
 Severity:  Normal   |   Resolution:  fixed
 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 Tim Graham ):

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


Comment:

 In [changeset:"6a7495051304d75865add6ff96422018984e1663" 6a74950]:
 {{{
 #!CommitTicketReference repository=""
 revision="6a7495051304d75865add6ff96422018984e1663"
 Fixed #27258 -- Prohibited django.Template.render() with non-dict context.

 Thanks Shivang Bharadwaj for the initial patch.
 }}}

--
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/070.1a068a83dc62241b0fc6996c0f9d62ba%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27258: Raise an exception if RequestContext is used with template.backends.django.Template.render()

2016-12-21 Thread Django
#27258: Raise an exception if RequestContext is used with
template.backends.django.Template.render()
-+-
 Reporter:  Andi Albrecht|Owner:  reficul31
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Template system  |  Version:  1.10
 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 Tim Graham):

 * needs_better_patch:  1 => 0


Comment:

 I fixed up the [https://github.com/django/django/pull/7675 PR] according
 to what I had in mind. The idea is that Jinja's `render()` doesn't work
 with a non-dict, so to encourage code that works with multiple template
 engines, Django shouldn't accept a non-dict there either.

 I think making this change as a bug fix rather than having a deprecation
 path is advantageous to avoid developers writing incorrect code for
 another 2 releases of Django. Also, it's possible to fix existing code
 (change `Context` to  `dict` as done in the csrf view) without breaking
 compatibility with older versions of Django so a deprecation doesn't
 provide any benefit in that respect.

--
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/070.55b26eb92161d4017e78497f12984fc9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27258: Raise an exception if RequestContext is used with template.backends.django.Template.render()

2016-12-12 Thread Django
#27258: Raise an exception if RequestContext is used with
template.backends.django.Template.render()
-+-
 Reporter:  Andi Albrecht|Owner:  reficul31
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Template system  |  Version:  1.10
 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
 * has_patch:  0 => 1


Comment:

 [https://github.com/django/django/pull/7675 PR] with some comments for
 improvement.

--
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/070.9d0b7daa08478f067d05490f6ef93f9b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27258: Raise an exception if RequestContext is used with template.backends.django.Template.render()

2016-12-09 Thread Django
#27258: Raise an exception if RequestContext is used with
template.backends.django.Template.render()
-+-
 Reporter:  Andi Albrecht|Owner:  reficul31
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Template system  |  Version:  1.10
 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 reficul31):

 * status:  new => assigned
 * owner:  nobody => reficul31


--
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/070.d2956e941b4a46ff15befa026c71e666%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27258: Raise an exception if RequestContext is used with template.backends.django.Template.render() (was: Context processors are not called when using RequestContext and Django templates

2016-10-03 Thread Django
#27258: Raise an exception if RequestContext is used with
template.backends.django.Template.render()
--+
 Reporter:  Andi Albrecht |Owner:  nobody
 Type:  Cleanup/optimization  |   Status:  new
Component:  Template system   |  Version:  1.10
 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):

 * type:  Bug => Cleanup/optimization
 * stage:  Unreviewed => Accepted


Comment:

 Raising an exception in `make_context()` seems like it could work since
 `template.backends.django.Template.render()` is calling that method and
 that's the only place that calls `make_context()`.

--
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/070.e901db357838f6fcc759d4a76985036f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.