i'm not exactly sure what you are trying to do here based on the
description above, so i'm gonna take a guess and see if i can point you in
a helpful direction....
so i use a settings table as well....i like to put it's contents in
memcache to save database reads. my settings pretty rarely change, and are
only about 10 rows so i do something like:
settings = cache.ram('db_settings', lambda:
db(db.settings.id>0).select().as_dict(), time_expire=3600)
note that i use as_dict() since rows objects are not serializable into
memcache.
so then i might:
def controller_method():
settings = cache.ram('db_settings', lambda:
db(db.settings.id>0).select().as_dict(), time_expire=3600)
result = do_something(settings, request.vars.data)
db.results.insert(data=result)
return dict(result=result)
def do_something(settings, data)
...
return result
On Thursday, July 26, 2012 9:32:00 AM UTC-7, Douglas McCormick Jr. wrote:
>
> Hi Everyone,
>
> I have values stored in a web2py table (db.settings) that I'd like to pass
> into python functions to later on (via some processing) get results.
> Here's an example
>
>
> <db.settings>
> ==========================
> | db.settings.id | db.settings.key |
> | ----------------------|------------------------- |
> | 1 | abc |
> | ----------------------|--------------------------|
>
>
> <somepythonscript.py>
> ========================
> def do_something(data):
> ...
> x = something_with_json_fetching(data)
> return x
>
>
>
> I want to grab the "db.settings.key" and push it into my python function
> "do_something" to return the "x" results back to the html.
> The next step (doesn't needed to be answered in this question) I'd like to
> push the x results (which is JSON) into a database table entry...I'm
> working on that part, I think I know what to do there.
>
> Can anyone help me out?
>
> Thanks,
> -Doug Jr.
>
--