well, I've imported gluon and created a db object but I can't update values, just select or insert new ones...
Francisco Costa http://franciscocosta.com On Tue, Dec 6, 2011 at 12:36, Roberto De Ioris <[email protected]> wrote: > > > Hi Roberto, > > Is any option for me to pass to the spooler other types than string in > the > > dictionary? > > I really need to have db access in the spooler > > > Use the pickle module and pass the resulting string to an item named > 'body': > > serialized = pickle.dumps(your_complex_structure) > my_function.spool(body=serialized) > > you can then unpickle the body arg in my_function logic. > > By the way, is'nt enough creating a new db object in the spooler to have > access to the web2py DAL ? > > > > > Francisco Costa > > http://franciscocosta.com > > > > > > > > On Sat, Dec 3, 2011 at 13:06, Francisco Costa > > <[email protected]>wrote: > > > >> Thanks for the explanation Roberto, > >> I'm almost there.. Now I have > >> > >> uwsgi --socket :3031 --spooler /home/franciscocosta/spooler --master > >> --processes 4 --import /opt/web2py/applications/app/modules/test.py > >> --module /opt/web2py/web2py.py --pp > >> /opt/web2py/applications/app/modules/ > >> > >> ... > >> > >> managing spool request > >> uwsgi_spoolfile_on_franciscocosta-desktop_3090_32_0_1322916780_5493 ... > >> > >> Traceback (most recent call last): > >> File "/opt/web2py/applications/app/modules/uwsgidecorators.py", line > >> 21, > >> in manage_spool_request > >> ret = spooler_functions[vars['ud_spool_func']](vars) > >> File "/opt/web2py/applications/app/modules/test.py", line 8, in > >> test_function > >> > >> db.person.insert(name = name + str(a)) > >> NameError: global name 'db' is not defined > >> > >> I believe I'm missing to load something (or I'm wrongly loagind in > >> --module) > >> > >> Francisco Costa > >> http://franciscocosta.com > >> > >> > >> > >> > >> On Sat, Dec 3, 2011 at 12:21, Roberto De Ioris <[email protected]> > wrote: > >> > >>> > >>> > Yes, arguments are a dict of strings, but the spooler doesn't process > >>> > automatically > >>> > I tried it manually but I get this > >>> > > >>> > uwsgi --socket :3031 --spooler /home/franciscocosta/spooler --master > >>> > --processes 4 --import /opt/web2py/applications/app/modules/test.py > >>> > --module /opt/web2py/applications/app/modules/uwsgidecorators.py > >>> > *** Starting uWSGI 0.9.9.2 (64bit) on [Sat Dec 3 11:54:35 2011] *** > >>> > compiled with version: 4.6.1 on 04 October 2011 13:08:10 > >>> > detected binary path: /usr/local/bin/uwsgi > >>> > your memory page size is 4096 bytes > >>> > uwsgi socket 0 bound to TCP address :3031 fd 3 > >>> > Python version: 2.7.2+ (default, Oct 4 2011, 20:41:12) [GCC 4.6.1] > >>> > Python main interpreter initialized at 0x230d2e0 > >>> > your server socket listen backlog is limited to 100 connections > >>> > *** Operational MODE: preforking *** > >>> > Traceback (most recent call last): > >>> > File "/opt/web2py/applications/app/modules/test.py", line 1, in > >>> <module> > >>> > from uwsgidecorators import * > >>> > ImportError: No module named uwsgidecorators > >>> > ImportError: Import by filename is not supported. > >>> > >>> > >>> > >>> The problem is here, you do not have to import uwsgidecorators.py in > >>> that > >>> way. > >>> Be sure to have it in the pythonpath (--pp > >>> /opt/web2py/applications/app/modules) and then you use the ---module > >>> directive to load web2py > >>> > >>> So: > >>> > >>> --import -> import the code used by uwsgi api (the spooler in your > >>> case) > >>> --module -> load the webapp (web2py) > >>> --pp -> add a drectory to the pythonpath (you have to be sure that the > >>> directory containing uwsgidecorators.py is added) > >>> > >>> > >>> -- > >>> Roberto De Ioris > >>> http://unbit.it > >>> _______________________________________________ > >>> uWSGI mailing list > >>> [email protected] > >>> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi > >>> > >> > >> > > _______________________________________________ > > uWSGI mailing list > > [email protected] > > http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi > > > > > -- > Roberto De Ioris > http://unbit.it > _______________________________________________ > uWSGI mailing list > [email protected] > http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi >
_______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
