Hi,

I'm currently learning pylons (and python) and would like some help on
a project, I believe I have the right approach but I am not sure of
how the MVC would be structured.


==What I am trying to do==
Let me explain a bit more of what I am trying to do.
Suppose there is a database, exampledb, and I would like to be able to
pull data out of that database (I am using SQLAlchemy and python
MySQL), and display that data on a web page.

At the moment, I am able to display values I pull from the exampledb
database on the console (using a simple controller script below) but I
need some help using it with MVC and displaying on a webpage.


== What I Understand ==
- I understand the controller will call on the models or the views and
return data to the model (please correct if this is wrong).
- The model is where I can put the database connection (for example,
like the script below) and query and store the values into variables.
- Then I would use a MAKO template to display those variables on a
webpage, but I am not sure of how to assign the variables or define
the function in the model/controller.


Can someone assist me with this please? Perhaps provide an example
would be helpful!


== Example of Controller.py ==
from sqlalchemy import *

engine = create_engine('mysql://user:p...@localhost/exampledb
charset=utf8&use_unicode=0')
connection = engine.connect()

result = engine.execute("select field from exampledb")
for row in result:
        print "name:", row['name']
result.close()

:::Note:::this only prints it to console

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to