Chris McDonough
2010-07-04 4dc529e4bbc36b7e5e2bd3ea199a7929e407a267
commit | author | age
4dc529 1 1.3a4 (2010-07-03)
CM 2 ==================
2a8ca3 3
62f5af 4 Features
CM 5 --------
6
7 - Undocumented hook: make ``get_app`` and ``get_root`` of the
8   ``repoze.bfg.paster.BFGShellCommand`` hookable in cases where
9   endware may interfere with the default versions.
10
44bc11 11 - In earlier versions, a custom route predicate associated with a url
CM 12   dispatch route (each of the predicate functions fed to the
13   ``custom_predicates`` argument of
14   ``repoze.bfg.configuration.Configurator.add_route``) has always
15   required a 2-positional argument signature, e.g. ``(context,
16   request)``.  Before this release, the ``context`` argument was
17   always ``None``.
18
19   As of this release, the first argument passed to a predicate is now
23ab84 20   a dictionary conventionally named ``info`` consisting of ``route``,
CM 21   and ``match``.  ``match`` is a dictionary: it represents the
22   arguments matched in the URL by the route.  ``route`` is an object
23   representing the route which was matched.
44bc11 24
CM 25   This is useful when predicates need access to the route match.  For
26   example::
27
28     def any_of(segment_name, *args):
29         def predicate(info, request):
30             if info['match'][segment_name] in args:
31                 return True
23ab84 32         return predicate
44bc11 33
CM 34     num_one_two_or_three = any_of('num, 'one', 'two', 'three')
35
1a47ed 36     add_route('num', '/:num', custom_predicates=(num_one_two_or_three,))
44bc11 37
23ab84 38   The ``route`` object is an object that has two useful attributes:
CM 39   ``name`` and ``path``.  The ``name`` attribute is the route name.
1a47ed 40   The ``path`` attribute is the route pattern.  An example of using
CM 41   the route in a set of route predicates::
42
43     def twenty_ten(info, request):
44         if info['route'].name in ('ymd', 'ym', 'y'):
45             return info['match']['year'] == '2010'
46
47     add_route('y', '/:year', custom_predicates=(twenty_ten,))
48     add_route('ym', '/:year/:month', custom_predicates=(twenty_ten,))
49     add_route('ymd', '/:year/:month:/day', custom_predicates=(twenty_ten,))
50
b29429 51 - The ``repoze.bfg.url.route_url`` API has changed.  If a keyword
CM 52   ``_app_url`` is present in the arguments passed to ``route_url``,
53   this value will be used as the protocol/hostname/port/leading path
54   prefix of the generated URL.  For example, using an ``_app_url`` of
55   ``http://example.com:8080/foo`` would cause the URL
56   ``http://example.com:8080/foo/fleeb/flub`` to be returned from this
57   function if the expansion of the route pattern associated with the
58   ``route_name`` expanded to ``/fleeb/flub``.
59
60 - It is now possible to use a URL as the ``name`` argument fed to
61   ``repoze.bfg.configuration.Configurator.add_static_view``.  When the
62   name argument is a URL, the ``repoze.bfg.url.static_url`` API will
63   generate join this URL (as a prefix) to a path including the static
64   file name.  This makes it more possible to put static media on a
65   separate webserver for production, while keeping static media
66   package-internal and served by the development webserver during
67   development.
23ab84 68
12062a 69 Documentation
CM 70 -------------
71
72 - The authorization chapter of the ZODB Wiki Tutorial
73   (docs/tutorials/bfgwiki) was changed to demonstrate authorization
74   via a group rather than via a direct username (thanks to Alex
75   Marandon).
2a8ca3 76
1025eb 77 - The authorization chapter of the SQLAlchemy Wiki Tutorial
CM 78   (docs/tutorials/bfgwiki2) was changed to demonstrate authorization
79   via a group rather than via a direct username.
80
8989b3 81 - Redirect requests for tutorial sources to
CM 82   http://docs.repoze.org/bfgwiki-1.3 and
83   http://docs.repoze.org/bfgwiki2-1.3/ respectively.
84
62eaa2 85 - A section named ``Custom Route Predicates`` was added to the URL
CM 86   Dispatch narrative chapter.
d61024 87
b29429 88 - The Static Resources chapter has been updated to mention using
CM 89   ``static_url`` to generate URLs to external webservers.
90
91 Internal
92 --------
93
94 - Removed ``repoze.bfg.static.StaticURLFactory`` in favor of a new
95   abstraction revolving around the (still-internal)
96   ``repoze.bfg.static.StaticURLInfo`` helper class.
97
d3cfd4 98 1.3a3 (2010-05-01)
CM 99 ==================
7a3c22 100
CM 101 Paster Templates
102 ----------------
103
104 - The ``bfg_alchemy`` and ``bfg_routesalchemy`` templates no longer
105   register a ``handle_teardown`` event listener which calls
106   ``DBSession.remove``.  This was found by Chris Withers to be
107   unnecessary.
108
109 Documentation
110 -------------
111
112 - The "bfgwiki2" (URL dispatch wiki) tutorial code and documentation
113   was changed to remove the ``handle_teardown`` event listener which
114   calls ``DBSession.remove``.
115
116 - Any mention of the ``handle_teardown`` event listener as used by the
117   paster templates was removed from the URL Dispatch narrative chapter.
118
2f935c 119 - A section entitled Detecting Available Languages was added to the
CM 120   i18n narrative docs chapter.
121
3fb08a 122 1.3a2 (2010-04-28)
CM 123 ==================
12cb6d 124
CM 125 Features
126 --------
127
128 - A locale negotiator no longer needs to be registered explicitly. The
129   default locale negotiator at
130   ``repoze.bfg.i18n.default_locale_negotiator`` is now used
131   unconditionally as... um, the default locale negotiator.
132
133 - The default locale negotiator has become more complex.
134
135   * First, the negotiator looks for the ``_LOCALE_`` attribute of
b5dc7f 136     the request object (possibly set by a view or an event listener).
12cb6d 137   
CM 138   * Then it looks for the ``request.params['_LOCALE_']`` value.
139
140   * Then it looks for the ``request.cookies['_LOCALE_']`` value.
141
142 Backwards Incompatibilities
143 ---------------------------
144
145 - The default locale negotiator now looks for the parameter named
146   ``_LOCALE_`` rather than a parameter named ``locale`` in
147   ``request.params``.
148
149 Behavior Changes
150 ----------------
151
152 - A locale negotiator may now return ``None``, signifying that the
153   default locale should be used.
154
155 Documentation
156 -------------
157
158 - Documentation concerning locale negotiation in the
159   Internationalizationa and Localization chapter was updated.
160
b5dc7f 161 - Expanded portion of i18n narrative chapter docs which discuss
CM 162   working with gettext files.
163
4c8f4d 164 1.3a1 (2010-04-26)
CM 165 ==================
1a6e9e 166
ece24e 167 Features
CM 168 --------
5ba063 169
334f4a 170 - Added "exception views".  When you use an exception (anything that
ff1213 171   inherits from the Python ``Exception`` builtin) as view context
CM 172   argument, e.g.::
5ba063 173
ff1213 174       from repoze.bfg.view import bfg_view
CM 175       from repoze.bfg.exceptions import NotFound
176       from webob.exc import HTTPNotFound
5ba063 177
ff1213 178       @bfg_view(context=NotFound)
CM 179       def notfound_view(request):
180           return HTTPNotFound()
362061 181
ff1213 182   For the above example, when the ``repoze.bfg.exceptions.NotFound``
CM 183   exception is raised by any view or any root factory, the
23693f 184   ``notfound_view`` view callable will be invoked and its response
ff1213 185   returned.
362061 186
ff1213 187   Other normal view predicates can also be used in combination with an
7534ba 188   exception view registration::
5ba063 189
ff1213 190       from repoze.bfg.view import bfg_view
CM 191       from repoze.bfg.exceptions import NotFound
192       from webob.exc import HTTPNotFound
5b231b 193
ff1213 194       @bfg_view(context=NotFound, route_name='home')
CM 195       def notfound_view(request):
196           return HTTPNotFound()
333bd0 197
ff1213 198   The above exception view names the ``route_name`` of ``home``,
CM 199   meaning that it will only be called when the route matched has a
200   name of ``home``.  You can therefore have more than one exception
201   view for any given exception in the system: the "most specific" one
202   will be called when the set of request circumstances which match the
203   view registration.  The only predicate that cannot be not be used
204   successfully is ``name``.  The name used to look up an exception
205   view is always the empty string.
333bd0 206
ff1213 207   Existing (pre-1.3) normal views registered against objects
CM 208   inheriting from ``Exception`` will continue to work.  Exception
209   views used for user-defined exceptions and system exceptions used as
210   contexts will also work.
333bd0 211
ff1213 212   The feature can be used with any view registration mechanism
334f4a 213   (``@bfg_view`` decorator, ZCML, or imperative ``config.add_view``
CM 214   styles).
1476bc 215
e5a21b 216   This feature was kindly contributed by Andrey Popp.
CM 217
e6fa66 218 - Use "Venusian" (`http://docs.repoze.org/venusian
44907a 219   <http://docs.repoze.org/venusian>`_) to perform ``bfg_view``
e6fa66 220   decorator scanning rather than relying on a BFG-internal decorator
CM 221   scanner.  (Truth be told, Venusian is really just a generalization
222   of the BFG-internal decorator scanner).
223
7534ba 224 - Internationalization and localization features as documented in the
CM 225   narrative documentation chapter entitled ``Internationalization and
226   Localization``.
227
7c525f 228 - A new deployment setting named ``default_locale_name`` was added.
CM 229   If this string is present as a Paster ``.ini`` file option, it will
230   be considered the default locale name.  The default locale name is
231   used during locale-related operations such as language translation.
232
233 - It is now possible to turn on Chameleon template "debugging mode"
234   for all Chameleon BFG templates by setting a BFG-related Paster
235   ``.ini`` file setting named ``debug_templates``. The exceptions
236   raised by Chameleon templates when a rendering fails are sometimes
237   less than helpful.  ``debug_templates`` allows you to configure your
238   application development environment so that exceptions generated by
239   Chameleon during template compilation and execution will contain
240   more helpful debugging information.  This mode is on by default in
241   all new projects.
7534ba 242
8cc399 243 - Add a new method of the Configurator named ``derive_view`` which can
CM 244   be used to generate a BFG view callable from a user-supplied
245   function, instance, or class. This useful for external framework and
246   plugin authors wishing to wrap callables supplied by their users
247   which follow the same calling conventions and response conventions
248   as objects that can be supplied directly to BFG as a view callable.
249   See the ``derive_view`` method in the
250   ``repoze.bfg.configuration.Configurator`` docs.
251
7534ba 252 ZCML
CM 253 ----
254
255 - Add a ``translationdir`` ZCML directive to support localization.
256
257 - Add a ``localenegotiator`` ZCML directive to support localization.
258
addf99 259 Deprecations
CM 260 ------------
261
ff1213 262 -  The exception views feature replaces the need for the
CM 263    ``set_notfound_view`` and ``set_forbidden_view`` methods of the
264    ``Configurator`` as well as the ``notfound`` and ``forbidden`` ZCML
265    directives.  Those methods and directives will continue to work for
266    the foreseeable future, but they are deprecated in the
267    documentation.
e6fa66 268
CM 269 Dependencies
270 ------------
271
272 - A new install-time dependency on the ``venusian`` distribution was
273   added.
7534ba 274
CM 275 - A new install-time dependency on the ``translationstring``
276   distribution was added.
277
278 - Chameleon 1.2.3 or better is now required (internationalization and
279   per-template debug settings).
cdae91 280
251ce7 281 Internal
CM 282 --------
283
ff1213 284 - View registrations and lookups are now done with three "requires"
CM 285   arguments instead of two to accomodate orthogonality of exception
286   views.
bc857e 287
4cbb0e 288 - The ``repoze.bfg.interfaces.IForbiddenView`` and
CM 289   ``repoze.bfg.interfaces.INotFoundView`` interfaces were removed;
290   they weren't APIs and they became vestigial with the addition of
291   exception views.
292
e6fa66 293 - Remove ``repoze.bfg.compat.pkgutil_26.py`` and import alias
CM 294   ``repoze.bfg.compat.walk_packages``.  These were only required by
295   internal scanning machinery; Venusian replaced the internal scanning
296   machinery, so these are no longer required.
297
bc857e 298 Documentation
CM 299 -------------
300
ff1213 301 - Exception view documentation was added to the ``Hooks`` narrative
CM 302   chapter.
7534ba 303
CM 304 - A new narrative chapter entitled ``Internationalization and
305   Localization`` was added.
306
307 - The "Environment Variables and ``ini`` File Settings" chapter was
308   changed: documentation about the ``default_locale_name`` setting was
309   added.
310
311 - A new API chapter for the ``repoze.bfg.i18n`` module was added.
312
313 - Documentation for the new ``translationdir`` and
23693f 314   ``localenegotiator`` ZCML directives were added.
7534ba 315
579230 316 - A section was added to the Templates chapter entitled "Nicer
CM 317   Exceptions in Templates" describing the result of setting
318   ``debug_templates = true``.
319
7534ba 320 Paster Templates
CM 321 ----------------
322
323 - All paster templates now create a ``setup.cfg`` which includes
324   commands related to nose testing and Babel message catalog
325   extraction/compilation.
326
327 - A ``default_locale_name = en`` setting was added to each existing paster
328   template.
329
7c525f 330 - A ``debug_templates = true`` setting was added to each existing
CM 331   paster template.
332
7534ba 333 Licensing
CM 334 ---------
335
336 - The Edgewall (BSD) license was added to the LICENSES.txt file, as
337   some code in the ``repoze.bfg.i18n`` derives from Babel source.
338