Quantcast

Fwd: webapp2 capability

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Fwd: webapp2 capability

Stuart Mitchell-3
Hi I am writing a google appengine service and I want to use pyamf

with the python27 runtime webapp has been upgraded to webapp2.
pyamf does not seem to work with this setup and I get the following error

Traceback (most recent call last):
  File "/home/stuart/hg/mw_appengine/google_appengine/google/appengine/runtime/wsgi.py",
line 175, in Handle
    for chunk in result:
TypeError: 'WebAppGateway' object is not iterable

I'm not sure if this is a problem with passing a object not a class to
the WSGIapplication or something todo with the
webapp.RequestHandler.initialize() method.

Has anyone got this working?

Stu
P.S. I have the it working with python25, but I can even install
python25 on my ubuntu 11.04 computer to test locally
_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fwd: webapp2 capability

Nick Joyce
On Tuesday, 29 November 2011 at 12:47 PM, Stuart Mitchell wrote:
Hi I am writing a google appengine service and I want to use pyamf

with the python27 runtime webapp has been upgraded to webapp2.
pyamf does not seem to work with this setup and I get the following error

Traceback (most recent call last):
  File "/home/stuart/hg/mw_appengine/google_appengine/google/appengine/runtime/wsgi.py",
line 175, in Handle
    for chunk in result:
TypeError: 'WebAppGateway' object is not iterable

I'm not sure if this is a problem with passing a object not a class to
the WSGIapplication or something todo with the
webapp.RequestHandler.initialize() method.

Has anyone got this working?
I am using WSGIGateway with python27 on appengine without issue, haven't tried integrating with webapp2 yet.

I'll open a ticket to add support for this.

Thanks!

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: webapp2 capability

Stuart Mitchell-3
>On Wed, Nov 30, 2011 at 10:34 AM, Nick Joyce <[hidden email]> wrote:
>
> I am using WSGIGateway with python27 on appengine without issue, haven't
> tried integrating with webapp2 yet.
>
Yes I thought this may be a way to go but I have had to use it under
webapp2 as I want to have the gateway at a particular route. I Assume
the WSGIGateway only works on the root '\'.

> I'll open a ticket to add support for this.

We have been using pyAMF for a while now and would like to offer a
bounty / donation of $500USD

As you don't have a donation link how should we do this?

Also is it possible to integrate pyAMF with a testing framework? I am
using nose-gae but the only examples I see of testing actually involve
starting the dev_server, instead accessing the route within the tests.

Thanks
Stu

--
Stuart Mitchell
PhD Engineering Science
Freelance Programmer and Optimisation Expert
www.stuartmitchell.com
_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: webapp2 capability

Nick Joyce
On Wednesday, 30 November 2011 at 7:54 AM, Stuart Mitchell wrote:
On Wed, Nov 30, 2011 at 10:34 AM, Nick Joyce <[hidden email]> wrote:

I am using WSGIGateway with python27 on appengine without issue, haven't
tried integrating with webapp2 yet.
Yes I thought this may be a way to go but I have had to use it under
webapp2 as I want to have the gateway at a particular route. I Assume
the WSGIGateway only works on the root '\'.
I have added support for webapp2 in the webapp2-gateway on my fork of pyamf - https://github.com/njoyce/github

I have tested the changes locally and everything appears to work correctly but I need to get the pyamf-appengine buildslave updated with the new 1.6 SDK before confirming.

I'll open a ticket to add support for this.

We have been using pyAMF for a while now and would like to offer a
bounty / donation of $500USD

As you don't have a donation link how should we do this?
Wow - very generous! Let's make sure the changes are working first ;)

Also is it possible to integrate pyAMF with a testing framework? I am
using nose-gae but the only examples I see of testing actually involve
starting the dev_server, instead accessing the route within the tests.
It depends on what you're trying to test. If you're trying to test services, I suggest mocking the request object and calling the functions/methods directly, skipping the whole AMF layer entirely.

If you're looking to build integration tests then I would check https://gist.github.com/1407388 which builds a PyAMF Gateway and sends an AMF remoting request and decodes the response. Note that this snippet uses the excellent WebTest from Ian Bicking - http://pypi.python.org/pypi/WebTest

Cheers,

Nick

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: webapp2 capability

Stuart Mitchell-3
On Wed, Nov 30, 2011 at 1:43 PM, Nick Joyce <[hidden email]> wrote:

> I have added support for webapp2 in the webapp2-gateway on my fork of pyamf
> - https://github.com/njoyce/github

Cheers will check it out

>
>> Also is it possible to integrate pyAMF with a testing framework? I am
>> using nose-gae but the only examples I see of testing actually involve
>> starting the dev_server, instead accessing the route within the tests.
>
> It depends on what you're trying to test. If you're trying to test services,
> I suggest mocking the request object and calling the functions/methods
> directly, skipping the whole AMF layer entirely.

Yup this is what I am currently doing, will have to do some
integration tests though I expect.

>
> If you're looking to build integration tests then I would
> check https://gist.github.com/1407388 which builds a PyAMF Gateway and sends
> an AMF remoting request and decodes the response. Note that this snippet
> uses the excellent WebTest from Ian Bicking
> - http://pypi.python.org/pypi/WebTest

Thanks looks exactly what I want

 Stu
_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fwd: webapp2 capability

frasseff
In reply to this post by Nick Joyce
I do not think google appengine run with python 2.7.

2011/11/29 Nick Joyce <[hidden email]>
On Tuesday, 29 November 2011 at 12:47 PM, Stuart Mitchell wrote:
Hi I am writing a google appengine service and I want to use pyamf

with the python27 runtime webapp has been upgraded to webapp2.
pyamf does not seem to work with this setup and I get the following error

Traceback (most recent call last):
  File "/home/stuart/hg/mw_appengine/google_appengine/google/appengine/runtime/wsgi.py",
line 175, in Handle
    for chunk in result:
TypeError: 'WebAppGateway' object is not iterable

I'm not sure if this is a problem with passing a object not a class to
the WSGIapplication or something todo with the
webapp.RequestHandler.initialize() method.

Has anyone got this working?
I am using WSGIGateway with python27 on appengine without issue, haven't tried integrating with webapp2 yet.

I'll open a ticket to add support for this.

Thanks!

_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users



_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: webapp2 capability

Stuart Mitchell-3
In reply to this post by Nick Joyce
On Wed, Nov 30, 2011 at 1:43 PM, Nick Joyce <[hidden email]> wrote:
> I have added support for webapp2 in the webapp2-gateway on my fork of pyamf
> - https://github.com/njoyce/github

I think you actually meant https://github.com/njoyce/pyamf/tree/webapp2-gateway

>
> I have tested the changes locally and everything appears to work correctly
> but I need to get the pyamf-appengine buildslave updated with the new 1.6
> SDK before confirming.

Seems to work on dev-appengine but will confirm when I upload.

One point though as this is on appengine I previously downloaded the
zip and copied the code in the pyamf folder (underneath setup.py etc)
into my repository. This works fine from the pypi download but for the
git clone I need a _version.py file that is created by setup.py right?


> We have been using pyAMF for a while now and would like to offer a
> bounty / donation of $500USD
>
> As you don't have a donation link how should we do this?

Found link
>
> Wow - very generous! Let's make sure the changes are working first ;)
Donated (by the project leader so won't be under my name)
> If you're looking to build integration tests then I would
> check https://gist.github.com/1407388 which builds a PyAMF Gateway and sends
> an AMF remoting request and decodes the response. Note that this snippet
> uses the excellent WebTest from Ian Bicking
> - http://pypi.python.org/pypi/WebTest

Trying now thanks

Stu
_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: webapp2 capability

Stuart Mitchell-3
On Thu, Dec 1, 2011 at 9:54 AM, Stuart Mitchell
<[hidden email]> wrote:

>> If you're looking to build integration tests then I would
>> check https://gist.github.com/1407388 which builds a PyAMF Gateway and sends
>> an AMF remoting request and decodes the response. Note that this snippet
>> uses the excellent WebTest from Ian Bicking
>> - http://pypi.python.org/pypi/WebTest
>
> Trying now thanks

Unfortunately, the given code uses webapp not webapp2 to build the app

def makeApp(services):
    """
    Return a webapp WSGI application with the PyAMF gateway at '/'
    """
    from google.appengine.ext import webapp
    from pyamf.remoting.gateway.google import WebAppGateway

    gateway = WebAppGateway(services)
    application_paths = [('/', gateway)]

    return webapp.WSGIApplication(application_paths)

Which with the new webapp2 code gives this error
Traceback (most recent call last):
  File "/home/stuart/hg/mw_appengine/unstable/job_processing_server/tests/test_pyamf.py",
line 75, in test_echo
    self.assertEqual(self.service.echo('echo'), 'testSite echo')
  File "/home/stuart/hg/mw_appengine/unstable/job_processing_server/pyamf/remoting/client/__init__.py",
line 52, in __call__
    return self.service._call(self, *args)
  File "/home/stuart/hg/mw_appengine/unstable/job_processing_server/pyamf/remoting/client/__init__.py",
line 101, in _call
    response = self._gw.execute_single(request)
  File "/home/stuart/hg/mw_appengine/unstable/job_processing_server/pyamf/remoting/client/__init__.py",
line 388, in execute_single
    envelope = self._getResponse(http_request)
  File "/home/stuart/hg/mw_appengine/unstable/job_processing_server/pyamf/remoting/client/__init__.py",
line 423, in _getResponse
    fbh = self.opener(http_request)
  File "/home/stuart/hg/mw_appengine/unstable/job_processing_server/tests/test_pyamf.py",
line 39, in myopener
    response = client.post(url, params=request.data, headers=request.headers)
  File "/usr/local/lib/python2.7/dist-packages/WebTest-1.3.3-py2.7.egg/webtest/app.py",
line 807, in post
    content_type=content_type)
  File "/usr/local/lib/python2.7/dist-packages/WebTest-1.3.3-py2.7.egg/webtest/app.py",
line 787, in _gen_request
    expect_errors=expect_errors)
  File "/usr/local/lib/python2.7/dist-packages/WebTest-1.3.3-py2.7.egg/webtest/app.py",
line 1052, in do_request
    res = req.get_response(app, catch_exc_info=True)
  File "/usr/local/google_appengine/lib/webob/webob/__init__.py", line
1212, in get_response
    application, catch_exc_info=True)
  File "/usr/local/google_appengine/lib/webob/webob/__init__.py", line
1184, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/WebTest-1.3.3-py2.7.egg/webtest/lint.py",
line 173, in lint_app
    iterator = application(environ, start_response_wrapper)
  File "/usr/local/google_appengine/google/appengine/ext/webapp/_webapp25.py",
line 686, in __call__
    handler = handler_class()
TypeError: __call__() takes at least 2 arguments (1 given)


If I change webapp to webapp2 (import webapp2 in the above) I get the
following error

Traceback (most recent call last):
  File "/home/stuart/hg/mw_appengine/unstable/job_processing_server/tests/test_pyamf.py",
line 74, in test_echo
    self.assertEqual(self.service.echo('echo'), 'testSite echo')
  File "/home/stuart/hg/mw_appengine/unstable/job_processing_server/pyamf/remoting/client/__init__.py",
line 52, in __call__
    return self.service._call(self, *args)
  File "/home/stuart/hg/mw_appengine/unstable/job_processing_server/pyamf/remoting/client/__init__.py",
line 101, in _call
    response = self._gw.execute_single(request)
  File "/home/stuart/hg/mw_appengine/unstable/job_processing_server/pyamf/remoting/client/__init__.py",
line 388, in execute_single
    envelope = self._getResponse(http_request)
  File "/home/stuart/hg/mw_appengine/unstable/job_processing_server/pyamf/remoting/client/__init__.py",
line 423, in _getResponse
    fbh = self.opener(http_request)
  File "/home/stuart/hg/mw_appengine/unstable/job_processing_server/tests/test_pyamf.py",
line 39, in myopener
    response = client.post(url, params=request.data, headers=request.headers)
  File "/usr/local/lib/python2.7/dist-packages/WebTest-1.3.3-py2.7.egg/webtest/app.py",
line 807, in post
    content_type=content_type)
  File "/usr/local/lib/python2.7/dist-packages/WebTest-1.3.3-py2.7.egg/webtest/app.py",
line 787, in _gen_request
    expect_errors=expect_errors)
  File "/usr/local/lib/python2.7/dist-packages/WebTest-1.3.3-py2.7.egg/webtest/app.py",
line 1075, in do_request
    self._check_status(status, res)
  File "/usr/local/lib/python2.7/dist-packages/WebTest-1.3.3-py2.7.egg/webtest/app.py",
line 1111, in _check_status
    res.body))
AppError: Bad response: 500 Internal Server Error (not 200 OK or 3xx
redirect for http://localhost/)
500 Internal Server Error

The server has either erred or is incapable of performing the
requested operation.


Thanks
>
> Stu
_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: webapp2 capability

grass
This post has NOT been accepted by the mailing list yet.
In reply to this post by Nick Joyce
Hi!

So did you manage to make webapp2 to work with WebAppGateway ?

Yours,
Andrew
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: webapp2 capability

waterart
I just tried to do a simple hello world and got the same problems.  I tried using the PyAMF version found here: https://github.com/njoyce/pyamf/tree/webapp2-gateway
and it did not work.

So I am rolling everything back to python 2.5x.  Hope that works and I can move on.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: webapp2 capability

Stuart Mitchell-3
I had this problem as well I think I fixed it with the change in

Though trunk has moved on since I forked my working version so I haven't tested that change against the newest trunk.

Stu



On Wed, Aug 29, 2012 at 5:13 PM, waterart <[hidden email]> wrote:
I just tried to do a simple hello world and got the same problems.  I tried
using the PyAMF version found here:
https://github.com/njoyce/pyamf/tree/webapp2-gateway
and it did not work.

So I am rolling everything back to python 2.5x.  Hope that works and I can
move on.





--
View this message in context: http://python.6.n6.nabble.com/Fwd-webapp2-capability-tp2164268p4986742.html
Sent from the pyamf-users mailing list archive at Nabble.com.
_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users


_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: webapp2 capability

Nick Joyce
Using pyamf.remoting.gateway.wsgi.WSGIGateway is probably more reasonable in this case than supporting webapp/webapp2.

I wonder if google.WebAppGateway should be removed as it can cause some confusion.

Thoughts?

On Thursday, 30 August 2012 at 00:04, Stuart Mitchell wrote:
I had this problem as well I think I fixed it with the change in

Though trunk has moved on since I forked my working version so I haven't tested that change against the newest trunk.

Stu



On Wed, Aug 29, 2012 at 5:13 PM, waterart <[hidden email]> wrote:
I just tried to do a simple hello world and got the same problems.  I tried
using the PyAMF version found here:
https://github.com/njoyce/pyamf/tree/webapp2-gateway
and it did not work.

So I am rolling everything back to python 2.5x.  Hope that works and I can
move on.





--
View this message in context: http://python.6.n6.nabble.com/Fwd-webapp2-capability-tp2164268p4986742.html
Sent from the pyamf-users mailing list archive at Nabble.com.
_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users

_______________________________________________
PyAMF users mailing list - [hidden email]


_______________________________________________
PyAMF users mailing list - [hidden email]
http://lists.pyamf.org/mailman/listinfo/users
Loading...