Re: [Django] #13910: Add generator version of Template.render(Context)

38 views
Skip to first unread message

Django

unread,
Jun 11, 2011, 10:53:03 PM6/11/11
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------------+---------------------------------
Reporter: rooney | Owner: nobody
Type: New feature | Status: reopened
Milestone: | Component: Template system
Version: 1.2 | Severity: Normal
Resolution: | Keywords:
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 1
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------+---------------------------------
Changes (by chase@…):

* ui_ux: => 0
* easy: => 0


Comment:

Being able to stream a template alone would be useful, even without being
able to stream a HTTP response. I'm thinking of using a template to
generate a large amount of data (XML?), and wanting to stream that to disk
versus read it all into memory first.

--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 3, 2012, 12:26:32 AM9/3/12
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: nobody
Type: New feature | Status: reopened
Component: Template system | Version: 1.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by mindsocket):

* cc: mindsocket (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:10>

Django

unread,
Mar 23, 2013, 7:48:15 PM3/23/13
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: nobody
Type: New feature | Status: new

Component: Template system | Version: 1.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by mindsocket):

I'm hoping to revisit this ticket, are there any updates or others working
on it already? If not, any changes since 1.5 that might influence how it
should be implemented?

--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:12>

Django

unread,
Apr 26, 2013, 12:27:10 PM4/26/13
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: nobody
Type: New feature | Status: new
Component: Template system | Version: 1.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by mindsocket):

I've put my work in progress in a branch:
https://github.com/mindsocket/django/tree/t13910

So far I've taken rooney's patch and updated it to work with current
development. The template_tests pass, but some others are failing, and new
tests are needed for the new streaming code.

--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:13>

Django

unread,
Apr 26, 2013, 1:58:59 PM4/26/13
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: nobody
Type: New feature | Status: new
Component: Template system | Version: 1.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by charettes):

1.5 introduced [https://docs.djangoproject.com/en/1.5/releases/1.5
/#explicit-support-for-streaming-responses StreamingHttpResponse].

There's already a
[https://github.com/django/django/blob/4d817b38875c900d70793acd528afc9e954bbcb7/django/template/response.py
TemplateResponse]. Maybe you can start your work by providing a
`StreamingTemplateResponse`?

--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:14>

Django

unread,
Apr 27, 2013, 11:58:42 PM4/27/13
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: nobody
Type: New feature | Status: new
Component: Template system | Version: 1.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by mindsocket):

Thanks charettes. I've updated my branch to improve on what I had
(including correct use of a StreamingHttpResponse and new unit tests), but
I will have a look at TemplateResponse now too.

--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:15>

Django

unread,
Apr 28, 2013, 11:13:50 AM4/28/13
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: nobody
Type: New feature | Status: new
Component: Template system | Version: 1.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by mindsocket):

I've now added a StreamingTemplateResponse and StreamingTemplateView that
build upon the earlier work to introduce generator based rendering of
templates.

I've tried to include new tests where possible, but feedback about where
they're lacking is most welcome.

https://github.com/mindsocket/django/tree/t13910

Some background to explain my interest in this ticket, I created a sample
app that makes use of the template streaming in this branch.
It's an experimental proof of concept that uses a middleware to start
sending back HTML before even calling the view.

Code: https://github.com/mindsocket/django-perf-
example/blob/master/perf_example/views.py
Results:
http://www.webpagetest.org/video/compare.php?tests=130428_WX_F4V-l:eager_streaming%2C130428_W6_F42-l:streaming%2C130428_3X_F4E-l:original&thumbSize=200&ival=500&end=doc

--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:16>

Django

unread,
Apr 30, 2013, 6:17:08 AM4/30/13
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: nobody
Type: New feature | Status: new
Component: Template system | Version: master

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 mindsocket):

* version: 1.2 => master
* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:17>

Django

unread,
Apr 30, 2013, 8:33:22 PM4/30/13
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: nobody
Type: New feature | Status: new
Component: Template system | Version: master
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 selwin):

* cc: selwin (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:18>

Django

unread,
May 2, 2013, 3:46:21 AM5/2/13
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: nobody
Type: New feature | Status: new
Component: Template system | Version: master
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 mindsocket):

Having given this patch more of a workout I've since fixed a test bug and
created a pull request...

https://github.com/django/django/pull/1037

My only concern about the commit is whether more documentation updates are
needed for aspects higher up the stack, like StreamingTemplateView. I'm
not entirely sure how I'd go about explaining the benefits, specific use
cases and most importantly downsides (like exception handling) of
streaming without lots of hand waving.

--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:19>

Django

unread,
May 2, 2013, 3:46:35 AM5/2/13
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+--------------------------------------
Reporter: rooney | Owner: mindsocket
Type: New feature | Status: assigned

Component: Template system | Version: master
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 mindsocket):

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


--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:20>

Django

unread,
Dec 13, 2013, 12:45:21 AM12/13/13
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+--------------------------------------
Reporter: rooney | Owner: mindsocket
Type: New feature | Status: assigned
Component: Template system | Version: master
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 anonymous):

I love this feature. What's the status?

--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:21>

Django

unread,
Dec 13, 2013, 4:41:25 AM12/13/13
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+--------------------------------------
Reporter: rooney | Owner: mindsocket
Type: New feature | Status: assigned
Component: Template system | Version: master
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 bmispelon):

Replying to [comment:21 anonymous]:


> I love this feature. What's the status?

For one thing, the provided pull request no longer applies cleanly on
master so it needs to be brought back up to date.

--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:22>

Django

unread,
Jun 5, 2014, 7:59:44 PM6/5/14
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+--------------------------------------
Reporter: rooney | Owner: mindsocket
Type: New feature | Status: assigned
Component: Template system | Version: master
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 timo):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:23>

Django

unread,
Jun 4, 2015, 5:16:31 PM6/4/15
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: Gagaro

Type: New feature | Status: assigned
Component: Template system | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Gagaro):

* owner: mindsocket => Gagaro
* needs_docs: 0 => 1
* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:24>

Django

unread,
Jun 4, 2015, 5:16:45 PM6/4/15
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: Gagaro
Type: New feature | Status: assigned
Component: Template system | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by Gagaro):

New pull request: https://github.com/django/django/pull/4783

--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:25>

Django

unread,
Jun 7, 2015, 12:18:32 PM6/7/15
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: Gagaro
Type: New feature | Status: assigned
Component: Template system | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Gagaro):

* cc: Gagaro (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:26>

Django

unread,
Jun 24, 2015, 4:51:25 PM6/24/15
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: Gagaro
Type: New feature | Status: assigned
Component: Template system | Version: master
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 Gagaro):

* needs_better_patch: 1 => 0


* needs_tests: 1 => 0

* needs_docs: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:27>

Django

unread,
Jul 14, 2015, 1:14:43 PM7/14/15
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: Gagaro
Type: New feature | Status: assigned
Component: Template system | Version: master
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 timgraham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:28>

Django

unread,
Jul 17, 2015, 4:22:11 PM7/17/15
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: Gagaro
Type: New feature | Status: assigned
Component: Template system | Version: master
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 Gagaro):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:29>

Django

unread,
Aug 24, 2015, 9:06:23 AM8/24/15
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: Gagaro
Type: New feature | Status: assigned
Component: Template system | Version: master
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 timgraham):

* needs_better_patch: 0 => 1


Comment:

Aymeric [https://groups.google.com/d/msg/django-
developers/kuGeu7ffJsc/QDkZxoAbDwAJ raised some questions/concerns] about
the proposed APIs on django-developers.

--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:30>

Django

unread,
Oct 7, 2015, 3:07:34 PM10/7/15
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: Gagaro
Type: New feature | Status: assigned
Component: Template system | Version: master
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 timgraham):

* needs_better_patch: 1 => 0


Comment:

Patch has been updated to address the API concerns.

--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:31>

Django

unread,
Oct 22, 2015, 2:58:22 PM10/22/15
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: Gagaro
Type: New feature | Status: assigned
Component: Template system | Version: master
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 timgraham):

* needs_better_patch: 0 => 1


Comment:

Marking as "Patch needs improvement" given
[https://github.com/django/django/pull/4783#issuecomment-149877143 the
latest comment about a regression in performance].

--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:32>

Django

unread,
Sep 17, 2016, 2:53:31 PM9/17/16
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: rooney | Owner: Gagaro
Type: New feature | Status: assigned
Component: Template system | Version: master
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 binary):

* cc: binary@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:33>

Django

unread,
Apr 18, 2019, 8:28:54 PM4/18/19
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: Ron Panduwana | Owner: Gagaro

Type: New feature | Status: assigned
Component: Template system | Version: master
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 Asif Saifuddin Auvi):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:34>

Django

unread,
Apr 21, 2019, 11:12:16 PM4/21/19
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+------------------------------------
Reporter: Ron Panduwana | Owner: Gagaro
Type: New feature | Status: assigned
Component: Template system | Version: master
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 Petr Glotov):

* cc: Petr Glotov (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:35>

Django

unread,
Jul 12, 2019, 6:34:00 AM7/12/19
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+---------------------------------------
Reporter: Ron Panduwana | Owner: Petr Glotov

Type: New feature | Status: assigned
Component: Template system | Version: master
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 Carlton Gibson):

* owner: Gagaro => Petr Glotov


Comment:

[https://github.com/django/django/pull/11157 New PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:36>

Django

unread,
Jul 18, 2019, 5:25:16 AM7/18/19
to django-...@googlegroups.com
#13910: Add generator version of Template.render(Context)
---------------------------------+---------------------------------------
Reporter: Ron Panduwana | Owner: Petr Glotov
Type: New feature | Status: assigned
Component: Template system | Version: master
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 Carlton Gibson):

* needs_better_patch: 0 => 1


Comment:

Patch includes changes to shortcuts, generic views and so-on, which are of
questionable value, and out-of-scope for this ticket. Needs stripping down
to just allowing a `render()` to return a generator, but should be good.
[https://github.com/django/django/pull/11157#pullrequestreview-262400485
Comments on PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/13910#comment:37>

Reply all
Reply to author
Forward
0 new messages