Skip to content

Commit

Permalink
Merge branch 'pull.1300'
Browse files Browse the repository at this point in the history
  • Loading branch information
mmerickel committed Apr 20, 2014
2 parents 872796d + 91f3222 commit d8b2960
Show file tree
Hide file tree
Showing 13 changed files with 141 additions and 42 deletions.
5 changes: 5 additions & 0 deletions CHANGES.txt
@@ -1,6 +1,11 @@
Next release
============

- Update scaffold generating machinery to return the version of pyramid and
pyramid docs for use in scaffolds. Updated starter, alchemy and zodb
templates to have links to correctly versioned documentation and reflect
which pyramid was used to generate the scaffold.

- Fix an issue whereby predicates would be resolved as maybe_dotted in the
introspectable but not when passed for registration. This would mean that
add_route_predicate for example can not take a string and turn it into the
Expand Down
12 changes: 6 additions & 6 deletions pyramid/scaffolds/alchemy/+package+/templates/mytemplate.pt_tmpl
Expand Up @@ -8,12 +8,12 @@
<meta name="author" content="Pylons Project">
<link rel="shortcut icon" href="${request.static_url('{{package}}:static/pyramid-16x16.png')}">

<title>Starter Template for The Pyramid Web Framework</title>
<title>Alchemy Scaffold for The Pyramid Web Framework</title>

<!-- Bootstrap core CSS -->
<link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">

<!-- Custom styles for this template -->
<!-- Custom styles for this scaffold -->
<link href="${request.static_url('{{package}}:static/theme.css')}" rel="stylesheet">

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
Expand All @@ -33,16 +33,16 @@
</div>
<div class="col-md-10">
<div class="content">
<h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">starter template</span></h1>
<p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework</span>.</p>
<h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">Alchemy scaffold</span></h1>
<p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework {{pyramid_version}}</span>.</p>
</div>
</div>
</div>
<div class="row">
<div class="links">
<ul>
<li class="current-version">Currently v1.5</li>
<li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org">Docs</a></li>
<li class="current-version">Generated by v{{pyramid_version}}</li>
<li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/{{pyramid_docs_branch}}/">Docs</a></li>
<li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
<li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="irc://irc.freenode.net#pyramid">IRC Channel</a></li>
<li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
Expand Down
3 changes: 2 additions & 1 deletion pyramid/scaffolds/alchemy/+package+/views.py_tmpl
Expand Up @@ -17,12 +17,13 @@ def my_view(request):
return Response(conn_err_msg, content_type='text/plain', status_int=500)
return {'one': one, 'project': '{{project}}'}


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_{{project}}_db" script
to initialize your database tables. Check your virtual
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
Expand Down
4 changes: 2 additions & 2 deletions pyramid/scaffolds/alchemy/development.ini_tmpl
@@ -1,6 +1,6 @@
###
# app configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
# http://docs.pylonsproject.org/projects/pyramid/en/{{pyramid_docs_branch}}/narr/environment.html
###

[app:main]
Expand Down Expand Up @@ -32,7 +32,7 @@ port = 6543

###
# logging configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
# http://docs.pylonsproject.org/projects/pyramid/en/{{pyramid_docs_branch}}/narr/logging.html
###

[loggers]
Expand Down
4 changes: 2 additions & 2 deletions pyramid/scaffolds/alchemy/production.ini_tmpl
@@ -1,6 +1,6 @@
###
# app configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
# http://docs.pylonsproject.org/projects/pyramid/en/{{pyramid_docs_branch}}/narr/environment.html
###

[app:main]
Expand All @@ -23,7 +23,7 @@ port = 6543

###
# logging configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
# http://docs.pylonsproject.org/projects/pyramid/en/{{pyramid_docs_branch}}/narr/logging.html
###

[loggers]
Expand Down
12 changes: 6 additions & 6 deletions pyramid/scaffolds/starter/+package+/templates/mytemplate.pt_tmpl
Expand Up @@ -8,12 +8,12 @@
<meta name="author" content="Pylons Project">
<link rel="shortcut icon" href="${request.static_url('{{package}}:static/pyramid-16x16.png')}">

<title>Starter Template for The Pyramid Web Framework</title>
<title>Starter Scaffold for The Pyramid Web Framework</title>

<!-- Bootstrap core CSS -->
<link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">

<!-- Custom styles for this template -->
<!-- Custom styles for this scaffold -->
<link href="${request.static_url('{{package}}:static/theme.css')}" rel="stylesheet">

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
Expand All @@ -33,16 +33,16 @@
</div>
<div class="col-md-10">
<div class="content">
<h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">starter template</span></h1>
<p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework</span>.</p>
<h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">Starter scaffold</span></h1>
<p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework {{pyramid_version}}</span>.</p>
</div>
</div>
</div>
<div class="row">
<div class="links">
<ul>
<li class="current-version">Currently v1.5</li>
<li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org">Docs</a></li>
<li class="current-version">Generated by v{{pyramid_version}}</li>
<li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/{{pyramid_docs_branch}}/">Docs</a></li>
<li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
<li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="irc://irc.freenode.net#pyramid">IRC Channel</a></li>
<li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
Expand Down
6 changes: 3 additions & 3 deletions pyramid/scaffolds/starter/development.ini_tmpl
@@ -1,6 +1,6 @@
###
# app configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
# http://docs.pylonsproject.org/projects/pyramid/en/{{pyramid_docs_branch}}/narr/environment.html
###

[app:main]
Expand All @@ -11,7 +11,7 @@ pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.default_locale_name = en
pyramid.includes =
pyramid.includes =
pyramid_debugtoolbar

# By default, the toolbar only appears for clients from IP addresses
Expand All @@ -29,7 +29,7 @@ port = 6543

###
# logging configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
# http://docs.pylonsproject.org/projects/pyramid/en/{{pyramid_docs_branch}}/narr/logging.html
###

[loggers]
Expand Down
4 changes: 2 additions & 2 deletions pyramid/scaffolds/starter/production.ini_tmpl
@@ -1,6 +1,6 @@
###
# app configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
# http://docs.pylonsproject.org/projects/pyramid/en/{{pyramid_docs_branch}}/narr/environment.html
###

[app:main]
Expand All @@ -23,7 +23,7 @@ port = 6543

###
# logging configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
# http://docs.pylonsproject.org/projects/pyramid/en/{{pyramid_docs_branch}}/narr/logging.html
###

[loggers]
Expand Down
12 changes: 6 additions & 6 deletions pyramid/scaffolds/zodb/+package+/templates/mytemplate.pt_tmpl
Expand Up @@ -8,12 +8,12 @@
<meta name="author" content="Pylons Project">
<link rel="shortcut icon" href="${request.static_url('{{package}}:static/pyramid-16x16.png')}">

<title>Starter Template for The Pyramid Web Framework</title>
<title>ZODB Scaffold for The Pyramid Web Framework</title>

<!-- Bootstrap core CSS -->
<link href="//oss.maxcdn.com/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">

<!-- Custom styles for this template -->
<!-- Custom styles for this scaffold -->
<link href="${request.static_url('{{package}}:static/theme.css')}" rel="stylesheet">

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
Expand All @@ -33,16 +33,16 @@
</div>
<div class="col-md-10">
<div class="content">
<h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">starter template</span></h1>
<p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework</span>.</p>
<h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">ZODB scaffold</span></h1>
<p class="lead">Welcome to <span class="font-normal">${project}</span>, an&nbsp;application generated&nbsp;by<br>the <span class="font-normal">Pyramid Web Framework {{pyramid_version}}</span>.</p>
</div>
</div>
</div>
<div class="row">
<div class="links">
<ul>
<li class="current-version">Currently v1.5</li>
<li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org">Docs</a></li>
<li class="current-version">Generated by v{{pyramid_version}}</li>
<li><i class="glyphicon glyphicon-bookmark icon-muted"></i><a href="http://docs.pylonsproject.org/projects/pyramid/en/{{pyramid_docs_branch}}/">Docs</a></li>
<li><i class="glyphicon glyphicon-cog icon-muted"></i><a href="https://github.com/Pylons/pyramid">Github Project</a></li>
<li><i class="glyphicon glyphicon-globe icon-muted"></i><a href="irc://irc.freenode.net#pyramid">IRC Channel</a></li>
<li><i class="glyphicon glyphicon-home icon-muted"></i><a href="http://pylonsproject.org">Pylons Project</a></li>
Expand Down
4 changes: 2 additions & 2 deletions pyramid/scaffolds/zodb/development.ini_tmpl
@@ -1,6 +1,6 @@
###
# app configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
# http://docs.pylonsproject.org/projects/pyramid/en/{{pyramid_docs_branch}}/narr/environment.html
###

[app:main]
Expand Down Expand Up @@ -34,7 +34,7 @@ port = 6543

###
# logging configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
# http://docs.pylonsproject.org/projects/pyramid/en/{{pyramid_docs_branch}}/narr/logging.html
###

[loggers]
Expand Down
4 changes: 2 additions & 2 deletions pyramid/scaffolds/zodb/production.ini_tmpl
@@ -1,6 +1,6 @@
###
# app configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
# http://docs.pylonsproject.org/projects/pyramid/en/{{pyramid_docs_branch}}/narr/environment.html
###

[app:main]
Expand Down Expand Up @@ -29,7 +29,7 @@ port = 6543

###
# logging configuration
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
# http://docs.pylonsproject.org/projects/pyramid/en/{{pyramid_docs_branch}}/narr/logging.html
###

[loggers]
Expand Down
16 changes: 16 additions & 0 deletions pyramid/scripts/pcreate.py
Expand Up @@ -53,6 +53,8 @@ class PCreateCommand(object):
action='store_true',
help='When a file would be overwritten, interrogate')

pyramid_dist = pkg_resources.get_distribution("pyramid")

def __init__(self, argv, quiet=False):
self.quiet = quiet
self.options, self.args = self.parser.parse_args(argv[1:])
Expand Down Expand Up @@ -82,10 +84,24 @@ def render_scaffolds(self):
pkg_name = _bad_chars_re.sub('', project_name.lower())
safe_name = pkg_resources.safe_name(project_name)
egg_name = pkg_resources.to_filename(safe_name)

# get pyramid package version
pyramid_version = self.pyramid_dist.version

# map pyramid package version of the documentation branch
# by finding the version.major version
vmatch = re.match(r'(\d+\.\d+)', self.pyramid_dist.version)
if vmatch is not None:
pyramid_docs_branch = "%s-branch" % vmatch.group()
else:
pyramid_docs_branch = 'latest'

vars = {
'project': project_name,
'package': pkg_name,
'egg': egg_name,
'pyramid_version': pyramid_version,
'pyramid_docs_branch': pyramid_docs_branch,
}
for scaffold_name in options.scaffold_name:
for scaffold in self.scaffolds:
Expand Down

0 comments on commit d8b2960

Please sign in to comment.