I would suggest only using components in certain situations. For example, if
you wanted to display a dynamically-generated list tags or categories or
users in the sidebar of every page in your site. You could use a component
to load that section discreetly from the rest of the page.
If this is your first time using components, best is to start simple and add
complexity. So just do something like this:
{{=LOAD('components', 'test.load', ajax=True)}}
(same as {{=LOAD('components', 'test', extension='load', ajax=True)}})
(same as {{=LOAD(c='components', f='test', extension='load', ajax=True)}})
And then in "components.py":
def test():
return 'this is a test'
If that works, then maybe hook up a database call. Try one where you don't
have to pass any data to the controller. Just hard code in a db record:
def test():
user = db.auth_user['1']
return dict(user=user)
One trick if your pages use vars or args is to just pass them right through.
For example:
{{=LOAD('components', 'test.load', args=request.args, vars=request.vars,
ajax=True)}}
But looking at your code, I don't think it's a great candidate for
components.