Giter VIP home page Giter VIP logo

Comments (11)

loxs avatar loxs commented on August 16, 2024

This is something new, as my code is several monts old and it didn't have problems before the name change from ext to contrib.

from restkit.

benoitc avatar benoitc commented on August 16, 2024

I don't understand what's the problem. Could you provide full code? What's the expected result against the current result you have?

from restkit.

loxs avatar loxs commented on August 16, 2024

That's the full code.
The request object at the second line - log.debug(request.params) is pylons request object. From its environ I create a new request to the proxy.
I call the proxy and after that the pylons request is modified, as can be seen in the log. It contains the params of the new request.
This may be the right behavior, as i probably modifies the request in place, instead of creating a new request object, then modifying it.
What I am saying is that this wasn't the case before you changed the "ext" to "contrib".

from restkit.

benoitc avatar benoitc commented on August 16, 2024

Hum, I didn't change the way the request object is used from 1.3.1 to 2.0.3 :
http://github.com/benoitc/restkit/compare/1.3.1...2.0.3#diff-15

Are you sure btw you're using the last version ? A warning should appear when you use resp.body now . In 2.0 the behavior of response object has changed and the current response object isn't any more persistent . body_string() and .body_stream() method can be used only one time and it's your responsability if you want to use the body more than one time to save it first (in memory or disk) body = resp.body_string() for example. Old behavior was problematic under load and large body. A new persistent response object with caching facilities will appear in 2.1 .

Hope this help.

from restkit.

benoitc avatar benoitc commented on August 16, 2024

did I answered to your question ?

from restkit.

loxs avatar loxs commented on August 16, 2024

I am not sure, as resp.body is not the problem as far as I can see. The problem is that the pylons request object gets modified by the proxy.
For now I'm using a workaround - I assign what I need from the pylons request to variables before I call the proxy.

from restkit.

benoitc avatar benoitc commented on August 16, 2024

are you using wsgi_proxy as a middleware ? Not suire how you call it here.

from restkit.

loxs avatar loxs commented on August 16, 2024

Nope, I use it in a regular controller

from restkit.

benoitc avatar benoitc commented on August 16, 2024

Can you paste the code you're using (controller + the way you use proxy in ? The example provided is supposed to be used as a full app. To use it as a middleware, you could have some code like this one : http://github.com/benoitc/couchdbkit/blob/master/couchdbkit/wsgi/proxy.py#L12

from restkit.

loxs avatar loxs commented on August 16, 2024

Here it is: http://friendpaste.com/6IuYG2Qdh0I8SojqFKdMSY

from restkit.

benoitc avatar benoitc commented on August 16, 2024

after feedback from irc, I'm closing this issue. Thanks for the tests :)

11:17 benoitc: loxs: you do     req.environ['QUERY_STRING'] = 'number=' + str(request.params.get('studioId'))
11:17 benoitc: so it's notmal you lost query args
11:18 loxs: benoitc, is it normal? It didn't use do work like that. I mean, in the past it didn't modify the request.params
11:18 benoitc: rather do req.environ['QUERY_STRING'] += '& number=' + str(request.params.get('studioId'))
11:18 benoitc: well maybe a change in webob
11:19 loxs: maybe
11:19 benoitc: please try it
11:19 loxs: ok
11:21 benoitc: https://bitbucket.org/ianb/webob/src/tip/webob/request.py#cl-582 & https://bitbucket.org/ianb/webob/src/tip/webob/request.py#cl-555
11:22 loxs: yeah, if I append to the query string, of course it works
11:22 loxs: and yes, seems like it changed in webob

from restkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.