Commits

jvanasco committed 3c3f8e2

restored the earlier paster template
adding mine in under a new namespace

  • Participants
  • Parent commits 0aa4fb1

Comments (0)

Files changed (58)

pyramid_sqla/paster_templates/__init__.py

             # Rename the app logger in the rare case a project is named 'root'
             package_logger = 'app'
         vars['package_logger'] = package_logger
+
+
+class PyramidSQLAQuickstartProjectTemplate(PyramidTemplate):
+    _template_dir = "pyramid_sqla_quickstart"
+    summary = "Pyramid SQLAlchemy Quickstart project with view handlers"
+    template_renderer = staticmethod(paste_script_template_renderer)
+
+    def pre(self, command, output_dir, vars): # pragma: no cover
+        """Called before template is applied."""
+        PyramidTemplate.pre(self, command, output_dir, vars)
+        package_logger = vars['package']
+        if package_logger == 'root':
+            # Rename the app logger in the rare case a project is named 'root'
+            package_logger = 'app'
+        vars['package_logger'] = package_logger

pyramid_sqla/paster_templates/pyramid_sqla/+package+/__init__.py_tmpl

 from pyramid.config import Configurator
 import pyramid_beaker
-import pyramid_handlers
 import pyramid_sqla
 
-from {{package}}.handlers import add_handlers
-
 def main(global_config, **settings):
     """ This function returns a Pyramid WSGI application.
     """
     config.add_subscriber('{{package}}.subscribers.add_renderer_globals',
                           'pyramid.events.BeforeRender')
 
-
-    # set up handlers
-    config.include(add_handlers)
-    
-    # scan packages
-    config.scan('{{package}}')
-
+    # Set up routes and views
+    config.add_handler('home', '/', '{{package}}.handlers:MainHandler',
+                       action='index')
+    config.add_handler('main', '/{action}', '{{package}}.handlers:MainHandler',
+        path_info=r'/(?!favicon\.ico|robots\.txt|w3c)')
+    config.add_static_route('{{package}}', 'static', cache_max_age=3600)
 
     return config.make_wsgi_app()

pyramid_sqla/paster_templates/pyramid_sqla/+package+/handlers.py_tmpl

+import logging
+
+from pyramid_handlers import action
+
+#from {{package}}.models import MyModel
+
+log = logging.getLogger(__name__)
+
+class MainHandler(object):
+    def __init__(self, request):
+        self.request = request
+
+    @action(renderer='index.html')
+    def index(self):
+        log.debug("testing logging; entered MainHandler.index()")
+        return {'project':'{{package}}'}

pyramid_sqla/paster_templates/pyramid_sqla/+package+/handlers/__init__.py_tmpl

-import logging
-
-
-log = logging.getLogger(__name__)
-
-from {{package}}.handlers.main import *
-
-def add_handlers(config):
-    # Set up routes and views
-
-    config.add_handler('home', '/', '{{package}}.handlers.main:MainHandler',
-                       action='index')
-
-    config.add_handler('account-index', '/account/', '{{package}}.handlers.account:AccountHandler', action='index')
-    config.add_handler('account', '/account/{action}', '{{package}}.handlers.account:AccountHandler')
-
-
-    config.add_handler('main', '/{action}', '{{package}}.handlers.main:MainHandler',
-        path_info=r'/(?!favicon\.ico|robots\.txt|w3c)')
-

pyramid_sqla/paster_templates/pyramid_sqla/+package+/handlers/account.py_tmpl

-import logging
-
-from pyramid_handlers import action
-
-from pyramid.renderers import render_to_response
-from pyramid.httpexceptions import HTTPFound
-
-import {{package}}
-from {{package}}.handlers.base import BaseHandler
-
-
-#from {{package}}.models import MyModel
-
-log = logging.getLogger(__name__)
-
-
-class AccountHandler(BaseHandler):
-
-
-
-    def index(self):
-        log.debug("testing logging; entered AccountHandler.index()")
-        return HTTPFound(location='/account/login')
-
-
-
-    def login(self):
-        log.debug("testing logging; entered AccountHandler.login()")
-        
-        # http://docs.pylonsproject.org/projects/pyramid/dev/narr/webob.html#request
-        if self.request.method == 'POST' :
-            {{package}}.helpers.do_login()
-            return HTTPFound(location='/account/home')
-            
-        return render_to_response('/account/login/form.mako', {'project':'{{package}}'}, self.request) 
-
-
-
-    def logout(self):
-        log.debug("testing logging; entered AccountHandler.logout()")
-        {{package}}.helpers.do_logout()
-        return HTTPFound(location='/')
-
-
-
-    @action(renderer='/account/home.mako')
-    def home(self):
-        log.debug("testing logging; entered AccountHandler.home()")
-        if not {{package}}.helpers.is_logged_in() :
-            return HTTPFound(location='/account/login')
-        return {'project':'{{package}}'}
-
-
-

pyramid_sqla/paster_templates/pyramid_sqla/+package+/handlers/base.py_tmpl

-import logging
-
-log = logging.getLogger(__name__)
-
-
-class BaseHandler(object):
-    def __init__(self, request):
-        self.request = request
-        self.c = self.request.tmpl_context

pyramid_sqla/paster_templates/pyramid_sqla/+package+/handlers/main.py_tmpl

-import logging
-
-from pyramid_handlers import action
-from pyramid.renderers import render_to_response
-from {{package}}.handlers.base import BaseHandler
-
-#from {{package}}.models import MyModel
-
-log = logging.getLogger(__name__)
-
-
-class MainHandler(BaseHandler):
-
-
-    @action(renderer='default-pylons.html')
-    def index(self):
-        log.debug("testing logging; entered MainHandler.index()")
-        return {'project':'{{package}}'}
-
-
-
-    def index_alt(self): 
-        log.debug("testing logging; entered MainHandler.index_alt()")
-        old= self.request.params.get('old')
-        if old:
-            return render_to_response('default-pylons.html', {'project':'{{package}}'}, self.request) 
-        return render_to_response('index.mako', {'project':'{{package}}'}, self.request) 
-            

pyramid_sqla/paster_templates/pyramid_sqla/+package+/helpers.py

+"""Helper functions
+
+This module is available as the ``h`` variable in templates, and can also be
+imported into handler modules or elsewhere. Put any common functions you want
+to access in all templates here.
+
+The WebHelpers package (http://python.org/pypi/WebHelpers) contains some
+commonly used helpers for HTML tag creation, text formatting, number
+formatting, etc.
+
+The template globals (``h`` et al) are set in
+``{{package}}.subscribers.add_renderer_globals()``.
+"""
+
+#from webhelpers.html import *
+#from webhelpers.html.tags import *

pyramid_sqla/paster_templates/pyramid_sqla/+package+/helpers/__init__.py

-"""Helper functions
-
-This module is available as the ``h`` variable in templates, and can also be
-imported into handler modules or elsewhere. Put any common functions you want
-to access in all templates here.
-
-The WebHelpers package (http://python.org/pypi/WebHelpers) contains some
-commonly used helpers for HTML tag creation, text formatting, number
-formatting, etc.
-
-The template globals (``h`` et al) are set in
-``{{package}}.subscribers.add_renderer_globals()``.
-"""
-
-#from webhelpers.html import *
-#from webhelpers.html.tags import *
-
-from pyramid.threadlocal import get_current_request
-
-def do_login():
-    session= get_current_request().session
-    session['logged_in']= True
-    
-def do_logout():
-    session= get_current_request().session
-    if 'logged_in' in session :
-        del session['logged_in']
-
-def is_logged_in():
-    session= get_current_request().session
-    if not session:
-        return False
-    if 'logged_in' in session and session['logged_in']:
-        return session['logged_in']
-    return False

pyramid_sqla/paster_templates/pyramid_sqla/+package+/models.py

+import logging
+
+import pyramid_sqla as psa
+import sqlalchemy as sa
+import sqlalchemy.orm as orm
+import transaction
+
+log = logging.getLogger(__name__)
+
+Base = psa.get_base()
+Session = psa.get_session()
+
+
+#class MyModel(Base):
+#    __tablename__ = 'models'
+#
+#    id = sa.Column(sa.Integer, primary_key=True)
+#    name = sa.Column(sa.Unicode(255), nullable=False)

pyramid_sqla/paster_templates/pyramid_sqla/+package+/models/__ini__.py

-import logging
-
-import pyramid_sqla as psa
-import sqlalchemy as sa
-import sqlalchemy.orm as orm
-import transaction
-
-log = logging.getLogger(__name__)
-
-Base = psa.get_base()
-Session = psa.get_session()
-
-
-#class MyModel(Base):
-#    __tablename__ = 'models'
-#
-#    id = sa.Column(sa.Integer, primary_key=True)
-#    name = sa.Column(sa.Unicode(255), nullable=False)

pyramid_sqla/paster_templates/pyramid_sqla/+package+/static/stylesheets/global.css

-body {
-	font-size: 20px;
-	font-family: Georgia, Times, Times New Roman, serif;
-	font-weight: bold;
-}

pyramid_sqla/paster_templates/pyramid_sqla/+package+/static/stylesheets/ie6.css

Empty file removed.

pyramid_sqla/paster_templates/pyramid_sqla/+package+/static/stylesheets/ie7.css

Empty file removed.

pyramid_sqla/paster_templates/pyramid_sqla/+package+/static/stylesheets/ie8.css

Empty file removed.

pyramid_sqla/paster_templates/pyramid_sqla/+package+/subscribers.py_tmpl

-# -*- coding: utf-8 -*- 
 from pyramid.threadlocal import get_current_request
 from pyramid.exceptions import ConfigurationError
 from pyramid.url import route_url
-from pyramid.url import current_route_url
-from pyramid.i18n import get_localizer
-from pyramid.i18n import TranslationStringFactory
 
 import {{package}}.helpers as helpers
 
         request = get_current_request()
     globs = {
         'url': route_url,
-        'current_url': current_route_url,
         'h': helpers,
         }
     if request is not None:
         tmpl_context = request.tmpl_context
         globs['c'] = tmpl_context
         globs['tmpl_context'] = tmpl_context
-        globs['_'] = request.translate
-        globs['localizer'] = request.localizer
         try:
             globs['session'] = request.session
         except ConfigurationError:
             pass
     event.update(globs)
 
-tsf = TranslationStringFactory('{{package}}')
 
-def add_localizer(event):
-    request = event.request
-    localizer = get_localizer(request)
-    def auto_translate(string):
-        return localizer.translate(tsf(string))
-    request.localizer = localizer
-    request.translate = auto_translate

pyramid_sqla/paster_templates/pyramid_sqla/+package+/templates/@site-template-modules/footer.mako

-<div id="footer"></div>

pyramid_sqla/paster_templates/pyramid_sqla/+package+/templates/@site-template-modules/header.mako

-<div id="header"></div>

pyramid_sqla/paster_templates/pyramid_sqla/+package+/templates/@site-template-modules/html_head.mako

-<title></title>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
-<meta name="title" content="" />
-<meta name="description" content="" />
-<meta name="keywords" content="" />
-
-<style type="text/css">
-	@import url("/stylesheets/global.css");
-</style>
-	<!--[if IE 6]>
-		<link rel="stylesheet" type="text/css" href="/stylesheets/ie6.css" />
-	<![endif]-->
-	<!--[if IE 7]>
-		<link rel="stylesheet" type="text/css" href="/stylesheets/ie7.css" />
-	<![endif]-->    
-	<!--[if IE 8]>
-		<link rel="stylesheet" type="text/css" href="/stylesheets/ie8.css" />
-	<![endif]-->
-

pyramid_sqla/paster_templates/pyramid_sqla/+package+/templates/@site-template.mako

-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:fb="http://www.facebook.com/2008/fbml">
-<head><%include file="/@site-template-modules/html_head.mako"/></head>
-<body>
-	<%include file="/@site-template-modules/header.mako"/>
-	<div class="main">
-		${next.body()}
-	</div>
-	<div class="clearboth"></div>
-	<%include file="/@site-template-modules/footer.mako"/>
-</body>
-</html>

pyramid_sqla/paster_templates/pyramid_sqla/+package+/templates/account/home.mako

-<%inherit file="/@site-template.mako"/> 
-
-home

pyramid_sqla/paster_templates/pyramid_sqla/+package+/templates/account/login/form.mako

-<%inherit file="/@site-template.mako"/> 
-
-<h2>Login</h2>
-<form action="/account/login" method="POST">
-	<label>name</label>
-	<input type="text" name="name" />
-	<br/>
-	<label>password</label>
-	<input type="password" name="password" />
-	<br/>
-	<input type="submit" name="submit" value="submit"/>
-</form>

pyramid_sqla/paster_templates/pyramid_sqla/+package+/templates/default-pylons.html

-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
-<head>
-	<title>The Pyramid Web Application Development Framework</title>
-	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
-	<meta name="keywords" content="python web application" />
-	<meta name="description" content="pyramid web application" />
-	<link rel="shortcut icon" href="${request.application_url}/favicon.ico" />
-	<link rel="stylesheet" href="${request.application_url}/stylesheets/pylons.css" type="text/css" media="screen" charset="utf-8" />
-	<!-- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" /> -->
-	<!--[if !IE 7]>
-	<style type="text/css">
-		#wrap {display:table;height:100%}
-	</style>
-	<![endif]-->
-</head>
-<body>
-	<div id="wrap">
-		<div id="header">
-			<div class="header">The Pyramid Web Application Development Framework</div>
-		</div>
-		<div id="top">
-			<div class="top align-center">
-				<img src="${request.application_url}/images/logo.png" width="300" height="80"/>
-				<p class="app-welcome">
-					Welcome to <span class="app-name">${project}</span>, an application generated by<br/>
-					the Pyramid web application development framework.
-				</p>
-			</div>
-		</div>
-		<div id="bottom">
-			<div class="bottom">
-				<div id="left" class="align-right">
-					<h3>Search Pyramid documentation</h3>
-					<form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
-                        <div>
-                            <input type="text" id="q" name="q" value="" />
-                            <input type="submit" id="x" value="Search" />
-                        </div>
-		  			</form>
-				</div>
-				<div id="right" class="align-left">
-					<h3>Pyramid links</h3>
-					<ul class="links">
-						<li>
-							<a href="http://pylonshq.com">Pylons Website</a>
-						</li>
-						<li>
-							<a href="http://docs.pylonshq.com/">The Pylons Project Documentation</a>
-						</li>
-						<li>
-							<a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
-						</li>
-						<li>
-							<a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
-						</li>
-						<li>
-							<a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
-						</li>
-						<li>
-							<a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
-						</li>
-						<li>
-							<a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
-						</li>
-						<li>
-							<a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
-						</li>
-						<li>
-							<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
-						</li>
-		  			</ul>
-				</div>
-			</div>
-		</div>
-	</div>
-	<div id="footer">
-		<div class="footer">Pyramid is copyright © 2008-2010, Agendaless Consulting.</div>
-	</div>
-</body>
-</html>

pyramid_sqla/paster_templates/pyramid_sqla/+package+/templates/index.html

+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+	<title>The Pyramid Web Application Development Framework</title>
+	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+	<meta name="keywords" content="python web application" />
+	<meta name="description" content="pyramid web application" />
+	<link rel="shortcut icon" href="${request.application_url}/favicon.ico" />
+	<link rel="stylesheet" href="${request.application_url}/stylesheets/pylons.css" type="text/css" media="screen" charset="utf-8" />
+	<!-- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" /> -->
+	<!--[if !IE 7]>
+	<style type="text/css">
+		#wrap {display:table;height:100%}
+	</style>
+	<![endif]-->
+</head>
+<body>
+	<div id="wrap">
+		<div id="header">
+			<div class="header">The Pyramid Web Application Development Framework</div>
+		</div>
+		<div id="top">
+			<div class="top align-center">
+				<img src="${request.application_url}/images/logo.png" width="300" height="80"/>
+				<p class="app-welcome">
+					Welcome to <span class="app-name">${project}</span>, an application generated by<br/>
+					the Pyramid web application development framework.
+				</p>
+			</div>
+		</div>
+		<div id="bottom">
+			<div class="bottom">
+				<div id="left" class="align-right">
+					<h3>Search Pyramid documentation</h3>
+					<form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+                        <div>
+                            <input type="text" id="q" name="q" value="" />
+                            <input type="submit" id="x" value="Search" />
+                        </div>
+		  			</form>
+				</div>
+				<div id="right" class="align-left">
+					<h3>Pyramid links</h3>
+					<ul class="links">
+						<li>
+							<a href="http://pylonshq.com">Pylons Website</a>
+						</li>
+						<li>
+							<a href="http://docs.pylonshq.com/">The Pylons Project Documentation</a>
+						</li>
+						<li>
+							<a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+						</li>
+						<li>
+							<a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+						</li>
+						<li>
+							<a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+						</li>
+						<li>
+							<a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+						</li>
+						<li>
+							<a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+						</li>
+						<li>
+							<a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+						</li>
+						<li>
+							<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
+						</li>
+		  			</ul>
+				</div>
+			</div>
+		</div>
+	</div>
+	<div id="footer">
+		<div class="footer">Pyramid is copyright © 2008-2010, Agendaless Consulting.</div>
+	</div>
+</body>
+</html>

pyramid_sqla/paster_templates/pyramid_sqla/+package+/templates/index.mako

-<%inherit file="/@site-template.mako"/> 
-
-index

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/__init__.py_tmpl

+from pyramid.config import Configurator
+import pyramid_beaker
+import pyramid_handlers
+import pyramid_sqla
+
+from {{package}}.handlers import add_handlers
+
+def main(global_config, **settings):
+    """ This function returns a Pyramid WSGI application.
+    """
+    config = Configurator(settings=settings)
+    config.include('pyramid_handlers')
+    config.include('pyramid_sqla')
+
+    # Initialize database
+    pyramid_sqla.add_engine(settings, prefix='sqlalchemy.')
+
+    # Configure Beaker sessions
+    session_factory = pyramid_beaker.session_factory_from_settings(settings)
+    config.set_session_factory(session_factory)
+
+    # Configure renderers
+    config.add_renderer('.html', 'pyramid.mako_templating.renderer_factory')
+    config.add_subscriber('{{package}}.subscribers.add_renderer_globals',
+                          'pyramid.events.BeforeRender')
+
+
+    # set up handlers
+    config.include(add_handlers)
+    
+    # scan packages
+    config.scan('{{package}}')
+
+
+    return config.make_wsgi_app()

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/handlers/__init__.py_tmpl

+import logging
+
+
+log = logging.getLogger(__name__)
+
+from {{package}}.handlers.main import *
+
+def add_handlers(config):
+    # Set up routes and views
+
+    config.add_handler('home', '/', '{{package}}.handlers.main:MainHandler',
+                       action='index')
+
+    config.add_handler('account-index', '/account/', '{{package}}.handlers.account:AccountHandler', action='index')
+    config.add_handler('account', '/account/{action}', '{{package}}.handlers.account:AccountHandler')
+
+
+    config.add_handler('main', '/{action}', '{{package}}.handlers.main:MainHandler',
+        path_info=r'/(?!favicon\.ico|robots\.txt|w3c)')
+

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/handlers/account.py_tmpl

+import logging
+
+from pyramid_handlers import action
+
+from pyramid.renderers import render_to_response
+from pyramid.httpexceptions import HTTPFound
+
+import {{package}}
+from {{package}}.handlers.base import BaseHandler
+
+
+#from {{package}}.models import MyModel
+
+log = logging.getLogger(__name__)
+
+
+class AccountHandler(BaseHandler):
+
+
+
+    def index(self):
+        log.debug("testing logging; entered AccountHandler.index()")
+        return HTTPFound(location='/account/login')
+
+
+
+    def login(self):
+        log.debug("testing logging; entered AccountHandler.login()")
+        
+        # http://docs.pylonsproject.org/projects/pyramid/dev/narr/webob.html#request
+        if self.request.method == 'POST' :
+            {{package}}.helpers.do_login()
+            return HTTPFound(location='/account/home')
+            
+        return render_to_response('/account/login/form.mako', {'project':'{{package}}'}, self.request) 
+
+
+
+    def logout(self):
+        log.debug("testing logging; entered AccountHandler.logout()")
+        {{package}}.helpers.do_logout()
+        return HTTPFound(location='/')
+
+
+
+    @action(renderer='/account/home.mako')
+    def home(self):
+        log.debug("testing logging; entered AccountHandler.home()")
+        if not {{package}}.helpers.is_logged_in() :
+            return HTTPFound(location='/account/login')
+        return {'project':'{{package}}'}
+
+
+

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/handlers/base.py_tmpl

+import logging
+
+log = logging.getLogger(__name__)
+
+
+class BaseHandler(object):
+    def __init__(self, request):
+        self.request = request
+        self.c = self.request.tmpl_context

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/handlers/main.py_tmpl

+import logging
+
+from pyramid_handlers import action
+from pyramid.renderers import render_to_response
+from {{package}}.handlers.base import BaseHandler
+
+#from {{package}}.models import MyModel
+
+log = logging.getLogger(__name__)
+
+
+class MainHandler(BaseHandler):
+
+
+    @action(renderer='default-pylons.html')
+    def index(self):
+        log.debug("testing logging; entered MainHandler.index()")
+        return {'project':'{{package}}'}
+
+
+
+    def index_alt(self): 
+        log.debug("testing logging; entered MainHandler.index_alt()")
+        old= self.request.params.get('old')
+        if old:
+            return render_to_response('default-pylons.html', {'project':'{{package}}'}, self.request) 
+        return render_to_response('index.mako', {'project':'{{package}}'}, self.request) 
+            

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/helpers/__init__.py

+"""Helper functions
+
+This module is available as the ``h`` variable in templates, and can also be
+imported into handler modules or elsewhere. Put any common functions you want
+to access in all templates here.
+
+The WebHelpers package (http://python.org/pypi/WebHelpers) contains some
+commonly used helpers for HTML tag creation, text formatting, number
+formatting, etc.
+
+The template globals (``h`` et al) are set in
+``{{package}}.subscribers.add_renderer_globals()``.
+"""
+
+#from webhelpers.html import *
+#from webhelpers.html.tags import *
+
+from pyramid.threadlocal import get_current_request
+
+def do_login():
+    session= get_current_request().session
+    session['logged_in']= True
+    
+def do_logout():
+    session= get_current_request().session
+    if 'logged_in' in session :
+        del session['logged_in']
+
+def is_logged_in():
+    session= get_current_request().session
+    if not session:
+        return False
+    if 'logged_in' in session and session['logged_in']:
+        return session['logged_in']
+    return False

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/models/__init__.py

+import logging
+
+import pyramid_sqla as psa
+import sqlalchemy as sa
+import sqlalchemy.orm as orm
+import transaction
+
+log = logging.getLogger(__name__)
+
+Base = psa.get_base()
+Session = psa.get_session()
+
+
+#class MyModel(Base):
+#    __tablename__ = 'models'
+#
+#    id = sa.Column(sa.Integer, primary_key=True)
+#    name = sa.Column(sa.Unicode(255), nullable=False)

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/scripts/__init__.py

Empty file added.

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/scripts/create_db.py_tmpl

+"""Create the application's database.
+
+Run this once after installing the application::
+
+    python -m {{package}}.scripts.create_db development.ini
+"""
+import logging.config
+import sys
+
+from pyramid.paster import get_app
+import transaction
+
+import {{package}}.models as models
+
+def main():
+    if len(sys.argv) != 2:
+        sys.exit("Usage: python -m {{package}}.scripts.create_db INI_FILE")
+    ini_file = sys.argv[1]
+    logging.config.fileConfig(ini_file)
+    log = logging.getLogger(__name__)
+    app = get_app(ini_file, "{{project}}")
+    #settings = app.registry.settings
+
+    # Abort if any tables exist to prevent accidental overwriting
+    for table in models.Base.metadata.sorted_tables:
+        log.debug("checking if table '%s' exists", table.name)
+        if table.exists():
+            raise RuntimeError("database table '%s' exists" % table.name)
+
+    # Create the tables
+    models.Base.metadata.create_all()
+    sess = models.Session()
+
+    # Record 1
+    #p = models.MyModel(id=1, name=u"Foo Bar")
+    #sess.add(p)
+
+    transaction.commit()
+
+    
+
+if __name__ == "__main__":  
+    main()

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/static/favicon.ico

Binary file added.

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/static/images/logo.png

Added
New image

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/static/stylesheets/global.css

+body {
+	font-size: 20px;
+	font-family: Georgia, Times, Times New Roman, serif;
+	font-weight: bold;
+}

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/static/stylesheets/ie6.css

Empty file added.

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/static/stylesheets/ie7.css

Empty file added.

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/static/stylesheets/ie8.css

Empty file added.

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/static/stylesheets/pylons.css

+html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;/* 16px */
+vertical-align:baseline;background:transparent;}
+body{line-height:1;}
+ol,ul{list-style:none;}
+blockquote,q{quotes:none;}
+blockquote:before,blockquote:after,q:before,q:after{content:'';content:none;}
+/* remember to define focus styles! */
+:focus{outline:0;}
+/* remember to highlight inserts somehow! */
+ins{text-decoration:none;}
+del{text-decoration:line-through;}
+/* tables still need 'cellspacing="0"' in the markup */
+table{border-collapse:collapse;border-spacing:0;}
+/* restyling */
+sub{vertical-align:sub;font-size:smaller;line-height:normal;}
+sup{vertical-align:super;font-size:smaller;line-height:normal;}
+/* lists */
+ul,menu,dir{display:block;list-style-type:disc;margin:1em 0;padding-left:40px;}
+ol{display:block;list-style-type:decimal-leading-zero;margin:1em 0;padding-left:40px;}
+li{display:list-item;}
+/* nested lists have no top/bottom margins */
+ul ul,ul ol,ul dir,ul menu,ul dl,ol ul,ol ol,ol dir,ol menu,ol dl,dir ul,dir ol,dir dir,dir menu,dir dl,menu ul,menu ol,menu dir,menu menu,menu dl,dl ul,dl ol,dl dir,dl menu,dl dl{margin-top:0;margin-bottom:0;}
+/* 2 deep unordered lists use a circle */
+ol ul,ul ul,menu ul,dir ul,ol menu,ul menu,menu menu,dir menu,ol dir,ul dir,menu dir,dir dir{list-style-type:circle;}
+/* 3 deep (or more) unordered lists use a square */
+ol ol ul,ol ul ul,ol menu ul,ol dir ul,ol ol menu,ol ul menu,ol menu menu,ol dir menu,ol ol dir,ol ul dir,ol menu dir,ol dir dir,ul ol ul,ul ul ul,ul menu ul,ul dir ul,ul ol menu,ul ul menu,ul menu menu,ul dir menu,ul ol dir,ul ul dir,ul menu dir,ul dir dir,menu ol ul,menu ul ul,menu menu ul,menu dir ul,menu ol menu,menu ul menu,menu menu menu,menu dir menu,menu ol dir,menu ul dir,menu menu dir,menu dir dir,dir ol ul,dir ul ul,dir menu ul,dir dir ul,dir ol menu,dir ul menu,dir menu menu,dir dir menu,dir ol dir,dir ul dir,dir menu dir,dir dir dir{list-style-type:square;}
+.hidden{display:none;}
+p{line-height:1.5em;}
+h1{font-size:1.75em;/* 28px */
+line-height:1.7em;font-family:helvetica,verdana;}
+h2{font-size:1.5em;/* 24px */
+line-height:1.7em;font-family:helvetica,verdana;}
+h3{font-size:1.25em;/* 20px */
+line-height:1.7em;font-family:helvetica,verdana;}
+h4{font-size:1em;line-height:1.7em;font-family:helvetica,verdana;}
+html,body{width:100%;height:100%;}
+body{margin:0;padding:0;background-color:#ffffff;position:relative;font:16px/24px "Nobile","Lucida Grande",Lucida,Verdana,sans-serif;}
+a{color:#1b61d6;text-decoration:none;}
+a:hover{color:#e88f00;text-decoration:underline;}
+body h1,
+body h2,
+body h3,
+body h4,
+body h5,
+body h6{font-family:"Nobile","Lucida Grande",Lucida,Verdana,sans-serif;font-weight:normal;color:#144fb2;font-style:normal;}
+#wrap {min-height: 100%;}
+#header,#footer{width:100%;color:#ffffff;height:40px;position:absolute;text-align:center;line-height:40px;overflow:hidden;font-size:12px;}
+#header{background-color:#e88f00;top:0;font-size:14px;}
+#footer{background-color:#000000;bottom:0;position: relative;margin-top:-40px;clear:both;}
+.header,.footer{width:700px;margin-right:auto;margin-left:auto;}
+.wrapper{width:100%}
+#top,#bottom{width:100%;}
+#top{color:#888;background-color:#eee;height:300px;border-bottom:2px solid #ddd;margin-bottom:10px;}
+#bottom{color:#222;background-color:#ffffff;overflow:hidden;}
+.top,.bottom{width:700px;margin-right:auto;margin-left:auto;}
+.top{padding-top:100px;}
+.app-welcome{margin-top:25px;}
+.app-name{color:#000000;font-weight:bold;}
+/*.bottom{padding-top:50px;}*/
+.text{font-size:80%;color:#444444;margin:20px 0;text-align:center;}
+#left{width:325px;float:left;padding-right:25px;}
+#right{width:325px;float:right;padding-left:25px;}
+.align-left{text-align:left;}
+.align-right{text-align:right;}
+.align-center{text-align:center;}
+ul.links{margin:0;padding:0;}
+ul.links li{list-style-type:none;font-size:14px;}
+form{border-style:none;}
+fieldset{border-style:none;}
+input{color:#222;border:1px solid #ccc;font-family:sans-serif;font-size:12px;line-height:16px;}
+input[type=text]{}
+input[type=submit]{background-color:#ddd;font-weight:bold;}
+/*Opera Fix*/
+body:before {content:"";height:100%;float:left;width:0;margin-top:-32767px;}

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/subscribers.py_tmpl

+# -*- coding: utf-8 -*- 
+from pyramid.threadlocal import get_current_request
+from pyramid.exceptions import ConfigurationError
+from pyramid.url import route_url
+from pyramid.url import current_route_url
+from pyramid.i18n import get_localizer
+from pyramid.i18n import TranslationStringFactory
+
+import {{package}}.helpers as helpers
+
+def add_renderer_globals(event):
+    """ A subscriber to the ``pyramid.events.BeforeRender`` events.  Updates
+    the :term:`renderer globals` with values that are familiar to Pylons
+    users."""
+    request = event.get('request')
+    if request is None:
+        request = get_current_request()
+    globs = {
+        'url': route_url,
+        'current_url': current_route_url,
+        'h': helpers,
+        }
+    if request is not None:
+        tmpl_context = request.tmpl_context
+        globs['c'] = tmpl_context
+        globs['tmpl_context'] = tmpl_context
+        globs['_'] = request.translate
+        globs['localizer'] = request.localizer
+        try:
+            globs['session'] = request.session
+        except ConfigurationError:
+            pass
+    event.update(globs)
+
+tsf = TranslationStringFactory('{{package}}')
+
+def add_localizer(event):
+    request = event.request
+    localizer = get_localizer(request)
+    def auto_translate(string):
+        return localizer.translate(tsf(string))
+    request.localizer = localizer
+    request.translate = auto_translate

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/templates/@site-template-modules/footer.mako

+<div id="footer"></div>

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/templates/@site-template-modules/header.mako

+<div id="header"></div>

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/templates/@site-template-modules/html_head.mako

+<title></title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<meta name="title" content="" />
+<meta name="description" content="" />
+<meta name="keywords" content="" />
+
+<style type="text/css">
+	@import url("/stylesheets/global.css");
+</style>
+	<!--[if IE 6]>
+		<link rel="stylesheet" type="text/css" href="/stylesheets/ie6.css" />
+	<![endif]-->
+	<!--[if IE 7]>
+		<link rel="stylesheet" type="text/css" href="/stylesheets/ie7.css" />
+	<![endif]-->    
+	<!--[if IE 8]>
+		<link rel="stylesheet" type="text/css" href="/stylesheets/ie8.css" />
+	<![endif]-->
+

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/templates/@site-template.mako

+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:fb="http://www.facebook.com/2008/fbml">
+<head><%include file="/@site-template-modules/html_head.mako"/></head>
+<body>
+	<%include file="/@site-template-modules/header.mako"/>
+	<div class="main">
+		${next.body()}
+	</div>
+	<div class="clearboth"></div>
+	<%include file="/@site-template-modules/footer.mako"/>
+</body>
+</html>

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/templates/account/home.mako

+<%inherit file="/@site-template.mako"/> 
+
+home

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/templates/account/login/form.mako

+<%inherit file="/@site-template.mako"/> 
+
+<h2>Login</h2>
+<form action="/account/login" method="POST">
+	<label>name</label>
+	<input type="text" name="name" />
+	<br/>
+	<label>password</label>
+	<input type="password" name="password" />
+	<br/>
+	<input type="submit" name="submit" value="submit"/>
+</form>

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/templates/default-pylons.html

+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+	<title>The Pyramid Web Application Development Framework</title>
+	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+	<meta name="keywords" content="python web application" />
+	<meta name="description" content="pyramid web application" />
+	<link rel="shortcut icon" href="${request.application_url}/favicon.ico" />
+	<link rel="stylesheet" href="${request.application_url}/stylesheets/pylons.css" type="text/css" media="screen" charset="utf-8" />
+	<!-- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" /> -->
+	<!--[if !IE 7]>
+	<style type="text/css">
+		#wrap {display:table;height:100%}
+	</style>
+	<![endif]-->
+</head>
+<body>
+	<div id="wrap">
+		<div id="header">
+			<div class="header">The Pyramid Web Application Development Framework</div>
+		</div>
+		<div id="top">
+			<div class="top align-center">
+				<img src="${request.application_url}/images/logo.png" width="300" height="80"/>
+				<p class="app-welcome">
+					Welcome to <span class="app-name">${project}</span>, an application generated by<br/>
+					the Pyramid web application development framework.
+				</p>
+			</div>
+		</div>
+		<div id="bottom">
+			<div class="bottom">
+				<div id="left" class="align-right">
+					<h3>Search Pyramid documentation</h3>
+					<form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+                        <div>
+                            <input type="text" id="q" name="q" value="" />
+                            <input type="submit" id="x" value="Search" />
+                        </div>
+		  			</form>
+				</div>
+				<div id="right" class="align-left">
+					<h3>Pyramid links</h3>
+					<ul class="links">
+						<li>
+							<a href="http://pylonshq.com">Pylons Website</a>
+						</li>
+						<li>
+							<a href="http://docs.pylonshq.com/">The Pylons Project Documentation</a>
+						</li>
+						<li>
+							<a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+						</li>
+						<li>
+							<a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+						</li>
+						<li>
+							<a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+						</li>
+						<li>
+							<a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+						</li>
+						<li>
+							<a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+						</li>
+						<li>
+							<a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+						</li>
+						<li>
+							<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
+						</li>
+		  			</ul>
+				</div>
+			</div>
+		</div>
+	</div>
+	<div id="footer">
+		<div class="footer">Pyramid is copyright © 2008-2010, Agendaless Consulting.</div>
+	</div>
+</body>
+</html>

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/templates/index.mako

+<%inherit file="/@site-template.mako"/> 
+
+index

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/+package+/tests.py_tmpl

+import unittest
+
+class MyHandlerTests(unittest.TestCase):
+    def setUp(self):
+        from pyramid.config import Configurator
+        import pyramid_sqla
+        self.engine = pyramid_sqla.add_engine(url='sqlite://')
+        self.session = pyramid_sqla.get_session()()
+        self.config = Configurator(autocommit=True)
+        self.config.begin()
+        # Must call ``self.config.begin()`` in tests before using config.
+
+    def tearDown(self):
+        import pyramid_sqla
+        self.config.end()
+        # After calling ``self.config.end()``, don't use config.
+        self.session = None
+        pyramid_sqla.reset()
+
+    def _makeOne(self, request):
+        from {{package}}.handlers import MainHandler
+        return MainHandler(request)
+
+    def test_index(self):
+        request = DummyRequest()
+        handler = self._makeOne(request)
+        info = handler.index()
+        self.assertEqual(info['project'], '{{package}}')
+
+class DummyRequest(object):
+    pass

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/CHANGES.txt_tmpl

+0.0
+---
+
+-  Initial version

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/README.txt_tmpl

+{{project}} README
+
+
+

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/development.ini_tmpl

+[app:{{project}}]
+use = egg:{{project}}
+reload_templates = true
+debug_authorization = false
+debug_notfound = false
+debug_routematch = false
+debug_templates = true
+default_locale_name = en
+mako.directories = {{package}}:templates
+sqlalchemy.url = sqlite:///%(here)s/db.sqlite
+session.type = file
+session.data_dir = %(here)s/data/sessions/data
+session.lock_dir = %(here)s/data/sessions/lock
+session.key = {{project}}
+session.secret = {{random_string}}
+
+
+[filter:tm]
+use = egg:repoze.tm2#tm
+commit_veto = repoze.tm:default_commit_veto
+
+[pipeline:main]
+pipeline =
+    egg:WebError#evalerror
+    tm
+    {{project}}
+
+[server:main]
+use = egg:Paste#http
+host = 127.0.0.1
+port = 5000
+
+# Begin logging configuration
+
+[loggers]
+keys = root, {{package_logger}}, sqlalchemy
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = INFO
+handlers = console
+
+[logger_{{package_logger}}]
+level = DEBUG
+handlers =
+qualname = {{package}}
+
+[logger_sqlalchemy]
+level = INFO
+handlers =
+qualname = sqlalchemy.engine
+# "level = INFO" logs SQL queries.
+# "level = DEBUG" logs SQL queries and results.
+# "level = WARN" logs neither.  (Recommended for production systems.)
+
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = NOTSET
+formatter = generic
+
+[formatter_generic]
+format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
+
+# End logging configuration

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/production.ini_tmpl

+[app:{{project}}]
+use = egg:{{project}}
+reload_templates = false
+debug_authorization = false
+debug_notfound = false
+debug_routematch = false
+debug_templates = false
+default_locale_name = en
+mako.directories = {{package}}:templates
+sqlalchemy.url = sqlite:///%(here)s/db.sqlite
+session.type = file
+session.data_dir = %(here)s/data/sessions/data
+session.lock_dir = %(here)s/data/sessions/lock
+session.key = {{project}}
+session.secret = {{random_string}}
+
+
+[filter:weberror]
+use = egg:WebError#error_catcher
+debug = false
+;error_log = 
+;show_exceptions_in_wsgi_errors = true
+;smtp_server = localhost
+;error_email = janitor@example.com
+;smtp_username = janitor
+;smtp_password = "janitor's password"
+;from_address = paste@localhost
+;error_subject_prefix = "Pyramid Error"
+;smtp_use_tls =
+;error_message =
+
+[filter:tm]
+use = egg:repoze.tm2#tm
+commit_veto = repoze.tm:default_commit_veto
+
+[pipeline:main]
+pipeline =
+    weberror
+    tm
+    {{project}}
+
+[server:main]
+use = egg:Paste#http
+host = 127.0.0.1
+port = 5000
+
+# Begin logging configuration
+
+[loggers]
+keys = root, {{package_logger}}, sqlalchemy
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = WARN
+handlers = console
+
+[logger_{{package_logger}}]
+level = WARN
+handlers =
+qualname = {{package}}
+
+[logger_sqlalchemy]
+level = WARN
+handlers =
+qualname = sqlalchemy.engine
+# "level = INFO" logs SQL queries.
+# "level = DEBUG" logs SQL queries and results.
+# "level = WARN" logs neither.  (Recommended for production systems.)
+
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = NOTSET
+formatter = generic
+
+[formatter_generic]
+format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
+
+# End logging configuration

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/setup.cfg_tmpl

+[nosetests]
+match=^test
+nocapture=1
+cover-package={{package}}
+with-coverage=1
+cover-erase=1
+
+[compile_catalog]
+directory = {{package}}/locale
+domain = {{project}}
+statistics = true
+
+[extract_messages]
+add_comments = TRANSLATORS:
+output_file = {{package}}/locale/{{project}}.pot
+width = 80
+
+[init_catalog]
+domain = {{project}}
+input_file = {{package}}/locale/{{project}}.pot
+output_dir = {{package}}/locale
+
+[update_catalog]
+domain = {{project}}
+input_file = {{package}}/locale/{{project}}.pot
+output_dir = {{package}}/locale
+previous = true

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/setup.py

+import os
+import sys
+
+from setuptools import setup, find_packages
+
+here = os.path.abspath(os.path.dirname(__file__))
+README = open(os.path.join(here, 'README.txt')).read()
+CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
+
+requires = [
+    'pyramid>=1.0a10',
+    'pyramid_beaker',
+    'pyramid_handlers',
+    'pyramid_sqla',
+    'SQLAlchemy',
+    'transaction',
+    'repoze.tm2>=1.0b1',  # default_commit_veto
+    'zope.sqlalchemy',
+    'WebError',
+]
+
+if sys.version_info[:3] < (2,5,0):
+   requires.append('pysqlite')
+    
+entry_points = """\
+    [paste.app_factory]
+    main = {{package}}:main
+
+    [paste.app_install]
+    main = paste.script.appinstall:Installer
+"""
+
+setup(name='{{project}}',
+      version='0.0',
+      description='{{project}}',
+      long_description=README + '\n\n' +  CHANGES,
+      classifiers=[
+        "Programming Language :: Python",
+        "Framework :: Pylons",
+        "Topic :: Internet :: WWW/HTTP",
+        "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
+        ],
+      author='',
+      author_email='',
+      url='',
+      keywords='web pyramid pylons',
+      packages=find_packages(),
+      include_package_data=True,
+      zip_safe=False,
+      install_requires=requires,
+      tests_require=requires,
+      test_suite="{{package}}",
+      entry_points=entry_points,
+      paster_plugins=['pyramid'],
+      )
+

pyramid_sqla/paster_templates/pyramid_sqla_quickstart/setup.py_tmpl

+import os
+import sys
+
+from setuptools import setup, find_packages
+
+here = os.path.abspath(os.path.dirname(__file__))
+README = open(os.path.join(here, 'README.txt')).read()
+CHANGES = open(os.path.join(here, 'CHANGES.txt')).read()
+
+requires = [
+    'pyramid>=1.0a10',
+    'pyramid_beaker',
+    'pyramid_handlers',
+    'SQLAlchemy',
+    'transaction',
+    'repoze.tm2',
+    'zope.sqlalchemy',
+    'WebError',
+]
+
+if sys.version_info[:3] < (2,5,0):
+   requires.append('pysqlite')
+    
+entry_points = """\
+    [paste.app_factory]
+    main = {{package}}:main
+
+    [paste.app_install]
+    main = paste.script.appinstall:Installer
+"""
+
+setup(name='{{project}}',
+      version='0.0',
+      description='{{project}}',
+      long_description=README + '\n\n' +  CHANGES,
+      classifiers=[
+        "Programming Language :: Python",
+        "Framework :: Pylons",
+        "Topic :: Internet :: WWW/HTTP",
+        "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
+        ],
+      author='',
+      author_email='',
+      url='',
+      keywords='web pyramid pylons',
+      packages=find_packages(),
+      include_package_data=True,
+      zip_safe=False,
+      install_requires=requires,
+      tests_require=requires,
+      test_suite="{{package}}",
+      entry_points=entry_points,
+      paster_plugins=['pyramid'],
+      )
+