Permalink
Browse files

Split views

  • Loading branch information...
1 parent c9628c1 commit e58100c9899684c60809a53f161294e38a2104b8 @rhaamo committed Jan 11, 2014
@@ -12,7 +12,7 @@
from pyramid.scripts.common import parse_vars
from ..models.meta import (DBSession, Base)
-from ..models import MyModel
+from ..models import (User)
def usage(argv):
@@ -32,6 +32,7 @@ def main(argv=sys.argv):
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)
Base.metadata.create_all(engine)
- with transaction.manager:
- model = MyModel(name='one', value=1)
- DBSession.add(model)
+
+ #with transaction.manager:
+ # model = MyModel(name='one', value=1)
+ # DBSession.add(model)
View
@@ -1,35 +0,0 @@
-from pyramid.response import Response
-from pyramid.view import view_config
-
-from sqlalchemy.exc import DBAPIError
-
-from .models import (
- DBSession,
- MyModel,
- )
-
-
-@view_config(route_name='home', renderer='home.jinja2')
-def my_view(request):
- try:
- one = DBSession.query(MyModel).filter(MyModel.name == 'one').first()
- except DBAPIError:
- return Response(conn_err_msg, content_type='text/plain', status_int=500)
- return {'one': one, 'project': 'codular'}
-
-conn_err_msg = """\
-Pyramid is having a problem using your SQL database. The problem
-might be caused by one of the following things:
-
-1. You may need to run the "initialize_codular_db" script
- to initialize your database tables. Check your virtual
- environment's "bin" directory for this script and try to run it.
-
-2. Your database server may not be running. Check that the
- database server referred to by the "sqlalchemy.url" setting in
- your "development.ini" file is running.
-
-After you fix the problem, please restart the Pyramid application to
-try it again.
-"""
-
@@ -0,0 +1 @@
+# Package
View
@@ -0,0 +1,20 @@
+"""
+Home view
+"""
+from pyramid.response import Response
+from pyramid.view import view_config
+
+from sqlalchemy.exc import DBAPIError
+
+from ..models import (
+ DBSession,
+ User,
+)
+
+"""
+Is : Homepage
+Route : /
+"""
+@view_config(route_name='home', renderer='home/home.jinja2')
+def view_home(request):
+ return {'one': "the one", 'project': 'codular'}
View
@@ -18,6 +18,7 @@
'transaction',
'zope.sqlalchemy',
'waitress',
+ 'cryptacular'
]
setup(name='codular',

0 comments on commit e58100c

Please sign in to comment.