Hi Mike and Jonathan,

 

Thanks for your prompt response.

 

Is there any corresponding API in Pyramid for the following?:

 

pylons.controllers.util.forward(wsgi_app)

Forward the request to a WSGI application. Returns its response.

return forward(FileApp('filename'))

 

Thanks,

Pinakee

 

P Please don't print this e-mail unless you really need to, this will
preserve trees on planet earth. 

----------------------------Disclaimer--------------------------------------
----------------------------------------------------------------------------
----------------------------------------------------------------------------
---------

The information contained in this message (including any attachments) is
confidential and may be privileged. If you have received it by mistake
please notify the sender by return e-mail and permanently delete this
message and any attachments from your system. Please note that e-mails are
susceptible to change and malwares. VVIDIA COMMUNICATIONS PVT LTD.
(including its group companies) shall not be liable for the improper or
incomplete transmission of the information contained in this communication
nor for any delay in its receipt or damage to your system. 

----------------------------------------------------------------------------
---------------------------------------------Disclaimer---------------------
----------------------------------------------------------------------------
---------

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Mike Orr
Sent: 22 June 2012 00:22
To: [email protected]
Subject: Re: Queries on Pyramid API

 

 

On Thu, Jun 21, 2012 at 10:55 AM, Jonathan Vanasco <[email protected]>
wrote:



> 1.       In Pylons, there is a config API which could be used to read the
> fields in the .ini (development.ini or deployment.ini) file. Is there
> something similar in Pyramid?

all of that information is stored in the request object under:
request.registry.settings


Yes, request.registry.settings is equivalent to pylons.config. (At least in
the basic sense that settings parsed from "[app:main]" will be in this
dict.)
 



> 2.       In Pylons, there is util containing forward, abort etc. Is there
> something similar in Pyramid?

from pyramid.httpexceptions import *
from pyramid.httpexceptions import HTTPFound , HTTPNotFound

http://docs.pylonsproject.org/projects/pyramid/en/1.0-branch/api/httpexcepti
ons.html

you can read more about them here:

http://pyramid.readthedocs.org/en/latest/narr/views.html#http-exceptions

you can raise or return those objects from a view.


There's also a function that behaves closer to abort.

return pyramid.httpexceptions.exception_response(404)
 

they behave slightly differently when you `raise` than `return`.
IIRC, if you `return` you still have the request object in
subscribers, but if you `raise`, then pyramid's exeception handling
system takes control and you no longer have the request.


I thought Pyramid handled returning and raising HTTP exceptions identically.
Raising them does cut through intermediate stack frames (function calls) to
whichever level catches the exception, as with all exceptions. So that may
bypass subscribers. On the other hand, somebody who's asking these questions
is probably not using custom subscribers anyway.


-- 
Mike Orr <[email protected]>

-- 
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to