Remove throwaway model and view from Paster template.
authorAnt Zucaro <azucaro@gmail.com>
Thu, 31 Mar 2011 21:04:09 +0000 (17:04 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Thu, 31 Mar 2011 21:04:09 +0000 (17:04 -0400)
xonstat/__init__.py
xonstat/models.py
xonstat/views.py

index b9b21bcc100658715721744f70fb943aa5f232b3..9b80fe001308f2d9d3cc50d1d43b341d0572caba 100644 (file)
@@ -10,8 +10,6 @@ def main(global_config, **settings):
     initialize_sql(engine)
     config = Configurator(settings=settings)
     config.add_static_view('static', 'xonstat:static')
-    config.add_route('home', '/', view='xonstat.views.my_view',
-                     view_renderer='templates/mytemplate.pt')
     return config.make_wsgi_app()
 
 
index a036e8c919656c7b6f404b3beec26242a170d710..af908a8bc6be1f8acc275f699dcec35169cb65b0 100644 (file)
@@ -15,28 +15,7 @@ from zope.sqlalchemy import ZopeTransactionExtension
 DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
 Base = declarative_base()
 
-class MyModel(Base):
-    __tablename__ = 'models'
-    id = Column(Integer, primary_key=True)
-    name = Column(Unicode(255), unique=True)
-    value = Column(Integer)
-
-    def __init__(self, name, value):
-        self.name = name
-        self.value = value
-
-def populate():
-    session = DBSession()
-    model = MyModel(name=u'root', value=55)
-    session.add(model)
-    session.flush()
-    transaction.commit()
-    
 def initialize_sql(engine):
     DBSession.configure(bind=engine)
     Base.metadata.bind = engine
     Base.metadata.create_all(engine)
-    try:
-        populate()
-    except IntegrityError:
-        DBSession.rollback()
index d68062e0f05d905fb340c5a17e67deec48700bb7..39a187f3237ecc8264c91b4ac1971220f3328172 100644 (file)
@@ -1,7 +1 @@
 from xonstat.models import DBSession
-from xonstat.models import MyModel
-
-def my_view(request):
-    dbsession = DBSession()
-    root = dbsession.query(MyModel).filter(MyModel.name==u'root').first()
-    return {'root':root, 'project':'XonStat'}