Ticket #1252 (new enhancement)

Opened 4 years ago

Last modified 2 years ago

Removing the context from user level API

Reported by: dialtone Assigned to: dialtone
Priority: highest Milestone:
Component: Nevow Severity: normal
Keywords: Cc: mithrandi,oubiwann
Estimated Completion (YYYY/MM/DD): Branch: branches/no-more-context-1252-8
Author: exarkun, glyph

Description

In order to ease the migration path to twisted.web2 and to ease nevow code (and remove some bugs and efficiency problems and add some clarity) it's now a necessity to remove the context from user level APIs keeping it behind the scenes so that at some point it can be removed completely.

Enhance the page.py module from Bug #1208 completing it with a Page class that will take the role of the current rend.Page.

Change History

07/04/06 16:07:08 changed by exarkun

  • keywords set to review.
  • priority changed from normal to highest.

A branch addressing much of this awaits review in no-more-context-1252

07/08/06 18:14:38 changed by exarkun

  • keywords deleted.

typo in data's docstring. twiddle returns tag["gathered"]} but it means to be returning tag[gathered].

On Page, renderString and renderSynchronously might bear some rethinking. Nevow won't work without Twisted, so at the very least ther docstring for renderString should be updated. I'm not sure renderSynchronously needs to still exist at all as a separate method.

I'm still not sure about data being inherited by methods beneath the tag which declares the directive. I think this should be satisfied by keeping state on an IRenderer provider somewhere. I'd like to try to port the sequence and mapping renderers to demonstrate this, but I don't have time this weekend and I'm going to be away next week.

Test coverage looks pretty good and docstrings are nice and informative, so other than what I mentioned above I think the branch looks very good.

07/11/06 09:32:38 changed by dialtone

Applied most of the suggestions except the one about inheriting data waiting for the demontrations.

08/03/06 08:47:23 changed by exarkun

Maybe it would be best to pull the data parts of this branch out into a separate ticket, so we can at least merge the rest of it and start using that?

08/03/06 10:03:08 changed by dialtone

  • keywords set to review.

08/15/06 14:04:28 changed by exarkun

  • Great improvements to docstrings
  • Great tests for fromRequest and fromHere and Page

test_lookup could probably be deconvoluted a little bit. It doesn't really need to do the lookup twice. It should define a function to use as the callback of the first call so that it doesn't need to jump through those hoops.

The changes to the internals of rend.py are kind of nasty, but perhaps necessary. I'm going to think about them for a little bit and then I'll comment more.

08/16/06 16:49:54 changed by dialtone

Applied suggestions for test_lookup.

About the changes to appserver.py (I think you meant this): I think those are required to completely avoid introducing the context in that API in any way. An alternative solution would be to rewrite appserver for the new Page object but since that new object is going to be directly in web2 it's wasted effort IMHO.

10/09/06 11:13:48 changed by mithrandi

  • cc set to mithrandi.

02/26/07 18:22:50 changed by oubiwann

02/26/07 18:26:58 changed by oubiwann

From dialtone on #1330:

[4:26pm] dialtone: test_url and url.py already contain fixes for 1330

02/27/07 13:25:27 changed by oubiwann

therve, drewp, and I worked on this yesterday. therve committed several changes (including new unit tests that check for a bug we discovered), and after running through the rest of the examples, we should be ready for a review.

03/02/07 09:36:21 changed by exarkun

  • keywords deleted.

Dropping review keyword for now, since this isn't actually up for review at the moment.

03/25/07 22:38:37 changed by oubiwann

  • cc changed from mithrandi to mithrandi,oubiwann.

03/27/08 12:19:17 changed by exarkun

  • branch set to branches/no-more-context-1252-6.
  • author set to exarkun.

(In [15278]) Branching to 'no-more-context-1252-6'

03/28/08 14:35:56 changed by exarkun

  • branch changed from branches/no-more-context-1252-6 to branches/no-more-context-1252-7.

(In [15330]) Branching to 'no-more-context-1252-7'

02/13/09 07:30:02 changed by glyph

  • branch changed from branches/no-more-context-1252-7 to branches/no-more-context-1252-8.
  • branch_author changed from exarkun to exarkun, glyph.

(In [17184]) Branching to 'no-more-context-1252-8'

02/13/09 08:10:31 changed by glyph

  • completion_estimate_date changed.

For whoever picks this branch up next: I recommend that the new Page compose, rather than inherit, its Element. It might be convenient to have an ElementPage as well, but there should be a nice clear dividing line between the 'page' parts and the 'element' parts.

jethro@divmod.org