Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[97f053]: examples / web_framework / TurboGears2 / tg2movie / controllers / root.py Maximize Restore History

Download this file

root.py    34 lines (25 with data), 1.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""Main Controller"""
from tg2movie.lib.base import BaseController
from tg import expose, flash
from pylons.i18n import ugettext as _
#from tg import redirect, validate
#from tg2movie.model import DBSession, metadata
#from dbsprockets.dbmechanic.frameworks.tg2 import DBMechanic
#from dbsprockets.saprovider import SAProvider
from tg2movie.model import DBSession
from tg2movie.model import Movie, Director, MovieDirectorLink, Catalog
class RootController(BaseController):
#admin = DBMechanic(SAProvider(metadata), '/admin')
@expose('tg2movie.templates.index')
def index(self):
return dict(page='index')
@expose('tg2movie.templates.about')
def about(self):
return dict(page='about')
@expose('tg2movie.templates.movie')
def movie(self, id):
return dict(m=DBSession.query(Movie).filter(Movie.id==id)[0])
@expose('tg2movie.templates.movie2')
def movie2(self, id):
return dict(m=DBSession.query(Movie).filter(Movie.id==id)[0],
catalog=DBSession.query(Catalog).filter(Catalog.movie_id==id)[:])