Re: [Web-SIG] Sessions and Headers
Timothy Soehnlin wrote .. > Hello All, > > In a previous post I wrote about Sessions and Headers. The Sessions > topic > was addressed but the Headers point was never focused on. I was wondering > about controlling headers in mod_python. In mod_python the headers are > automagically submitted when the function write is invoked the first time. > I > need this to not be. I need to have total control over the headers, and > control when and if they are sent to the client. I was wondering if there > are any settings, examples, etc that any of you all would know about. Don't incrementally use req.write(), instead accumulate any response as a list of strings or using StringIO instance. Then at the point that you finally want to send content, ie., after you have set your headers, then call req.write() once with the accumulated content. Note that there is a separate mod_python mailing list, you would be better off using that if you want to get a response. The mailing list you are posting to is not specifically about mod_python and so you are less likely to get a response. See the mod_python web site for how to get onto the mod_python mailing list. Graham ___ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com
Re: [Web-SIG] Sessions and Headers
Timothy Soehnlin wrote: > In mod_python the headers are automagically submitted when > the function write is invoked the first time. I need this > to not be. You can do that either informally, by not calling req.write in your own code until you've built the complete response entity, or strictly, by wrapping the request object so that the write method (and flush) spools output until you're done. I *think* you are implying more constraints than that, but until you expand on them, they're hard to address. ;) Robert Brewer System Architect Amor Ministries [EMAIL PROTECTED] ___ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com
[Web-SIG] Sessions and Headers
Hello All, In a previous post I wrote about Sessions and Headers. The Sessions topic was addressed but the Headers point was never focused on. I was wondering about controlling headers in mod_python. In mod_python the headers are automagically submitted when the function write is invoked the first time. I need this to not be. I need to have total control over the headers, and control when and if they are sent to the client. I was wondering if there are any settings, examples, etc that any of you all would know about. Thank you for your time and consideration. Sincerely, Timothy Soehnlin -- I would rather be known as a Christian and despised, than to be overlooked, and thought of as one of the world. ___ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com
Re: [Web-SIG] Sessions and Headers
Ben Bangert wrote: > Ian Bicking wrote a WSGI session middleware module that handles > sessions completely independently of any framework, though I'm not > sure offhand how that'd work with mod_python. It's nothing to write home about. Flup has a somewhat better session, and an object that is clearly usable outside WSGI; but it only has a couple actual stores (e.g., no database), and some room for improvements, so it isn't terribly notable either. There was some talk about this on this list a while ago, but it never really went anywhere. I proposed an interface, but since I lacked actual intention to implement it didn't go anywhere either. But it still exists, of course: http://svn.colorstudy.com/home/ianb/scarecrow_session_interface.py -- it might be useful to an implementor. In an actually-extracted form, I don't know about any session library for Python. In an extrable form, I'm sure many frameworks have something. An extracted session library would be welcome. I'm personally getting by with a session that is much lamer than the one my proposed interface would imply, which is probably fine since I only put non-critical data in it anyway. So a simpler session library would be cool too. I think it should leave out things like configuration, but there's still useful functionality to be done. -- Ian Bicking / [EMAIL PROTECTED] / http://blog.ianbicking.org ___ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com
Re: [Web-SIG] Sessions and Headers
Timothy Soehnlin wrote: > On another note, I am also wanting to integerate > multiple server environments, and specifically > with this question, mod_python. Now I have my > framework working with mod_python but I have > recently created a standard request object that > all the different server environments plug into > by initializing the object with an environment > dictionary, a file to read the user data from > (for posts and whatnot), and then a write > function that gives direct control to returning > the request output to the user. Congratulations, you just reinvented WSGI. ;) Robert Brewer System Architect Amor Ministries [EMAIL PROTECTED] ___ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com
Re: [Web-SIG] Sessions and Headers
On Dec 1, 2005, at 9:08 AM, Timothy Soehnlin wrote: > Okay, lets get down to business. I am wondering if anyone knows of a > framework independent Session library. I am looking to bring a > Session > library into my framework, but everything I have found so far seems > to be > unnecessarily integrated with the frameworks. And before I get all > gung ho > and go and right my own Session libraries, I was wondering if > anyone knows of > a library that I could use, and save myself some time. Many frameworks session system's can be used completely independently of the framework. Myghty's has been used in various scenarios partly as it works without a problem in mod_python, WSGI, etc. and has a consistent interface across any of the environments. Ian Bicking wrote a WSGI session middleware module that handles sessions completely independently of any framework, though I'm not sure offhand how that'd work with mod_python. I won't be surprised to see other framework authors offer advice on how to use their respective session object outside of their framework, as they're typically modular enough to function in this manner. Most of them provide a dict-style interface, some use attributes, etc. In the end, I think you'll have enough choices where you can sift it out and find the one that works best for you. Cheers, Ben ___ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com
[Web-SIG] Sessions and Headers
Hello All, Okay, lets get down to business. I am wondering if anyone knows of a framework independent Session library. I am looking to bring a Session library into my framework, but everything I have found so far seems to be unnecessarily integrated with the frameworks. And before I get all gung ho and go and right my own Session libraries, I was wondering if anyone knows of a library that I could use, and save myself some time. On another note, I am also wanting to integerate multiple server environments, and specifically with this question, mod_python. Now I have my framework working with mod_python but I have recently created a standard request object that all the different server environments plug into by initializing the object with an environment dictionary, a file to read the user data from(for posts and whatnot), and then a write function that gives direct control to returning the request output to the user. In mod_python the headers are automagically submitted when the function write is invoked the first time. I need this to not be. I need to have total control over the headers, as my standard Request Object handles header manipulation and submission. Thank you for your time and consideration. Sincerely, Timothy Soehnlin -- I would rather be known as a Christian and despised, than to be overlooked, and thought of as one of the world. ___ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com