| | |
| | | 1.3a4 (2010-07-03) |
| | | ================== |
| | | |
| | | Features |
| | | -------- |
| | | |
| | | - Undocumented hook: make ``get_app`` and ``get_root`` of the |
| | | ``repoze.bfg.paster.BFGShellCommand`` hookable in cases where |
| | | endware may interfere with the default versions. |
| | | |
| | | - In earlier versions, a custom route predicate associated with a url |
| | | dispatch route (each of the predicate functions fed to the |
| | | ``custom_predicates`` argument of |
| | | ``repoze.bfg.configuration.Configurator.add_route``) has always |
| | | required a 2-positional argument signature, e.g. ``(context, |
| | | request)``. Before this release, the ``context`` argument was |
| | | always ``None``. |
| | | |
| | | As of this release, the first argument passed to a predicate is now |
| | | a dictionary conventionally named ``info`` consisting of ``route``, |
| | | and ``match``. ``match`` is a dictionary: it represents the |
| | | arguments matched in the URL by the route. ``route`` is an object |
| | | representing the route which was matched. |
| | | |
| | | This is useful when predicates need access to the route match. For |
| | | example:: |
| | | |
| | | def any_of(segment_name, *args): |
| | | def predicate(info, request): |
| | | if info['match'][segment_name] in args: |
| | | return True |
| | | return predicate |
| | | |
| | | num_one_two_or_three = any_of('num, 'one', 'two', 'three') |
| | | |
| | | add_route('num', '/:num', custom_predicates=(num_one_two_or_three,)) |
| | | |
| | | The ``route`` object is an object that has two useful attributes: |
| | | ``name`` and ``path``. The ``name`` attribute is the route name. |
| | | The ``path`` attribute is the route pattern. An example of using |
| | | the route in a set of route predicates:: |
| | | |
| | | def twenty_ten(info, request): |
| | | if info['route'].name in ('ymd', 'ym', 'y'): |
| | | return info['match']['year'] == '2010' |
| | | |
| | | add_route('y', '/:year', custom_predicates=(twenty_ten,)) |
| | | add_route('ym', '/:year/:month', custom_predicates=(twenty_ten,)) |
| | | add_route('ymd', '/:year/:month:/day', custom_predicates=(twenty_ten,)) |
| | | |
| | | - The ``repoze.bfg.url.route_url`` API has changed. If a keyword |
| | | ``_app_url`` is present in the arguments passed to ``route_url``, |
| | | this value will be used as the protocol/hostname/port/leading path |
| | | prefix of the generated URL. For example, using an ``_app_url`` of |
| | | ``http://example.com:8080/foo`` would cause the URL |
| | | ``http://example.com:8080/foo/fleeb/flub`` to be returned from this |
| | | function if the expansion of the route pattern associated with the |
| | | ``route_name`` expanded to ``/fleeb/flub``. |
| | | |
| | | - It is now possible to use a URL as the ``name`` argument fed to |
| | | ``repoze.bfg.configuration.Configurator.add_static_view``. When the |
| | | name argument is a URL, the ``repoze.bfg.url.static_url`` API will |
| | | generate join this URL (as a prefix) to a path including the static |
| | | file name. This makes it more possible to put static media on a |
| | | separate webserver for production, while keeping static media |
| | | package-internal and served by the development webserver during |
| | | development. |
| | | |
| | | Documentation |
| | | ------------- |
| | | |
| | | - The authorization chapter of the ZODB Wiki Tutorial |
| | | (docs/tutorials/bfgwiki) was changed to demonstrate authorization |
| | | via a group rather than via a direct username (thanks to Alex |
| | | Marandon). |
| | | |
| | | - The authorization chapter of the SQLAlchemy Wiki Tutorial |
| | | (docs/tutorials/bfgwiki2) was changed to demonstrate authorization |
| | | via a group rather than via a direct username. |
| | | |
| | | - Redirect requests for tutorial sources to |
| | | http://docs.repoze.org/bfgwiki-1.3 and |
| | | http://docs.repoze.org/bfgwiki2-1.3/ respectively. |
| | | |
| | | - A section named ``Custom Route Predicates`` was added to the URL |
| | | Dispatch narrative chapter. |
| | | |
| | | - The Static Resources chapter has been updated to mention using |
| | | ``static_url`` to generate URLs to external webservers. |
| | | |
| | | Internal |
| | | -------- |
| | | |
| | | - Removed ``repoze.bfg.static.StaticURLFactory`` in favor of a new |
| | | abstraction revolving around the (still-internal) |
| | | ``repoze.bfg.static.StaticURLInfo`` helper class. |
| | | |
| | | 1.3a3 (2010-05-01) |
| | | ================== |
| | | |
| | | Paster Templates |
| | | ---------------- |
| | | |
| | | - The ``bfg_alchemy`` and ``bfg_routesalchemy`` templates no longer |
| | | register a ``handle_teardown`` event listener which calls |
| | | ``DBSession.remove``. This was found by Chris Withers to be |
| | | unnecessary. |
| | | |
| | | Documentation |
| | | ------------- |
| | | |
| | | - The "bfgwiki2" (URL dispatch wiki) tutorial code and documentation |
| | | was changed to remove the ``handle_teardown`` event listener which |
| | | calls ``DBSession.remove``. |
| | | |
| | | - Any mention of the ``handle_teardown`` event listener as used by the |
| | | paster templates was removed from the URL Dispatch narrative chapter. |
| | | |
| | | - A section entitled Detecting Available Languages was added to the |
| | | i18n narrative docs chapter. |
| | | |
| | | 1.3a2 (2010-04-28) |
| | | ================== |
| | | |