Permalink
Browse files

Made scaffolding compatible with pcreate for Pyramid 1.3a2, prep for 0.2

  • Loading branch information...
mcdonc committed Dec 14, 2011
1 parent 741813e commit 9b0908711ada2ae302ab9778f50c66a4929f338f
Showing with 31 additions and 26 deletions.
  1. +3 −1 CHANGES.txt
  2. +1 −1 docs/_themes
  3. +1 −1 docs/conf.py
  4. +11 −2 docs/index.rst
  5. +12 −20 pyramid_jqm/scaffolds/__init__.py
  6. +3 −1 setup.py
View
@@ -1,6 +1,8 @@
-0.2 (unreleased)
+0.2 (2011-12-14)
================
+- Made scaffolding compatible with ``pcreate`` for Pyramid 1.3a2+.
+
- Updated the scaffold's version of ``jquery.mobile`` to version 1.0.
[WouterVH]
View
@@ -51,7 +51,7 @@
# other places throughout the built documents.
#
# The short X.Y version.
-version = '0.1'
+version = '0.2'
# The full version, including alpha/beta/rc tags.
release = version
View
@@ -30,11 +30,20 @@ Generating a Sample Application
The primary job of :mod:`pyramid_jqm` is to provide a :term:`scaffold` which
allows you to easily generate a :term:`Pyramid` application that has jQuery
Mobile integration. After :mod:`pyramid_jqm` is installed, generate an
-application:
+application. The way this is done differs slightly if you're using Pyramid
+1.1, 1.2, or 1.3.
+
+On Pyramid 1.1 or 1.2:
+
+.. code-block:: text
+
+ $ $myvenv/bin/paster create -t pyramid_jqm_starter MyApp
+
+On Pyramid 1.3:
.. code-block:: text
- $ /path/to/paster create -t pyramid_jqm_starter MyApp
+ $ $myvenv/bin/pcreate -s pyramid_jqm_starter MyApp
This will create a ``MyApp`` :term:`distribution`, in which will live a
``myapp`` Python :term:`package`. The distribution represents a
@@ -1,25 +1,17 @@
# package
-import os
-from paste.script.templates import Template
-from paste.util.template import paste_script_template_renderer
-
-class PyramidTemplate(Template):
- def pre(self, command, output_dir, vars):
- vars['random_string'] = os.urandom(20).encode('hex')
- 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
- return Template.pre(self, command, output_dir, vars)
-
- def post(self, command, output_dir, vars):
- self.out('Welcome to Pyramid. Sorry for the convenience.')
- return Template.post(self, command, output_dir, vars)
-
- def out(self, msg): # pragma: no cover (replaceable testing hook)
- print msg
+try: # pragma: no cover (pyramid 1.0.X)
+ # "pyramid.paster_templates" doesn't exist past 1.0.X
+ from pyramid.paster_templates import PyramidTemplate
+ from pyramid.paster_templates import paste_script_template_renderer
+except ImportError: # pragma: no cover
+ try: # pragma: no cover (pyramid 1.1.X, 1.2.X)
+ # trying to import "paste_script_template_renderer" fails on 1.3.X
+ from pyramid.scaffolds import paste_script_template_renderer
+ from pyramid.scaffolds import PyramidTemplate
+ except ImportError: # pragma: no cover (pyramid >=1.3a2)
+ paste_script_template_renderer = None
+ from pyramid.scaffolds import PyramidTemplate
class JQMStarterProjectTemplate(PyramidTemplate):
_template_dir = 'jqm_starter'
View
@@ -28,7 +28,7 @@
]
setup(name='pyramid_jqm',
- version='0.2dev',
+ version='0.2',
description=('a package which provides "starter" scaffolding for '
'creating a jQuery Mobile Pyramid application.'),
long_description=README + '\n\n' + CHANGES,
@@ -53,6 +53,8 @@
entry_points="""
[paste.paster_create_template]
pyramid_jqm_starter=pyramid_jqm.scaffolds:JQMStarterProjectTemplate
+ [pyramid.scaffold]
+ pyramid_jqm_starter=pyramid_jqm.scaffolds:JQMStarterProjectTemplate
"""
,
)

0 comments on commit 9b09087

Please sign in to comment.