summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2010-11-04 00:57:30 -0400
committerChris McDonough <chrism@plope.com>2010-11-04 00:57:30 -0400
commit6ac10bd4992bedfe0d6f1dbf1966441989b8e5ed (patch)
treed4c0c3df4605c036589e5bc9cec5ecf421258d8e
parent896e2523fbb391bb1a04f9f2ec05a674b9ba7fdf (diff)
downloadpyramid-6ac10bd4992bedfe0d6f1dbf1966441989b8e5ed.tar.gz
pyramid-6ac10bd4992bedfe0d6f1dbf1966441989b8e5ed.tar.bz2
pyramid-6ac10bd4992bedfe0d6f1dbf1966441989b8e5ed.zip
add forgotten files for paster template conversion (declarative -> imperative)
-rwxr-xr-xpyramid/paster_templates/alchemy/+package+/__init__.py_tmpl29
-rw-r--r--pyramid/paster_templates/alchemy/development.ini_tmpl22
-rw-r--r--pyramid/paster_templates/routesalchemy/+package+/__init__.py_tmpl25
-rw-r--r--pyramid/paster_templates/routesalchemy/development.ini_tmpl22
-rw-r--r--pyramid/paster_templates/starter/+package+/__init__.py_tmpl16
-rw-r--r--pyramid/paster_templates/starter/development.ini_tmpl15
-rw-r--r--pyramid/paster_templates/zodb/+package+/__init__.py_tmpl26
-rw-r--r--pyramid/paster_templates/zodb/development.ini_tmpl22
8 files changed, 177 insertions, 0 deletions
diff --git a/pyramid/paster_templates/alchemy/+package+/__init__.py_tmpl b/pyramid/paster_templates/alchemy/+package+/__init__.py_tmpl
new file mode 100755
index 000000000..0a1a98ea3
--- /dev/null
+++ b/pyramid/paster_templates/alchemy/+package+/__init__.py_tmpl
@@ -0,0 +1,29 @@
+from pyramid.configuration import Configurator
+from paste.deploy.converters import asbool
+
+from {{package}}.models import appmaker
+
+def app(global_config, **settings):
+ """ This function returns a WSGI application.
+
+ It is usually called by the PasteDeploy framework during
+ ``paster serve``.
+ """
+ db_string = settings.get('db_string')
+ if db_string is None:
+ raise ValueError("No 'db_string' value in application configuration.")
+ db_echo = settings.get('db_echo', 'false')
+ get_root = appmaker(db_string, asbool(db_echo))
+ config = Configurator(settings=settings, root_factory=get_root)
+ config.begin()
+ config.add_static_view('static', 'templates/static')
+ config.add_view('{{package}}.views.view_root',
+ context='{{package}}.models.MyApp',
+ renderer="templates/root.pt")
+ config.add_view('{{package}}.views.view_model',
+ context='{{package}}.models.MyModel',
+ renderer="templates/model.pt")
+ config.end()
+ return config.make_wsgi_app()
+
+
diff --git a/pyramid/paster_templates/alchemy/development.ini_tmpl b/pyramid/paster_templates/alchemy/development.ini_tmpl
new file mode 100644
index 000000000..8260104d5
--- /dev/null
+++ b/pyramid/paster_templates/alchemy/development.ini_tmpl
@@ -0,0 +1,22 @@
+[DEFAULT]
+debug = true
+
+[app:sqlalchemy]
+use = egg:{{package}}#app
+reload_templates = true
+debug_authorization = false
+debug_notfound = false
+debug_templates = true
+default_locale_name = en
+db_string = sqlite:///%(here)s/{{package}}.db
+db_echo = false
+
+[pipeline:main]
+pipeline =
+ egg:repoze.tm2#tm
+ sqlalchemy
+
+[server:main]
+use = egg:Paste#http
+host = 0.0.0.0
+port = 6543
diff --git a/pyramid/paster_templates/routesalchemy/+package+/__init__.py_tmpl b/pyramid/paster_templates/routesalchemy/+package+/__init__.py_tmpl
new file mode 100644
index 000000000..fede36fe6
--- /dev/null
+++ b/pyramid/paster_templates/routesalchemy/+package+/__init__.py_tmpl
@@ -0,0 +1,25 @@
+from pyramid.configuration import Configurator
+from paste.deploy.converters import asbool
+
+from {{package}}.models import initialize_sql
+
+def app(global_config, **settings):
+ """ This function returns a WSGI application.
+
+ It is usually called by the PasteDeploy framework during
+ ``paster serve``.
+ """
+ db_string = settings.get('db_string')
+ if db_string is None:
+ raise ValueError("No 'db_string' value in application configuration.")
+ db_echo = settings.get('db_echo', 'false')
+ initialize_sql(db_string, asbool(db_echo))
+ config = Configurator(settings=settings)
+ config.begin()
+ config.add_static_view('static', 'templates/static')
+ config.add_route('home', '/', view='{{package}}.views.my_view',
+ renderer='templates/mytemplate.pt')
+ config.end()
+ return config.make_wsgi_app()
+
+
diff --git a/pyramid/paster_templates/routesalchemy/development.ini_tmpl b/pyramid/paster_templates/routesalchemy/development.ini_tmpl
new file mode 100644
index 000000000..8260104d5
--- /dev/null
+++ b/pyramid/paster_templates/routesalchemy/development.ini_tmpl
@@ -0,0 +1,22 @@
+[DEFAULT]
+debug = true
+
+[app:sqlalchemy]
+use = egg:{{package}}#app
+reload_templates = true
+debug_authorization = false
+debug_notfound = false
+debug_templates = true
+default_locale_name = en
+db_string = sqlite:///%(here)s/{{package}}.db
+db_echo = false
+
+[pipeline:main]
+pipeline =
+ egg:repoze.tm2#tm
+ sqlalchemy
+
+[server:main]
+use = egg:Paste#http
+host = 0.0.0.0
+port = 6543
diff --git a/pyramid/paster_templates/starter/+package+/__init__.py_tmpl b/pyramid/paster_templates/starter/+package+/__init__.py_tmpl
new file mode 100644
index 000000000..a4e3c1d6e
--- /dev/null
+++ b/pyramid/paster_templates/starter/+package+/__init__.py_tmpl
@@ -0,0 +1,16 @@
+from pyramid.configuration import Configurator
+from {{package}}.models import get_root
+
+def app(global_config, **settings):
+ """ This function returns a WSGI application.
+
+ It is usually called by the PasteDeploy framework during
+ ``paster serve``.
+ """
+ zcml_file = settings.get('configure_zcml', 'configure.zcml')
+ config = Configurator(root_factory=get_root, settings=settings)
+ config.begin()
+ config.load_zcml(zcml_file)
+ config.end()
+ return config.make_wsgi_app()
+
diff --git a/pyramid/paster_templates/starter/development.ini_tmpl b/pyramid/paster_templates/starter/development.ini_tmpl
new file mode 100644
index 000000000..9bdeec1ae
--- /dev/null
+++ b/pyramid/paster_templates/starter/development.ini_tmpl
@@ -0,0 +1,15 @@
+[DEFAULT]
+debug = true
+
+[app:main]
+use = egg:{{project}}#app
+reload_templates = true
+debug_authorization = false
+debug_notfound = false
+debug_templates = true
+default_locale_name = en
+
+[server:main]
+use = egg:Paste#http
+host = 0.0.0.0
+port = 6543
diff --git a/pyramid/paster_templates/zodb/+package+/__init__.py_tmpl b/pyramid/paster_templates/zodb/+package+/__init__.py_tmpl
new file mode 100644
index 000000000..a87e61c7d
--- /dev/null
+++ b/pyramid/paster_templates/zodb/+package+/__init__.py_tmpl
@@ -0,0 +1,26 @@
+from pyramid.configuration import Configurator
+from repoze.zodbconn.finder import PersistentApplicationFinder
+from {{package}}.models import appmaker
+
+def app(global_config, **settings):
+ """ This function returns a WSGI application.
+
+ It is usually called by the PasteDeploy framework during
+ ``paster serve``.
+ """
+ zodb_uri = settings.get('zodb_uri')
+ if zodb_uri is None:
+ raise ValueError("No 'zodb_uri' in application configuration.")
+
+ finder = PersistentApplicationFinder(zodb_uri, appmaker)
+ def get_root(request):
+ return finder(request.environ)
+ config = Configurator(root_factory=get_root, settings=settings)
+ config.begin()
+ config.add_view('{{package}}.views.my_view',
+ context='{{package}}.models.MyModel',
+ renderer='{{package}}:templates/mytemplate.pt')
+ config.add_static_view('static', '{{package}}:templates/static')
+ config.end()
+ return config.make_wsgi_app()
+
diff --git a/pyramid/paster_templates/zodb/development.ini_tmpl b/pyramid/paster_templates/zodb/development.ini_tmpl
new file mode 100644
index 000000000..993cec596
--- /dev/null
+++ b/pyramid/paster_templates/zodb/development.ini_tmpl
@@ -0,0 +1,22 @@
+[DEFAULT]
+debug = true
+
+[app:zodb]
+use = egg:{{project}}#app
+reload_templates = true
+debug_authorization = false
+debug_notfound = false
+debug_templates = true
+default_locale_name = en
+zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000
+
+[pipeline:main]
+pipeline =
+ egg:repoze.zodbconn#closer
+ egg:repoze.tm#tm
+ zodb
+
+[server:main]
+use = egg:Paste#http
+host = 0.0.0.0
+port = 6543