I'm sorry if this is off-topic, i couldn't find a mailing list OR forum for
WSGI (and #wsgi wasn't very helpful).
i played around with StringIO, and apparently if you write to a stringio the
position gets set to the end of the write, so if you read from it again,
without using seek, you won't read what comes next, you'll skip to the end
of the write. and if you write without seeking to the end first, you'll
overwrite part of the string if the reading hasn't caught up.
WSGI says that wsgi.input should block if there's more data to be read from
the socket, until that data is available. so when the server writes to the
file object, what happens to the file position? if i were writing a WSGI
app, i would just seek() to the last place my read ended at just to make
sure. but i'm making a server, so i need to know whether i should leave the
position at the end of the write, when it blocks (or for that matter, if i'm
writing while it's still reading), or at the end of the previous read?
thanks for any help. 4 2652
inhahe schrieb:
I'm sorry if this is off-topic, i couldn't find a mailing list OR forum for
WSGI (and #wsgi wasn't very helpful).
i played around with StringIO, and apparently if you write to a stringio the
position gets set to the end of the write, so if you read from it again,
without using seek, you won't read what comes next, you'll skip to the end
of the write. and if you write without seeking to the end first, you'll
overwrite part of the string if the reading hasn't caught up.
WSGI says that wsgi.input should block if there's more data to be read from
the socket, until that data is available. so when the server writes to the
file object, what happens to the file position? if i were writing a WSGI
app, i would just seek() to the last place my read ended at just to make
sure. but i'm making a server, so i need to know whether i should leave the
position at the end of the write, when it blocks (or for that matter, if i'm
writing while it's still reading), or at the end of the previous read?
I'm not sure exactly about what you are talking here - but generally,
wsgi.input should be considerd being a pipe. One (the server) simply
writes into it. The WSGI-app just reads. No seek.
Diez
at the end of the previous read?
At the end of the previous read.
Web-SIG is the mailing list for WSGI and related stuff.
- Brian
That's what I would have thought, just seems strange since it seems to imply
that if I use StringIO or cStringIO, then whenever i write to it i have to
save the position, seek to the end, write, and then seek to the position i
saved. Are there any other classes that are more suitable for pipes, but
qualify as 'file-like objects'?
"Diez B. Roggisch" <de***@nospam.web.dewrote in message
news:6a*************@mid.uni-berlin.de...
inhahe schrieb:
>I'm sorry if this is off-topic, i couldn't find a mailing list OR forum for WSGI (and #wsgi wasn't very helpful).
i played around with StringIO, and apparently if you write to a stringio the position gets set to the end of the write, so if you read from it again, without using seek, you won't read what comes next, you'll skip to the end of the write. and if you write without seeking to the end first, you'll overwrite part of the string if the reading hasn't caught up.
WSGI says that wsgi.input should block if there's more data to be read from the socket, until that data is available. so when the server writes to the file object, what happens to the file position? if i were writing a WSGI app, i would just seek() to the last place my read ended at just to make sure. but i'm making a server, so i need to know whether i should leave the position at the end of the write, when it blocks (or for that matter, if i'm writing while it's still reading), or at the end of the previous read?
I'm not sure exactly about what you are talking here - but generally,
wsgi.input should be considerd being a pipe. One (the server) simply
writes into it. The WSGI-app just reads. No seek.
Diez
inhahe schrieb:
That's what I would have thought, just seems strange since it seems to imply
that if I use StringIO or cStringIO, then whenever i write to it i have to
save the position, seek to the end, write, and then seek to the position i
saved. Are there any other classes that are more suitable for pipes, but
qualify as 'file-like objects'?
Who uses StringIO for what? if you have two processes (server and
application), you can of course use a pipe of some sort. If you write a
WSGI-server that is supposed to pass the wsgi.input to an application,
just use StringIO with the completely initialized data - there is no
writing in-between.
Diez This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Thomas W |
last post by:
Will there be a WSGI-server like BaseHTTPServer etc in the standard
distro? I think that would increase the adoptation of the
WSGI-standard. A new web-framework for python pops up every other week...
|
by: Ben Finney |
last post by:
Howdy all,
I'm trying to implement some new functionality for an existing PHP web
application. Rather than writing a whole lot of stuff in PHP, and
looking toward a future when more of the...
|
by: seberino |
last post by:
I love idea of WSGI and hope it succeeds. It seems to be helpful for
person
tempted to write his own framework.....they can now just mix and match
existing
components with WSGI //instead//.
I...
|
by: Gregory Piñero |
last post by:
So I keep hearing more and more about this WSGI stuff, and honestly I
still don't understand what it is exactly and how it differs from CGI
in the fundamentals (Trying to research this on the web...
|
by: Ben Finney |
last post by:
Howdy all,
I'm working on a web application that is starting to gain a lot of
back-end code written in Python. However, all the current interface
code is written in legacy PHP. I'd like to...
|
by: richmoore44 |
last post by:
Hi,
I've just written a python WSGI middleware class to mitigate
XSS flaws, it's released under the python license. I've
attached the docs below.
Cheers
Rich.
|
by: Adam Atlas |
last post by:
I'm trying to figure out if there's any defined behaviour in PEP 333
for instances where an application returns an iterable as usual
without error, but that iterable's next() method eventually...
|
by: Ron Garret |
last post by:
The wsgiref module in Python 2.5 seems to be empty:
$ python
Python 2.5 (r25:51908, Mar 1 2007, 10:09:05)
on darwin
Type "help", "copyright", "credits" or "license" for more information.
...
|
by: Ivan Voras |
last post by:
Hi,
Is there a straightforward way to convert an XML-RPC server application
(written for SimpleXMLRPCServer) to use WSGI so that it can be used as s
fastcgi server? By "straightforward" I mean...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |