Re: paster exception (generator ignored GeneratorExit)
On Oct 17, 2008, at 8:14 AM, Michael van Tellingen wrote: Heya, I'm currently pretty much reliably triggering the following exception using IE6 (and some iframe/form post stuff): Exception happened during processing of request from ('192.168.131.1', 58222) Traceback (most recent call last): File /Library/Python/2.5/site-packages/Paste-1.7.1-py2.5.egg/paste/ httpserver.py, line 1056, in process_request_in_thread self.finish_request(request, client_address) File /System/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/SocketServer.py, line 254, in finish_request self.RequestHandlerClass(request, client_address, self) File /System/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/SocketServer.py, line 522, in __init__ self.handle() File /Library/Python/2.5/site-packages/Paste-1.7.1-py2.5.egg/paste/ httpserver.py, line 432, in handle BaseHTTPRequestHandler.handle(self) File /System/Library/Frameworks/Python.framework/Versions/2.5/lib/ python2.5/BaseHTTPServer.py, line 316, in handle self.handle_one_request() File /Library/Python/2.5/site-packages/Paste-1.7.1-py2.5.egg/paste/ httpserver.py, line 427, in handle_one_request self.wsgi_execute() File /Library/Python/2.5/site-packages/Paste-1.7.1-py2.5.egg/paste/ httpserver.py, line 295, in wsgi_execute result.close() RuntimeError: generator ignored GeneratorExit Putting the result.close() call in a try/except clause will allow paster to send the data to the client, thus this is currently my workaround. How do we produce this? I assume you're using a generator in a Pylons controller, is it that easy or is there anything else involved? -- Philip Jenvey --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Putting DELETE's params into request.POST
W liście Sok Ann Yap z dnia sobota 18 października 2008: I must admit it's tricky to tell from the specification - I've read it again... The spec says request must not contain message body if method definition says it must not contain it... But no method definition (even for GET) says so. PUT and POST refer to section 8.2 about message transmission - DELETE does not, but that is quite vague. On the other hand, it seems to be common understanding that only PUT, POST, TRACE and potentially OPTION might contain body. See for example source of libwww (official library from W3C) here: http://www.w3.org/Library/src/HTMethod.c, or this information at IBM site (point 5): http://publib.boulder.ibm.com/infocenter/cicsts/v3r1/index.jsp?topic=/com .ibm.cics.ts31.doc/dfhtl/topics/dfhtl_outmaking_reqwrite.htm -- Paweł Stradomski If it's not even part of the specs, perhaps we shall threat that as a common misunderstanding instead? Well, to be honest, the spec doesn't seem to disallow request body with GET requests (as I read it), and I've just checked - Apache 2 doesn't complain if it gets one. I must say I'm confused. -- Paweł Stradomski --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Putting DELETE's params into request.POST
On Sat, Oct 18, 2008 at 1:52 PM, Wichert Akkerman [EMAIL PROTECTED] wrote: Previously Sok Ann Yap wrote: On the other hand, if we look into httplib2's source code, which I supposed is everyone's favorite http client library, Joe Gregorio doesn't make any distinction between POST and DELETE. You can verify that by using httplib2 to send a DELETE request with body to a simple wsgi app that echoes back wsgi.input. Probably because that was just easier.I can not imagine what the semantics for a body for DELETE would be. What information would you want to send to something that you are deleting? Wichert. More often than not, the simple way will end up being the correct way as well ;) If you want more example, Paste's fixture also allows body to be sent together with a DELETE request. Anyway, I have described my use case in the original post, which is to send a CSRF protection token along with the request. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: Redirect being raised from outside a controller
Well, apparently, my idea on that didn't make it working because it isn't much different if you use global or local reference to the same proxy object. At the time that function is called real session and request are referenced by them. On Oct 18, 9:56 am, askel [EMAIL PROTECTED] wrote: Adam, You decorator overrides request global with request local variable and redirect_to gets confused by dummy request variable. It is only sensible to use it during request processing. Use global session and request instead. Cheers Alex On Oct 17, 1:40 pm, Adam Peacock [EMAIL PROTECTED] wrote: Due to the way my user authentication works, I'm rolling my own. It's all work well, and I have it working with decorators, except for a funny issue - when I raise a redirect_to from my decorator, Pylons displays the error in debug mode, rather than actually redirecting. In the debug I get a stack trace with HTTPFound: 302 Found content- type: text/html; charset=UTF-8 Content-Length: 0 location: /login/ Anyone have any idea? Or is there a better way to do this? Auth.py: from decorator import decorator from pylons.controllers.util import abort, redirect_to key = user_id def _is_logged_in(session): if key in session and session[key]: return True return False def login_required(session, request=None): def wrap(f): print session print request if _is_logged_in(session): return redirect_to('login') return wrap My test action: class PaymentController(BaseController): @auth.login_required(session, request) def index(self): return 'Authenticated' --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-discuss@googlegroups.com 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 -~--~~~~--~~--~--~---
Re: How to filter the @jsonify warning
On Samstag, 18. Oktober 2008, Philip Jenvey wrote: On Oct 17, 2008, at 2:01 PM, Christoph Haas wrote: I tried to use: import warnings warnings.filterwarnings('ignore', 'JSON responses with Array envelopes') in several places like lib/base.py or config/environment.py but the warning always still appeared. Where would I put that code to be successful? I know it's close to trivial to just copy the @jsonify decorator function and removing that line. I'm more interested in how to suppress the warnings. I'd recommend environment.py for the most appropriate place for this. It's not working because the message argument should be an RE match, whereas you're assuming it's an RE search. Try: warnings.filterwarnings('ignore', '.*JSON responses with Array envelopes.*') Thanks for the hint. Unfortunately the warnings still appears at every request. Christoph -- A guess is just a guess until you turn it into a pie chart. Then it's an analysis. (Scott Adams) signature.asc Description: This is a digitally signed message part.
Re: How to filter the @jsonify warning
On Oct 17, 2008, at 2:01 PM, Christoph Haas wrote: Unfortunately I wasn't very lucky. I tried to use: import warnings warnings.filterwarnings('ignore', 'JSON responses with Array envelopes') You need to specify the warning itself that is being thrown, rather than the message of it. Ie: warnings.filterwarnings('ignore', module='pylons.decorators') As the entire message itself is a bit long. Or if since it compiles them to be regexp, maybe: warnings.filterwarnings('ignore', 'JSON responses with.*') would do the trick. Cheers, Ben smime.p7s Description: S/MIME cryptographic signature