Re: [Web-SIG] WSGI for Python 3
On 17-07-2010, chris.d...@gmail.com wrote: > On Fri, 16 Jul 2010, P.J. Eby wrote: > >> At 02:28 PM 7/16/2010 -0500, Ian Bicking wrote: >> There should be one, and preferably *only* one, obvious way to do it. >> >> And given that HTTP is inherently a bunch of bytes, bytes is the one obvious >> way. > > I think this makes sense. The thing which is assembling the WSGI > environment should do bytes and things further down the stack can > deal with it as they like. This aligns well with how I like to think > about such stuff: bytes on the outside, unicode on the inside. > > Given that app and frameworks developers can throw whatever keys > they like back into the environment, they can cope as they like.[1] > > What would be horrible is if there need to be multiple coping > strategies. Better to be able to say, "Oh it doesn't work? Try this > way to cope: remember it is bytes." This thread is difficult to follow, but this make sense to me also. KISS -- William Dodé - http://flibuste.net Informaticien Indépendant ___ 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] WSGI 2
>> HTTP moves bytes, therefore WSGI should move bytes. For practical reasons, >> it would be good to *also* support strings on the application side, >> especially for application migration. However, I see no reason to make >> *servers* provide decoded strings instead of bytes. +1 because anyway if (most of the time) an app decide to reject everything not utf-8 it'll be very easy. And if not it will be possible, specialy for old applications where we cannot upgrade the server and the client in the same time. -- William Dodé - http://flibuste.net Informaticien Indépendant ___ 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] Developer authentication spec
On 13-07-2009, Graham Dumpleton wrote: > 2009/7/14 Ian Bicking : >> I wrote up a spec a while >> ago: http://wsgi.org/wsgi/Specifications/developer_auth >> The goal is a single way to indicate to debugging and developer tools when >> the developer is logged in. This is orthogonal to normal application >> authentication. It would control access to things like interactive >> debuggers, but could also be used to show information about template >> rendering, profiling, etc. My goal in making this a specification is to >> encourage wider use of the technique in debugging tools (consumers), so they >> can use a consistent means of protecting private information or tools >> intended for developers. >> Since I wrote the spec I've written up an implementation: >> https://svn.openplans.org/svn/DevAuth/trunk >> Last time I brought this up there wasn't any response, but I'm hoping >> it'll... I dunno, make more sense or seem more interesting now. > > For in browser debuggers, I think a rethink is needed as to how they > work. Currently they are only of use if the person who made the > request triggered the error and the debugger is enabled. This is > useless if you want to debug a problem that happened at an arbitrary > time through the actions of an arbitrary user and you don't have a > clue how to reproduce it. ... Great project ! We should not forget the possibility of a server without access, or a server wich will be restarted. I mean that the state should be transportable. Currently, when my server catch an exception, it send the most it can to an url (traceback + logs). On this url i record the data and send an email. -- William Dodé - http://flibuste.net Informaticien Indépendant ___ 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] Announcing bobo
On 16-06-2009, Etienne Robillard wrote: > > Pfft, I bet this thread would have never happened without my initial > intervention. Likewise, I think you're just using this thread for your > own interests, disregarding my own arguments on why web frameworks are > so hard to cope with. > > If you want to start a thread for Bobo, please switch mailing-list or > create a new thread, as all I wanted was to tell Jim my disappointement > regarding Bobo, and I still think its not very revolutionary. Imho you just describe your mistake ! You should start an other thread to discuss about the number of web framework instead of focus specialy on bobo. In fact, web framework like bobo is an answer to this problem (the number of framework). Like you said there is nothing revolutionary, it use other components (paste and webob), it means that we begin to stop to reinvent the wheel and search for the concensus on the smaller efficient framework. And this is really fine ! -- William Dodé - http://flibuste.net Informaticien Indépendant ___ 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] how to test hunging socket ?
On 31-01-2009, William Dode wrote: > I think i finaly could catch the error... > > With wsgiref simple_server (and apache mod_proxy), i run an app without > problem most of the time. I mean 10 hits/day. Some times, not every > day, the app freeze and i need to restart it manualy. If i don't the app > stay like that and never answer more to requests. > > The traceback show a lot broken pipe. This traceback is repeated for > each requests to the restart. I should say that i use mod_proxy with a timeout. So maybe the broken pipe is because of that... -- William Dodé - http://flibuste.net Informaticien Indépendant ___ 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] how to test hunging socket ?
I think i finaly could catch the error... With wsgiref simple_server (and apache mod_proxy), i run an app without problem most of the time. I mean 10 hits/day. Some times, not every day, the app freeze and i need to restart it manualy. If i don't the app stay like that and never answer more to requests. The traceback show a lot broken pipe. This traceback is repeated for each requests to the restart. Traceback (most recent call last): File "/usr/lib/python2.5/wsgiref/handlers.py", line 93, in run self.finish_response() File "/usr/lib/python2.5/wsgiref/handlers.py", line 134, in finish_response self.write(data) File "/usr/lib/python2.5/wsgiref/handlers.py", line 217, in write self.send_headers() File "/usr/lib/python2.5/wsgiref/handlers.py", line 273, in send_headers self.send_preamble() File "/usr/lib/python2.5/wsgiref/handlers.py", line 199, in send_preamble 'Date: %s\r\n' % format_date_time(time.time()) File "/usr/lib/python2.5/socket.py", line 274, in write self.flush() File "/usr/lib/python2.5/socket.py", line 261, in flush self._sock.sendall(buffer) error: (32, 'Broken pipe') I know that wsgiref should not be used in production, but i'm suprised that a broken pipe can freeze all the app... -- William Dodé - http://flibuste.net Informaticien Indépendant ___ 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] how to test hunging socket ?
On 30-01-2009, Ian Bicking wrote: > --===1780478717== > Content-Type: multipart/alternative; boundary=00163646d5c46749ac0461ba70c5 > > --00163646d5c46749ac0461ba70c5 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 7bit > > On Fri, Jan 30, 2009 at 3:48 PM, William Dode wrote: > >> Fine, i should definitely give it a try. >> >> If my app is not thread safe but respond in a decent time, can i benefit >> from a multithread server (for a socket problem) if i use a lock for >> every page like that : >> >> I use webob... >> > > If your app isn't threadsafe, you should use a multiprocess server. > mod_wsgi has options for this, and flup has forking options (you'd use flup > behind Apache or another server). Yes, i also could use an async server. But i would like to identify (and reproduce) exactly the problem. I also use a lot of cached data in my app. Anyway i have to make it thread-safe... -- William Dodé - http://flibuste.net Informaticien Indépendant ___ 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] how to test hunging socket ?
On 30-01-2009, Ian Bicking wrote: > --===1588093401== > Content-Type: multipart/alternative; boundary=0016364ee12abeaed40461b91b05 > > --0016364ee12abeaed40461b91b05 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: quoted-printable > > If you use the Paste HTTP server and Python 2.5 with ctypes installed, you > can install the watchthreads app: > http://svn.pythonpaste.org/Paste/trunk/paste/debug/watchthreads.py > > that will let you see the hung threads, and get a traceback of their curren= > t > position. Fine, i should definitely give it a try. If my app is not thread safe but respond in a decent time, can i benefit from a multithread server (for a socket problem) if i use a lock for every page like that : I use webob... lock = Lock() def my_application(environ, start_response): req = webob.Request(environ) res = webob.Response() res.content_type = 'text/html' try: lock.acquire() # my app... res.write('ok') finally: lock.release() return res(environ, start_response) > > On Fri, Jan 30, 2009 at 1:52 PM, William Dode wrote: > >> Hi, >> >> I've a problem with a web app wich freeze periodicaly. I monitored my >> app and the hang doesn't seem to occur in it. So i think the problem is >> before, or after, a problem of socket i imagine... It append with >> wsgiref.simple_server and mod_wsgi. My app is not totaly thread safe so >> i didn't try a lot of servers... >> When it freeze, i have to restart the app manualy. With mod_wsgi it >> freeze the whole server. It doesn't append very often so it's difficult >> for me to reproduce the problem. >> >> So my question is, how can i simulate hunging socket ? or how can i see >> where the app freeze exactly ? >> >> In python-paste server i read the ian tried to handle some case of >> hunging socket... >> >> thx, and sorry for my english... >> >> -- >> William Dod=C3=A9 - http://flibuste.net >> Informaticien Ind=C3=A9pendant >> >> ___ >> 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/ianb%40colorstudy.com >> > > > > --=20 > Ian Bicking | http://blog.ianbicking.org > > --0016364ee12abeaed40461b91b05 > Content-Type: text/html; charset=UTF-8 > Content-Transfer-Encoding: quoted-printable > > If you use the Paste HTTP server and Python 2.5 with ctypes installed, you = > can install the watchthreads app: http://svn.pythonpaste.org/Pas= > te/trunk/paste/debug/watchthreads.py">http://svn.pythonpaste.org/Paste/trun= > k/paste/debug/watchthreads.py >that will let you see the hung threads, and get a traceback of their cu= > rrent position.On Fri, Jan 30, 2009 at 1= >:52 PM, William Dode <mailto:w...@flibuste.= > net">w...@flibuste.net> wrote: > 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi, > > I've a problem with a web app wich freeze periodicaly. I monitored my r> > app and the hang doesn't seem to occur in it. So i think the problem is= > > before, or after, a problem of socket i imagine... It append with > wsgiref.simple_server and mod_wsgi. My app is not totaly thread safe so > i didn't try a lot of servers... > When it freeze, i have to restart the app manualy. With mod_wsgi it > freeze the whole server. It doesn't append very often so it's diffi= > cult > for me to reproduce the problem. > > So my question is, how can i simulate hunging socket ? or how can i see > where the app freeze exactly ? > > In python-paste server i read the ian tried to handle some case of > hunging socket... > > thx, and sorry for my english... > > -- > William Dod=C3=A9 - http://flibuste.net"; target=3D"_blank">http:= > //flibuste.net > Informaticien Ind=C3=A9pendant > > ___ > Web-SIG mailing list >mailto:Web-SIG@python.org";>Web-SIG@python.org > Web SIG: http://www.python.org/sigs/web-sig"; target=3D"_blank">h= > ttp://www.python.org/sigs/web-sig > Unsubscribe: http://mail.python.org/mailman/options/web-sig/ianb= > %40colorstudy.com" target=3D"_blank">http://mail.python.org/mailman/options= > /web-sig/ianb%40colorstudy.com >-- Ian Bicking | &nb= > sp;http://blog.ianbicking.org";>http://blog.ianbicking.org> > > --0016364ee12abeaed40461b91b05-- > > --===1588093401== > Content-Type: text/plain; chars
[Web-SIG] how to test hunging socket ?
Hi, I've a problem with a web app wich freeze periodicaly. I monitored my app and the hang doesn't seem to occur in it. So i think the problem is before, or after, a problem of socket i imagine... It append with wsgiref.simple_server and mod_wsgi. My app is not totaly thread safe so i didn't try a lot of servers... When it freeze, i have to restart the app manualy. With mod_wsgi it freeze the whole server. It doesn't append very often so it's difficult for me to reproduce the problem. So my question is, how can i simulate hunging socket ? or how can i see where the app freeze exactly ? In python-paste server i read the ian tried to handle some case of hunging socket... thx, and sorry for my english... -- William Dodé - http://flibuste.net Informaticien Indépendant ___ 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] Fwd: wsgiref.simple_server slow on slow network
On 23-07-2008, Tibor Arpas wrote: > Reverse DNS lookup is THE reason. Thank you very much Irmen. I put my > remote computer into windows/system32/drivers/etc/hosts and the > problem disapeared. The DNS name is indeed in the log which is written > to the console. Thanks again. > > Is there a way to disable the reverse DNS lookup in the > wsgiref.simple_server? Quick googling didn't reveal much. I had this kind of problem on windows, try this : def getfqdn(name=''): return name import socket socket.getfqdn=getfqdn -- William Dodé - http://flibuste.net Informaticien indépendant ___ 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] multi-threaded or multi-process wsgi apps
On 26-11-2007, Chris Withers wrote: > Hey All, > > I hope I have the right list, if not please point me in the right > direction... > > Likewise, if there are good docs that cover all of this, please send me > their way ;-) > > Right, I'm curious as to how wsgi applications end up being > multi-threaded or multi-process and if they are, how they share > resources such as databases and configuration. > > There's a couple of reasons I'm asking... > > The first was something Chris McDonough said about one ofthe issues > they're having with the repoze project: when using something like > mod_wsgi, it's the first person to hit each thread that takes the hit of > loading the configuration and opening up the zodb. Opening the ZODB, in > particular, can take a lot of time. How should repoze be structured such > that all the threads load their config and open their databases when > apache is restarted rather than when each thread is first hit? What about using a distributed object system like pyro ? You could have the heavy loading of the database in a server independant of the wsgi application. http://pyro.sourceforge.net/ -- William Dodé - http://flibuste.net Informaticien indépendant ___ 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] WebOb
On 23-10-2007, Ian Bicking wrote: > I redid the front page to make it more brief: > http://pythonpaste.org/webob/ Fine. I had to use it to understand what is the benefit of webob, the examples was not very clear in the first read. The yaro's page was more clear to me for example. > > I stopped with the example, because I couldn't think of a good example. > Maybe a different evening. Suggestions of course welcome. The problem will be to be practical but don't look like 'yet another framework' ! I liked your do-it-yourself-framework. Maybe a webob-only version ? Each example should run alone with copy-paste and wsgiref as server. Without webob: -- import wsgiref.simple_server def app(environ, start_response): start_response('200 OK', [('content-type', 'text/html')]) return ['Hello world!'] wsgiref.simple_server.make_server('', 8080, app).serve_forever() With webob: --- import wsgiref.simple_server from webob import Response, Request def app(environ, start_response): req = Request(environ) res = Response(content_type='text/html') res.body = 'Hello world!' return res(environ, start_response) wsgiref.simple_server.make_server('', 8080, app).serve_forever() With form : --- import wsgiref.simple_server from webob import Response, Request def app(environ, start_response): req = Request(environ) res = Response(content_type='text/html') you = req.params.get('you') if you: res.body_file.write('Hello %s' % you) res.body_file.write(''' Who are you ? ''') return res(environ, start_response) wsgiref.simple_server.make_server('', 8080, app).serve_forever() with form and cookies : --- import wsgiref.simple_server from webob import Response, Request def app(environ, start_response): req = Request(environ) res = Response(content_type='text/html') you_cookie = req.cookies.get('you') if you_cookie: res.body_file.write('I recognize you %s' % you_cookie) you = req.params.get('you', you_cookie) if you: res.body_file.write('Hello %s' % you) res.set_cookie('you', you) res.body_file.write(''' Who are you ? ''') return res(environ, start_response) wsgiref.simple_server.make_server('', 8080, app).serve_forever() -- William Dodé - http://flibuste.net Informaticien indépendant ___ 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] WebOb
Hi, Since the announce of ian about webob, i did two things with it. First i include it in my personal web framework, it was very easy, i had just to remove all my crappy equivalent functions. It make my framework a little bit more clean and i can inherit new features. Second, most important, i wanted to start a little project without any framework to minimize the dependencies. So i started from scratch only with WebOb, the wsgiref server and a part of the example in routing_args specifications. It did it very quickly and the result should be compatible with any wsgi compliant pieces. So, don't you think web-sig should officialy support such library ? Include it in the lib stantard or in a wsgiorg library ? Waiting for your view... -- William Dodé - http://flibuste.net Informaticien indépendant I've hard to write in english language... please don't hesitate to give me somes advices in private ! ___ 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] (proto) request object spec
On 14-11-2006, Phillip J. Eby wrote: > At 06:36 PM 11/13/2006 -0700, L. C. Rees wrote: ... >>Operations that produce entries such as these are frequently performed >>by >>middleware. > > This is not what middleware is for; please don't encourage people to do > this. Library functions are the One Obvious way to perform operations on > environ keys. To prevent this what do you think about a wsgiorg "standard" library ? like parse_formvars of pythonpaste wich take environ as argument. -- William Dodé - http://flibuste.net ___ 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] routing_args (was url_vars)
On 06-11-2006, Ian Bicking wrote: > Luke Arno wrote: >> So, it seemed to me like we had agreement on >> this. Does anyone disagree? >> >> environ['routing_args'] == (list_or_tuple, a_dict) >> >> Should the spec get updated and marked as >> accepted? > > I think so, with 'wsgiorg.routing_args'. I've just put it off because > of the namespace discussion, but I think that's resolved too. > when it's 'wsgiorg', don't you think that we should make an other pep or just a page in wsgi.org instead of updating the wsgi spec ? -- William Dodé - http://flibuste.net ___ 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] Proposal: wsgi.url_vars
On 21-10-2006, Ian Bicking wrote: > I think there's room for some more standards building on WSGI (that > aren't actually extensions of the WSGI spec itself). > > I put a page up on the wsgi.org site for this: > http://wsgi.org/wsgi/Specifications > > And I'm introducing what I think is low-hanging fruit in the > specification realm: wsgi.url_vars > http://wsgi.org/wsgi/Specifications/url_vars > > The spec is copied below for discussion: +1 for this kind of specs to make applications more independant of frameworks pieces. I hope you or somes others wsgi guru will also make somes proposals for session and cookies... -- William Dodé - http://flibuste.net ___ 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] middleware in stantard library ?
Hi, In the same goal as wsgiserver, what do you think to add two middleware to can really make quickly a meta-framework and "play" immediatly with it without any external dependency. I think about cookies and session. bye -- William Dodé - http://flibuste.net ___ 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] WSGI in standard library
On 12-02-2006, Jos Yule wrote: > Alan Kennedy wrote: >> So, I still think that only basic servers educational/playpen servers >> should go in the standard library, with an indication that the user >> should pick an openly server from outside the distro if they require to >> do serious server work. Anyway if there is a server in the standard library it will be used in production, like all others part of the library, even if there is this kind of indication. Specialy for intranet or under proxy. -- William Dodé - http://flibuste.net ___ 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] Standardized template API
On 31-01-2006, Peter Hunt wrote: > Hi guys - > > I think a lot of web frameworks and applications are using a template > engine. We should probably have an officially sanctioned templating engine > plugin API, as it would ease adoption of existing Python web framework > solutions. What about pep292 ? string.Template http://www.python.org/doc/current/lib/node109.html -- William Dodé - http://flibuste.net ___ 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