Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
#938: Replace PageHandler with request.args/kwargs
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
CherryPy  
View profile  
 More options Jun 27, 6:26 pm
From: CherryPy <t...@cherrypy.org>
Date: Sat, 27 Jun 2009 22:26:27 -0000
Local: Sat, Jun 27 2009 6:26 pm
Subject: Re: [CherryPy] #938: Replace PageHandler with request.args/kwargs

#938: Replace PageHandler with request.args/kwargs
---------------------------+----------------------------------------------- -
 Reporter:  fumanchu       |        Owner:  fumanchu
     Type:  enhancement    |       Status:  new    
 Priority:  normal         |    Milestone:  3.2    
Component:  CherryPy code  |   Resolution:          
 Keywords:                 |  
---------------------------+----------------------------------------------- -
Comment (by fumanchu):

 By the way, this can be accomplished in trunk in a dozen lines of code or
 so. Moving the `test_callable_spec` function into a tool is then simple.
 So there's no technical reason not to do this. The only question in my
 mind is whether to introduce a somewhat incompatible change in !CherryPy
 3.2 or save it for version 4.

--
Ticket URL: <http://www.cherrypy.org/ticket/938>
CherryPy <http://www.cherrypy.org>
CherryPy - a pythonic, object-oriented HTTP framework


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
CherryPy  
View profile  
 More options Jun 27, 6:24 pm
From: CherryPy <t...@cherrypy.org>
Date: Sat, 27 Jun 2009 22:24:15 -0000
Local: Sat, Jun 27 2009 6:24 pm
Subject: [CherryPy] #938: Replace PageHandler with request.args/kwargs

#938: Replace PageHandler with request.args/kwargs
---------------------------+----------------------------------------------- -
 Reporter:  fumanchu       |       Owner:  fumanchu
     Type:  enhancement    |      Status:  new    
 Priority:  normal         |   Milestone:  3.2    
Component:  CherryPy code  |    Keywords:          
---------------------------+----------------------------------------------- -
 In `_cpdispatch.py`, the `PageHandler` class only really exists as a place
 to put values which will be passed to the handler as `(*args, **kwargs)`.
 The `LateParamPageHandler` just delays this lookup so that
 `request.params` can be mutated before the handler call. That system was
 designed to allow various dispatch schemes to vary more widely in their
 implementation; for example, some dispatch schemes might choose to pass no
 arguments to their controllers, some might choose to obtain those args
 from other sources, etc.

 Unfortunately, that system is too well-encapsulated, which introduces
 several problems:

  1. No static analysis of the graph of handler wrappers. If a "bare
 handler" is wrapped, that information is hidden within each wrapper.
 Multiple wrappers compounds the problem.
  2. No exposure of args/kwargs. Logic like the test_callable_spec feature
 must be built into each `PageHandler` scheme.
  3. Returning handler output which needs to be interpolated into a
 template must be implemented with decorators or a similar function-
 wrapping technique.

 Analysis of execution in server systems is more difficult than others
 since servers are designed to not crash in the face of exceptions, and in
 general have no command-line interface. In general, we should discourage
 the wrapping of handler functions, instead preferring to place such logic
 in hooks. I don't have a good solution at the moment for solving the
 output problem, but we ''can'' tackle the input problem by dropping the
 `PageHandler` system in favor of two new attributes: `request.args` and
 `request.kwargs`. These would be passed to `request.handler` when it is
 called. Placing them in a well-known location solves problem (2), above,
 and helps reduce the number of wrappers in general, thereby mitigating
 (1).

 If we did that, then `test_callable_spec` could be moved to a Tool which
 wraps request.handler, since both the args/kwargs would then be passed to
 the wrapper, and the handler would be directly inspectable, not hidden
 inside that which it wraps.

 The downside: I can't think of a way to do this with a deprecation period.
 Anyone's custom `PageHandler` classes would have to be changed to use the
 new way. We could change `request.handler` to be a property which detected
 when it was set to an instance of `PageHandler` and replace it with the
 new way, so that might work for people who have custom Dispatchers but use
 the existing `PageHandler` classes.

--
Ticket URL: <http://www.cherrypy.org/ticket/938>
CherryPy <http://www.cherrypy.org>
CherryPy - a pythonic, object-oriented HTTP framework


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
CherryPy  
View profile  
 More options Aug 5, 12:13 am
From: CherryPy <t...@cherrypy.org>
Date: Wed, 05 Aug 2009 04:13:14 -0000
Local: Wed, Aug 5 2009 12:13 am
Subject: Re: [CherryPy] #938: Replace PageHandler with request.args/kwargs

#938: Replace PageHandler with request.args/kwargs
---------------------------+----------------------------------------------- -
 Reporter:  fumanchu       |        Owner:  fumanchu
     Type:  enhancement    |       Status:  new    
 Priority:  normal         |    Milestone:  3.3    
Component:  CherryPy code  |   Resolution:          
 Keywords:                 |  
---------------------------+----------------------------------------------- -
Changes (by fumanchu):

  * milestone:  3.2 => 3.3

--
Ticket URL: <http://www.cherrypy.org/ticket/938>
CherryPy <http://www.cherrypy.org>
CherryPy - a pythonic, object-oriented HTTP framework


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google