Newbie Question

View: New views
6 Messages — Rating Filter:   Alert me  

Newbie Question

by snorkel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
Just found out about pyamf and it looks like the way to go with flex.

I want to use Pylons as my remoting gateway but I am stuck on how to get
data from PostgreSQL
back to flex to use in the datagrid.

I am using /Psycopg2 via the python dbi interface and do not want to use
sql alchemy.

If anyone has any suggestions on how to accomplish this please let me know.

Thanks,

Tony
/

_______________________________________________
PyAMF users mailing list - users@...
http://lists.pyamf.org/mailman/listinfo/users

Re: Newbie Question

by lists-144 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Anthony,

see below for a standalone dev server (not tested though) using WSGI. For more information on using Pylons with PyAMF check the tutorial:

hth,

Thijs

import os
from wsgiref import simple_server

from pyamf.remoting.gateway.wsgi import WSGIGateway

import psycopg2

def fetch(data):
    cur.execute("""SELECT datname from pg_database""")
    rows = cur.fetchall()
    ret = []

    

    print "Show me the rows:"
    for row in rows:
        print "   ", row[0]
        ret.append(row[0])

        

    return ret

services = {
    'fetch': fetch
}

if __name__ == '__main__':

    try:
       conn = psycopg2.connect("dbname='template1' user='dbuser' host='localhost' password='dbpass'")
       cur = conn.cursor()
    except:
       print "Unable to connect to the database"

    

    gw = WSGIGateway(services)

    httpd = simple_server.WSGIServer(
        ('localhost', 8000),
        simple_server.WSGIRequestHandler,
    )

    httpd.set_app(gw)

    print "Running psycopg2 AMF gateway on http://localhost:8000"

    try:
        httpd.serve_forever()
    except KeyboardInterrupt:
        pass

On 27 May 2009, at 16:55, Anthony Caduto wrote:

Hi,
Just found out about pyamf and it looks like the way to go with flex.

I want to use Pylons as my remoting gateway but I am stuck on how to get data from PostgreSQL
back to flex to use in the datagrid.

I am using /Psycopg2 via the python dbi interface and do not want to use sql alchemy.

If anyone has any suggestions on how to accomplish this please let me know.

Thanks,

Tony
/

_______________________________________________
PyAMF users mailing list - users@...
http://lists.pyamf.org/mailman/listinfo/users



_______________________________________________
PyAMF users mailing list - users@...
http://lists.pyamf.org/mailman/listinfo/users

PGP.sig (201 bytes) Download Attachment

Re: Newbie Question

by snorkel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thijs Triemstra | Collab wrote:
> Hi Anthony,
>
> see below for a standalone dev server (not tested though) using WSGI.
> For more information on using Pylons with PyAMF check the tutorial:
> http://pyamf.org/wiki/PylonsHowto
>
Hi,
Thanks for the pg example.  I am also running into problems with Pylons
and pyamf.
I am using Pylons 0.9.7 and the example does not seem to work.
I followed it exactly and when I run the sample client against the
pylons controller I get this error:

Message    File Name    Line    Position  
Traceback              
    <module>    <module1>    8      
    __call__    
C:\Python26\lib\site-packages\pyamf-0.4.2-py2.6-win32.egg\pyamf\remoting\client\__init__.py    
52      
    _call    
C:\Python26\lib\site-packages\pyamf-0.4.2-py2.6-win32.egg\pyamf\remoting\client\__init__.py    
101      
    execute_single    
C:\Python26\lib\site-packages\pyamf-0.4.2-py2.6-win32.egg\pyamf\remoting\client\__init__.py    
409      
    _getResponse    
C:\Python26\lib\site-packages\pyamf-0.4.2-py2.6-win32.egg\pyamf\remoting\client\__init__.py    
454      
RemotingError: HTTP Gateway reported status 404 Not Found              

_______________________________________________
PyAMF users mailing list - users@...
http://lists.pyamf.org/mailman/listinfo/users

Re: Newbie Question

by lists-144 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for catching that Anthony. That howto worked with Pylons 0.9.6 but returned that 404 with 0.9.7. I updated the howto and it now works with both 0.9.6 and 0.9.7 for me.

Cheers,

Thijs

On 27 May 2009, at 17:46, Anthony Caduto wrote:

Thijs Triemstra | Collab wrote:
Hi Anthony,

see below for a standalone dev server (not tested though) using WSGI. For more information on using Pylons with PyAMF check the tutorial:
http://pyamf.org/wiki/PylonsHowto

Hi,
Thanks for the pg example.  I am also running into problems with Pylons and pyamf.
I am using Pylons 0.9.7 and the example does not seem to work.
I followed it exactly and when I run the sample client against the pylons controller I get this error:

Message    File Name    Line    Position   Traceback                  <module>    <module1>    8          __call__    C:\Python26\lib\site-packages\pyamf-0.4.2-py2.6-win32.egg\pyamf\remoting\client\__init__.py    52          _call    C:\Python26\lib\site-packages\pyamf-0.4.2-py2.6-win32.egg\pyamf\remoting\client\__init__.py    101          execute_single    C:\Python26\lib\site-packages\pyamf-0.4.2-py2.6-win32.egg\pyamf\remoting\client\__init__.py    409          _getResponse    C:\Python26\lib\site-packages\pyamf-0.4.2-py2.6-win32.egg\pyamf\remoting\client\__init__.py    454       RemotingError: HTTP Gateway reported status 404 Not Found               
_______________________________________________
PyAMF users mailing list - users@...
http://lists.pyamf.org/mailman/listinfo/users



_______________________________________________
PyAMF users mailing list - users@...
http://lists.pyamf.org/mailman/listinfo/users

PGP.sig (201 bytes) Download Attachment

Re: Newbie Question

by snorkel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thijs Triemstra | Collab wrote:
> Thanks for catching that Anthony. That howto worked with Pylons 0.9.6
> but returned that 404 with 0.9.7. I updated the howto and it now works
> with both 0.9.6 and 0.9.7 for me.
>
> Cheers,
>
> Thijs
>
Thanks :-)

Works perfectly now.   The turbo gears example does not work with the TG
2.0 release either.
_______________________________________________
PyAMF users mailing list - users@...
http://lists.pyamf.org/mailman/listinfo/users

PyAMF and TurboGears 2 (was Re: Newbie Question)

by lists-144 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Anthony,

On 27 May 2009, at 22:15, Anthony Caduto wrote:

> The turbo gears example does not work with the TG 2.0 release either.

I decided to give it a try and it also didn't work for me without some  
modifications to their example. I created a patch [1] for TG2 that you  
might want to check out if you're interested in using PyAMF with  
TurboGears 2.

[1] http://trac.turbogears.org/attachment/ticket/2332/tg2_pyamf.patch

Thanks,

Thijs


_______________________________________________
PyAMF users mailing list - users@...
http://lists.pyamf.org/mailman/listinfo/users

PGP.sig (201 bytes) Download Attachment