Skip to content

Commit

Permalink
Merge branch 'release/3.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
xrotwang committed Sep 20, 2016
2 parents 3270035 + 84de666 commit cb55df9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Expand Up @@ -2,6 +2,12 @@
Changes
-------

3.1.1
~~~~~

Added shortcut config method to add simple template-based pages to clld apps.


3.1.0
~~~~~

Expand Down
2 changes: 1 addition & 1 deletion clld/__init__.py
Expand Up @@ -5,7 +5,7 @@
from clld import interfaces


__version__ = "3.1.0"
__version__ = "3.1.1"


class Resource(namedtuple('Resource', 'name model interface with_index with_rdfdump')):
Expand Down
17 changes: 11 additions & 6 deletions clld/web/app.py
Expand Up @@ -449,6 +449,15 @@ def add_410(config, pattern, name=None):
_route_and_view(config, pattern, gone, name=name)


def add_page(config, name, pattern=None, view=None, template=None, views=None):
views = views or maybe_import('%s.views' % config.root_package.__name__)
config.add_route_and_view(
name,
pattern or '/' + name,
view or getattr(views, name, lambda r: {}),
renderer=template or name + '.mako')


def includeme(config):
"""Upgrading:
Expand Down Expand Up @@ -520,6 +529,7 @@ def includeme(config):
'add_settings_from_file': add_settings_from_file,
'add_301': add_301,
'add_410': add_410,
'add_page': add_page,
'register_resource_routes_and_views': register_resource_routes_and_views,
}.items():
config.add_directive(name, func)
Expand Down Expand Up @@ -595,14 +605,9 @@ def includeme(config):
if p.stem in home_comp and p.suffix == '.mako':
home_comp[p.stem] = True

views = maybe_import('%s.views' % root_package)
for name, template in home_comp.items():
if template:
config.add_route_and_view(
name,
'/' + name,
getattr(views, name, lambda r: {}),
renderer=name + '.mako')
config.add_page(name)

config.add_settings({'home_comp': [k for k in home_comp.keys() if home_comp[k]]})

Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Expand Up @@ -44,17 +44,17 @@

# General information about the project.
project = u'clld'
copyright = u'2016, Robert Forkel'
copyright = u'Max Planck Society'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The full version, including alpha/beta/rc tags.
release = '3.1.0'
release = '3.1.1'

# The short X.Y version.
version = '3.1.0'
version = '3.1.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -73,7 +73,7 @@

setup(
name='clld',
version='3.1.0',
version='3.1.1',
description=(
'Python library supporting the development of cross-linguistic databases'),
long_description=README,
Expand Down

0 comments on commit cb55df9

Please sign in to comment.