BFG_HISTORY.rst 241 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
1.3b1 (2010-10-25)
==================

Features
--------

- The ``paster`` template named ``bfg_routesalchemy`` has been updated
  to use SQLAlchemy declarative syntax.  Thanks to Ergo^.

Bug Fixes
---------

- When a renderer factory could not be found, a misleading error
  message was raised if the renderer name was not a string.

Documentation
-------------

- The ""bfgwiki2" (SQLAlchemy + url dispatch) tutorial has been
  updated slightly.  In particular, the source packages no longer
  attempt to use a private index, and the recommended Python version
  is now 2.6.  It was also updated to take into account the changes to
  the ``bfg_routesalchemy`` template used to set up an environment.

- The "bfgwiki" (ZODB + traversal) tutorial has been updated slightly.
  In particular, the source packages no longer attempt to use a
  private index, and the recommended Python version is now 2.6.

1.3a15 (2010-09-30)
===================

Features
--------

- The ``repoze.bfg.traversal.traversal_path`` API now eagerly attempts
  to encode a Unicode ``path`` into ASCII before attempting to split
  it and decode its segments.  This is for convenience, effectively to
  allow a (stored-as-Unicode-in-a-database, or
  retrieved-as-Unicode-from-a-request-parameter) Unicode path to be
  passed to ``find_model``, which eventually internally uses the
  ``traversal_path`` function under the hood.  In version 1.2 and
  prior, if the ``path`` was Unicode, that Unicode was split on
  slashes and each resulting segment value was Unicode.  An
  inappropriate call to the ``decode()`` method of a resulting Unicode
  path segment could cause a ``UnicodeDecodeError`` to occur even if
  the Unicode representation of the path contained no 'high order'
  characters (it effectively did a "double decode").  By converting
  the Unicode path argument to ASCII before we attempt to decode and
  split, genuine errors will occur in a more obvious place while also
  allowing us to handle (for convenience) the case that it's a Unicode
  representation formed entirely from ASCII-compatible characters.

1.3a14 (2010-09-14)
===================

Bug Fixes
---------

- If an exception view was registered through the legacy
  ``set_notfound_view`` or ``set_forbidden_view`` APIs, the context
  sent to the view was incorrect (could be ``None`` inappropriately).

Features
--------

- Compatibility with WebOb 1.0.

Requirements
------------

- Now requires WebOb >= 1.0.

Backwards Incompatibilities
---------------------------

- Due to changes introduced WebOb 1.0, the
  ``repoze.bfg.request.make_request_ascii`` event subscriber no longer
  works, so it has been removed.  This subscriber was meant to be used
  in a deployment so that code written before BFG 0.7.0 could run
  unchanged.  At this point, such code will need to be rewritten to
  expect Unicode from ``request.GET``, ``request.POST`` and
  ``request.params`` or it will need to be changed to use
  ``request.str_POST``, ``request.str_GET`` and/or
  ``request.str_params`` instead of the non-``str`` versions of same,
  as the non-``str`` versions of the same APIs always now perform
  decoding to Unicode.

Errata
------

- A prior changelog entry asserted that the ``INewResponse`` event was
  not sent to listeners if the response was not "valid" (if a view or
  renderer returned a response object that did not have a
  status/headers/app_iter).  This is not true in this release, nor was
  it true in 1.3a13.

1.3a13 (2010-09-14)
===================

Bug Fixes
---------

- The ``traverse`` route predicate could not successfully generate a
  traversal path.

Features
--------

- In support of making it easier to configure applications which are
  "secure by default", a default permission feature was added.  If
  supplied, the default permission is used as the permission string to
  all view registrations which don't otherwise name a permission.
  These APIs are in support of that:

  - A new constructor argument was added to the Configurator:
    ``default_permission``.

  - A new method was added to the Configurator:
    ``set_default_permission``.

  - A new ZCML directive was added: ``default_permission``.

- Add a new request API: ``request.add_finished_callback``.  Finished
  callbacks are called by the router unconditionally near the very end
  of request processing.  See the "Using Finished Callbacks" section
  of the "Hooks" narrative chapter of the documentation for more
  information.

- A ``request.matched_route`` attribute is now added to the request
  when a route has matched.  Its value is the "route" object that
  matched (see the ``IRoute`` interface within
  ``repoze.bfg.interfaces`` API documentation for the API of a route
  object).

- The ``exception`` attribute of the request is now set slightly
  earlier and in a slightly different set of scenarios, for benefit of
  "finished callbacks" and "response callbacks".  In previous
  versions, the ``exception`` attribute of the request was not set at
  all if an exception view was not found.  In this version, the
  ``request.exception`` attribute is set immediately when an exception
  is caught by the router, even if an exception view could not be
  found.

- The ``add_route`` method of a Configurator now accepts a
  ``pregenerator`` argument.  The pregenerator for the resulting route
  is called by ``route_url`` in order to adjust the set of arguments
  passed to it by the user for special purposes, such as Pylons
  'subdomain' support.  It will influence the URL returned by
  ``route_url``.  See the ``repoze.bfg.interfaces.IRoutePregenerator``
  interface for more information.

Backwards Incompatibilities
---------------------------

- The router no longer sets the value ``wsgiorg.routing_args`` into
  the environ when a route matches. The value used to be something
  like ``((), matchdict)``.  This functionality was only ever
  obliquely referred to in change logs; it was never documented as an
  API.

- The ``exception`` attribute of the request now defaults to ``None``.
  In prior versions, the ``request.exception`` attribute did not exist
  if an exception was not raised by user code during request
  processing; it only began existence once an exception view was
  found.

Deprecations
------------

- The ``repoze.bfg.interfaces.IWSGIApplicationCreatedEvent`` event
  interface was renamed to
  ``repoze.bfg.interfaces.IApplicationCreated``.  Likewise, the
  ``repoze.bfg.events.WSGIApplicationCreatedEvent`` class was renamed
  to ``repoze.bfg.events.ApplicationCreated``.  The older aliases will
  continue to work indefinitely.

- The ``repoze.bfg.interfaces.IAfterTraversal`` event interface was
  renamed to ``repoze.bfg.interfaces.IContextFound``.  Likewise, the
  ``repoze.bfg.events.AfterTraversal`` class was renamed to
  ``repoze.bfg.events.ContextFound``.  The older aliases will continue
  to work indefinitely.

- References to the WSGI environment values ``bfg.routes.matchdict``
  and ``bfg.routes.route`` were removed from documentation.  These
  will stick around internally for several more releases, but it is
  ``request.matchdict`` and ``request.matched_route`` are now the
  "official" way to obtain the matchdict and the route object which
  resulted in the match.

Documentation
-------------

- Added documentation for the ``default_permission`` ZCML directive.

- Added documentation for the ``default_permission`` constructor value
  and the ``set_default_permission`` method in the Configurator API
  documentation.

- Added a new section to the "security" chapter named "Setting a
  Default Permission".

- Document ``renderer_globals_factory`` and ``request_factory``
  arguments to Configurator constructor.

- Added two sections to the "Hooks" chapter of the documentation:
  "Using Response Callbacks" and "Using Finished Callbacks".

- Added documentation of the ``request.exception`` attribute to the
  ``repoze.bfg.request.Request`` API documentation.

- Added glossary entries for "response callback" and "finished
  callback".

- The "Request Processing" narrative chapter has been updated to note
  finished and response callback steps.

- New interface in interfaces API documentation: ``IRoutePregenerator``.

- Added a "The Matched Route" section to the URL Dispatch narrative
  docs chapter, detailing the ``matched_route`` attribute.

1.3a12 (2010-09-08)
===================

Bug Fixes
---------

- Fix a bug in ``repoze.bfg.url.static_url`` URL generation: if two
  resource specifications were used to create two separate static
  views, but they shared a common prefix, it was possible that
  ``static_url`` would generate an incorrect URL.

- Fix another bug in ``repoze.bfg.static_url`` URL generation: too
  many slashes in generated URL.

- Prevent a race condition which could result in a ``RuntimeError``
  when rendering a Chameleon template that has not already been
  rendered once.  This would usually occur directly after a restart,
  when more than one person or thread is trying to execute the same
  view at the same time: https://bugs.launchpad.net/karl3/+bug/621364

Features
--------

- The argument to ``repoze.bfg.configuration.Configurator.add_route``
  which was previously called ``path`` is now called ``pattern`` for
  better explicability.  For backwards compatibility purposes, passing
  a keyword argument named ``path`` to ``add_route`` will still work
  indefinitely.

- The ``path`` attribute to the ZCML ``route`` directive is now named
  ``pattern`` for better explicability.  The older ``path`` attribute
  will continue to work indefinitely.

Documentation
-------------

- All narrative, API, and tutorial docs which referred to a route
  pattern as a ``path`` have now been updated to refer to them as a
  ``pattern``.

- The ``repoze.bfg.interfaces`` API documentation page is now rendered
  via ``repoze.sphinx.autointerface``.

- The URL Dispatch narrative chapter now refers to the ``interfaces``
  chapter to explain the API of an ``IRoute`` object.

Paster Templates
----------------

- The routesalchemy template has been updated to use ``pattern`` in
  its route declarations rather than ``path``.

Dependencies
------------

- ``tests_require`` now includes ``repoze.sphinx.autointerface`` as a
  dependency.

Internal
--------

- Add an API to the ``Configurator`` named ``get_routes_mapper``.
  This returns an object implementing the ``IRoutesMapper`` interface.

- The ``repoze.bfg.urldispatch.RoutesMapper`` object now has a
  ``get_route`` method which returns a single Route object or
  ``None``.

- A new interface ``repoze.bfg.interfaces.IRoute`` was added.  The
  ``repoze.bfg.urldispatch.Route`` object implements this interface.

- The canonical attribute for accessing the routing pattern from a
  route object is now ``pattern`` rather than ``path``.

- Use ``hash()`` rather than ``id()`` when computing the "phash" of a
  custom route/view predicate in order to allow the custom predicate
  some control over which predicates are "equal".

- Use ``response.headerlist.append`` instead of
  ``response.headers.add`` in
  ``repoze.bfg.request.add_global_response_headers`` in case the
  response is not a WebOb response.

- The ``repoze.bfg.urldispatch.Route`` constructor (not an API) now
  accepts a different ordering of arguments.  Previously it was
  ``(pattern, name, factory=None, predicates=())``.  It is now
  ``(name, pattern, factory=None, predicates=())``.  This is in
  support of consistency with ``configurator.add_route``.

- The ``repoze.bfg.urldispatch.RoutesMapper.connect`` method (not an
  API) now accepts a different ordering of arguments.  Previously it
  was ``(pattern, name, factory=None, predicates=())``.  It is now
  ``(name, pattern, factory=None, predicates=())``.  This is in
  support of consistency with ``configurator.add_route``.

1.3a11 (2010-09-05)
===================

Bug Fixes
---------

- Process the response callbacks and the NewResponse event earlier, to
  enable mutations to the response to take effect.

1.3a10 (2010-09-05)
===================

Features
--------

- A new ``repoze.bfg.request.Request.add_response_callback`` API has
  been added.  This method is documented in the new
  ``repoze.bfg.request`` API chapter.  It can be used to influence
  response values before a concrete response object has been created.

- The ``repoze.bfg.interfaces.INewResponse`` interface now includes a
  ``request`` attribute; as a result, a handler for INewResponse now
  has access to the request which caused the response.

- Each of the follow methods of the Configurator now allow the
  below-named arguments to be passed as "dotted name strings"
  (e.g. "foo.bar.baz") rather than as actual implementation objects
  that must be imported:

  setup_registry
     root_factory, authentication_policy, authorization_policy,
     debug_logger, locale_negotiator, request_factory,
     renderer_globals_factory

  add_subscriber
     subscriber, iface

  derive_view
     view

  add_view
     view, ``for_``, context, request_type, containment

  add_route()
     view, view_for, factory, ``for_``, view_context

  scan
     package

  add_renderer
     factory

  set_forbidden_view
     view

  set_notfound_view
     view

  set_request_factory
     factory

  set_renderer_globals_factory()
     factory

  set_locale_negotiator
     negotiator

  testing_add_subscriber
     event_iface

Bug Fixes
---------

390
- The route pattern registered internally for a local "static view"
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690
  (either via the ``static`` ZCML directive or via the
  ``add_static_view`` method of the configurator) was incorrect.  It
  was regsistered for e.g. ``static*traverse``, while it should have
  been registered for ``static/*traverse``.  Symptom: two static views
  could not reliably be added to a system when they both shared the
  same path prefix (e.g. ``/static`` and ``/static2``).

Backwards Incompatibilities
---------------------------

- The INewResponse event is now not sent to listeners if the response
  returned by view code (or a renderer) is not a "real" response
  (e.g. if it does not have ``.status``, ``.headerlist`` and
  ``.app_iter`` attribtues).

Documentation
-------------

- Add an API chapter for the ``repoze.bfg.request`` module, which
  includes documentation for the ``repoze.bfg.request.Request`` class
  (the "request object").

- Modify the "Request and Response" narrative chapter to reference the
  new ``repoze.bfg.request`` API chapter.  Some content was moved from
  this chapter into the API documentation itself.

- Various changes to denote that Python dotted names are now allowed
  as input to Configurator methods.

Internal
--------

- The (internal) feature which made it possible to attach a
  ``global_response_headers`` attribute to the request (which was
  assumed to contain a sequence of header key/value pairs which would
  later be added to the response by the router), has been removed.
  The functionality of
  ``repoze.bfg.request.Request.add_response_callback`` takes its
  place.

- The ``repoze.bfg.events.NewResponse`` class's construct has changed:
  it now must be created with ``(request, response)`` rather than
  simply ``(response)``.

1.3a9 (2010-08-22)
==================

Features
--------

- The Configurator now accepts a dotted name *string* to a package as
  a ``package`` constructor argument. The ``package`` argument was
  previously required to be a package *object* (not a dotted name
  string).

- The ``repoze.bfg.configuration.Configurator.with_package`` method
  was added.  This method returns a new Configurator using the same
  application registry as the configurator object it is called
  upon. The new configurator is created afresh with its ``package``
  constructor argument set to the value passed to ``with_package``.
  This feature will make it easier for future BFG versions to allow
  dotted names as arguments in places where currently only object
  references are allowed (the work to allow dotted names isntead of
  object references everywhere has not yet been done, however).

- The new ``repoze.bfg.configuration.Configurator.maybe_dotted``
  method resolves a Python dotted name string supplied as its
  ``dotted`` argument to a global Python object.  If the value cannot
  be resolved, a ``repoze.bfg.configuration.ConfigurationError`` is
  raised.  If the value supplied as ``dotted`` is not a string, the
  value is returned unconditionally without any resolution attempted.

- The new
  ``repoze.bfg.configuration.Configurator.absolute_resource_spec``
  method resolves a potentially relative "resource specification"
  string into an absolute version.  If the value supplied as
  ``relative_spec`` is not a string, the value is returned
  unconditionally without any resolution attempted.

Backwards Incompatibilities
---------------------------

- The functions in ``repoze.bfg.renderers`` named ``render`` and
  ``render_to_response`` introduced in 1.3a6 previously took a set of
  ``**values`` arguments for the values to be passed to the renderer.
  This was wrong, as renderers don't need to accept only dictionaries
  (they can accept any type of object).  Now, the value sent to the
  renderer must be supplied as a positional argument named ``value``.
  The ``request`` argument is still a keyword argument, however.

- The functions in ``repoze.bfg.renderers`` named ``render`` and
  ``render_to_response`` now accept an additonal keyword argument
  named ``package``.

- The ``get_renderer`` API in ``repoze.bfg.renderers`` now accepts a
  ``package`` argument.

Documentation
-------------

- The ZCML ``include`` directive docs were incorrect: they specified
  ``filename`` rather than (the correct) ``file`` as an allowable
  attribute.

Internal
--------

- The ``repoze.bfg.resource.resolve_resource_spec`` function can now
  accept a package object as its ``pname`` argument instead of just a
  package name.

- The ``_renderer_factory_from_name`` and ``_renderer_from_name``
  methods of the Configurator were removed.  These were never APIs.

- The ``_render``, ``_render_to_response`` and ``_make_response``
  functions with ``repoze.bfg.render`` (added in 1.3a6) have been
  removed.

- A new helper class ``repoze.bfg.renderers.RendererHelper`` was
  added.

- The _map_view function of ``repoze.bfg.configuration`` now takes
  only a renderer_name argument instead of both a ``renderer`` and
  ``renderer``_name argument.  It also takes a ``package`` argument
  now.

- Use ``imp.get_suffixes`` indirection in
  ``repoze.bfg.path.package_name`` instead of hardcoded ``.py``
  ``.pyc`` and ``.pyo`` to use for comparison when attemtping to
  decide if a directory is a package.

- Make tests runnable again under Jython (although they do not all
  pass currently).

- The reify decorator now maintains the docstring of the function it
  wraps.

1.3a8 (2010-08-08)
==================

Features
--------

- New public interface: ``repoze.bfg.exceptions.IExceptionResponse``.
  This interface is provided by all internal exception classes (such
  as ``repoze.bfg.exceptions.NotFound`` and
  ``repoze.bfg.exceptions.Forbidden``), instances of which are both
  exception objects and can behave as WSGI response objects.  This
  interface is made public so that exception classes which are also
  valid WSGI response factories can be configured to implement them or
  exception instances which are also or response instances can be
  configured to provide them.

- New API class: ``repoze.bfg.view.AppendSlashNotFoundViewFactory``.

  There can only be one Not Found view in any ``repoze.bfg``
  application.  Even if you use
  ``repoze.bfg.view.append_slash_notfound_view`` as the Not Found
  view, ``repoze.bfg`` still must generate a ``404 Not Found``
  response when it cannot redirect to a slash-appended URL; this not
  found response will be visible to site users.

  If you don't care what this 404 response looks like, and you only
  need redirections to slash-appended route URLs, you may use the
  ``repoze.bfg.view.append_slash_notfound_view`` object as the Not
  Found view.  However, if you wish to use a *custom* notfound view
  callable when a URL cannot be redirected to a slash-appended URL,
  you may wish to use an instance of the
  ``repoze.bfg.view.AppendSlashNotFoundViewFactory`` class as the Not
  Found view, supplying the notfound view callable as the first
  argument to its constructor.  For instance::

       from repoze.bfg.exceptions import NotFound
       from repoze.bfg.view import AppendSlashNotFoundViewFactory

       def notfound_view(context, request):
           return HTTPNotFound('It aint there, stop trying!')

       custom_append_slash = AppendSlashNotFoundViewFactory(notfound_view)
       config.add_view(custom_append_slash, context=NotFound)

  The ``notfound_view`` supplied must adhere to the two-argument view
  callable calling convention of ``(context, request)`` (``context``
  will be the exception object).

Documentation
--------------

- Expanded the "Cleaning Up After a Request" section of the URL
  Dispatch narrative chapter.

- Expanded the "Redirecting to Slash-Appended Routes" section of the
  URL Dispatch narrative chapter.

Internal
--------

- Previously, two default view functions were registered at
  Configurator setup (one for ``repoze.bfg.exceptions.NotFound`` named
  ``default_notfound_view`` and one for
  ``repoze.bfg.exceptions.Forbidden`` named
  ``default_forbidden_view``) to render internal exception responses.
  Those default view functions have been removed, replaced with a
  generic default view function which is registered at Configurator
  setup for the ``repoze.bfg.interfaces.IExceptionResponse`` interface
  that simply returns the exception instance; the ``NotFound`` and
  ``Forbidden`` classes are now still exception factories but they are
  also response factories which generate instances that implement the
  new ``repoze.bfg.interfaces.IExceptionResponse`` interface.

1.3a7 (2010-08-01)
==================

Features
--------

- The ``repoze.bfg.configuration.Configurator.add_route`` API now
  returns the route object that was added.

- A ``repoze.bfg.events.subscriber`` decorator was added.  This
  decorator decorates module-scope functions, which are then treated
  as event listeners after a scan() is performed.  See the Events
  narrative documentation chapter and the ``repoze.bfg.events`` module
  documentation for more information.

Bug Fixes
---------

- When adding a view for a route which did not yet exist ("did not yet
  exist" meaning, temporally, a view was added with a route name for a
  route which had not yet been added via add_route), the value of the
  ``custom_predicate`` argument to ``add_view`` was lost.  Symptom:
  wrong view matches when using URL dispatch and custom view
  predicates together.

- Pattern matches for a ``:segment`` marker in a URL dispatch route
  pattern now always match at least one character.  See "Backwards
  Incompatibilities" below in this changelog.

Backwards Incompatibilities
---------------------------

- A bug existed in the regular expression to do URL matching.  As an
  example, the URL matching machinery would cause the pattern
  ``/{foo}`` to match the root URL ``/`` resulting in a match
  dictionary of ``{'foo':u''}`` or the pattern ``/{fud}/edit might
  match the URL ``//edit`` resulting in a match dictionary of
  ``{'fud':u''}``.  It was always the intent that ``:segment`` markers
  in the pattern would need to match *at least one* character, and
  never match the empty string.  This, however, means that in certain
  circumstances, a routing match which your application inadvertently
  depended upon may no longer happen.

Documentation
--------------

- Added description of the ``repoze.bfg.events.subscriber`` decorator
  to the Events narrative chapter.

- Added ``repoze.bfg.events.subscriber`` API documentation to
  ``repoze.bfg.events`` API docs.

- Added a section named "Zope 3 Enforces 'TTW' Authorization Checks By
  Default; BFG Does Not" to the "Design Defense" chapter.

1.3a6 (2010-07-25)
==================

Features
--------

- New argument to ``repoze.bfg.configuration.Configurator.add_route``
  and the ``route`` ZCML directive: ``traverse``.  If you would like
  to cause the ``context`` to be something other than the ``root``
  object when this route matches, you can spell a traversal pattern as
  the ``traverse`` argument.  This traversal pattern will be used as
  the traversal path: traversal will begin at the root object implied
  by this route (either the global root, or the object returned by the
  ``factory`` associated with this route).

  The syntax of the ``traverse`` argument is the same as it is for
  ``path``. For example, if the ``path`` provided is
  ``articles/:article/edit``, and the ``traverse`` argument provided
  is ``/:article``, when a request comes in that causes the route to
  match in such a way that the ``article`` match value is '1' (when
  the request URI is ``/articles/1/edit``), the traversal path will be
  generated as ``/1``.  This means that the root object's
  ``__getitem__`` will be called with the name ``1`` during the
  traversal phase.  If the ``1`` object exists, it will become the
  ``context`` of the request.  The Traversal narrative has more
  information about traversal.

  If the traversal path contains segment marker names which are not
  present in the path argument, a runtime error will occur.  The
  ``traverse`` pattern should not contain segment markers that do not
  exist in the ``path``.

  A similar combining of routing and traversal is available when a
  route is matched which contains a ``*traverse`` remainder marker in
  its path.  The ``traverse`` argument allows you to associate route
691
  patterns with an arbitrary traversal path without using a
692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383
  ``*traverse`` remainder marker; instead you can use other match
  information.

  Note that the ``traverse`` argument is ignored when attached to a
  route that has a ``*traverse`` remainder marker in its path.

- A new method of the ``Configurator`` exists:
  ``set_request_factory``.  If used, this method will set the factory
  used by the ``repoze.bfg`` router to create all request objects.

- The ``Configurator`` constructor takes an additional argument:
  ``request_factory``.  If used, this argument will set the factory
  used by the ``repoze.bfg`` router to create all request objects.

- The ``Configurator`` constructor takes an additional argument:
  ``request_factory``.  If used, this argument will set the factory
  used by the ``repoze.bfg`` router to create all request objects.

- A new method of the ``Configurator`` exists:
  ``set_renderer_globals_factory``.  If used, this method will set the
  factory used by the ``repoze.bfg`` router to create renderer
  globals.

- A new method of the ``Configurator`` exists: ``get_settings``.  If
  used, this method will return the current settings object (performs
  the same job as the ``repoze.bfg.settings.get_settings`` API).

- The ``Configurator`` constructor takes an additional argument:
  ``renderer_globals_factory``.  If used, this argument will set the
  factory used by the ``repoze.bfg`` router to create renderer
  globals.

- Add ``repoze.bfg.renderers.render``,
  ``repoze.bfg.renderers.render_to_response`` and
  ``repoze.bfg.renderers.get_renderer`` functions.  These are
  imperative APIs which will use the same rendering machinery used by
  view configurations with a ``renderer=`` attribute/argument to
  produce a rendering or renderer.  Because these APIs provide a
  central API for all rendering, they now form the preferred way to
  perform imperative template rendering.  Using functions named
  ``render_*`` from modules such as ``repoze.bfg.chameleon_zpt`` and
  ``repoze.bfg.chameleon_text`` is now discouraged (although not
  deprecated).  The code the backing older templating-system-specific
  APIs now calls into the newer ``repoze.bfg.renderer`` code.

- The ``repoze.bfg.configuration.Configurator.testing_add_template``
  has been renamed to ``testing_add_renderer``.  A backwards
  compatibility alias is present using the old name.

Documentation
-------------

- The ``Hybrid`` narrative chapter now contains a description of the
  ``traverse`` route argument.

- The ``Hooks`` narrative chapter now contains sections about
  changing the request factory and adding a renderer globals factory.

- The API documentation includes a new module:
  ``repoze.bfg.renderers``.

- The ``Templates`` chapter was updated; all narrative that used
  templating-specific APIs within examples to perform rendering (such
  as the ``repoze.bfg.chameleon_zpt.render_template_to_response``
  method) was changed to use ``repoze.bfg.renderers.render_*``
  functions.

Bug Fixes
---------

- The ``header`` predicate (when used as either a view predicate or a
  route predicate) had a problem when specified with a name/regex
  pair.  When the header did not exist in the headers dictionary, the
  regex match could be fed ``None``, causing it to throw a
  ``TypeError: expected string or buffer`` exception.  Now, the
  predicate returns False as intended.

Deprecations
------------

- The ``repoze.bfg.renderers.rendered_response`` function was never an
  official API, but may have been imported by extensions in the wild.
  It is officially deprecated in this release.  Use
  ``repoze.bfg.renderers.render_to_response`` instead.

- The following APIs are *documentation* deprecated (meaning they are
  officially deprecated in documentation but do not raise a
  deprecation error upon their usage, and may continue to work for an
  indefinite period of time):

  In the ``repoze.bfg.chameleon_zpt`` module: ``get_renderer``,
  ``get_template``, ``render_template``,
  ``render_template_to_response``.  The suggested alternatives are
  documented within the docstrings of those methods (which are still
  present in the documentation).

  In the ``repoze.bfg.chameleon_text`` module: ``get_renderer``,
  ``get_template``, ``render_template``,
  ``render_template_to_response``.  The suggested alternatives are
  documented within the docstrings of those methods (which are still
  present in the documentation).

  In general, to perform template-related functions, one should now
  use the various methods in the ``repoze.bfg.renderers`` module.

Backwards Incompatibilities
---------------------------

- A new internal exception class (*not* an API) named
  ``repoze.bfg.exceptions.PredicateMismatch`` now exists.  This
  exception is currently raised when no constituent view of a
  multiview can be called (due to no predicate match).  Previously, in
  this situation, a ``repoze.bfg.exceptions.NotFound`` was raised.  We
  provide backwards compatibility for code that expected a
  ``NotFound`` to be raised when no predicates match by causing
  ``repoze.bfg.exceptions.PredicateMismatch`` to inherit from
  ``NotFound``.  This will cause any exception view registered for
  ``NotFound`` to be called when a predicate mismatch occurs, as was
  the previous behavior.

  There is however, one perverse case that will expose a backwards
  incompatibility.  If 1) you had a view that was registered as a
  member of a multiview 2) this view explicitly raised a ``NotFound``
  exception *in order to* proceed to the next predicate check in the
  multiview, that code will now behave differently: rather than
  skipping to the next view match, a NotFound will be raised to the
  top-level exception handling machinery instead.  For code to be
  depending upon the behavior of a view raising ``NotFound`` to
  proceed to the next predicate match, would be tragic, but not
  impossible, given that ``NotFound`` is a public interface.
  ``repoze.bfg.exceptions.PredicateMismatch`` is not a public API and
  cannot be depended upon by application code, so you should not
  change your view code to raise ``PredicateMismatch``.  Instead, move
  the logic which raised the ``NotFound`` exception in the view out
  into a custom view predicate.

- If, when you run your application's unit test suite under BFG 1.3, a
  ``KeyError`` naming a template or a ``ValueError`` indicating that a
  'renderer factory' is not registered may is raised
  (e.g. ``ValueError: No factory for renderer named '.pt' when looking
  up karl.views:templates/snippets.pt``), you may need to perform some
  extra setup in your test code.

  The best solution is to use the
  ``repoze.bfg.configuration.Configurator.testing_add_renderer`` (or,
  alternately the deprecated
  ``repoze.bfg.testing.registerTemplateRenderer`` or
  ``registerDummyRenderer``) API within the code comprising each
  individual unit test suite to register a "dummy" renderer for each
  of the templates and renderers used by code under test.  For
  example::

    config = Configurator()
    config.testing_add_renderer('karl.views:templates/snippets.pt')

  This will register a basic dummy renderer for this particular
  missing template.  The ``testing_add_renderer`` API actually
  *returns* the renderer, but if you don't care about how the render
  is used, you don't care about having a reference to it either.

  A more rough way to solve the issue exists.  It causes the "real"
  template implementations to be used while the system is under test,
  which is suboptimal, because tests will run slower, and unit tests
  won't actually *be* unit tests, but it is easier.  Always ensure you
  call the ``setup_registry()`` method of the Configurator .  Eg::

    reg = MyRegistry()
    config = Configurator(registry=reg)
    config.setup_registry()

  Calling ``setup_registry`` only has an effect if you're *passing in*
  a ``registry`` argument to the Configurator constructor.
  ``setup_registry`` is called by the course of normal operations
  anyway if you do not pass in a ``registry``.

  If your test suite isn't using a Configurator yet, and is still
  using the older ``repoze.bfg.testing`` APIs name ``setUp`` or
  ``cleanUp``, these will register the renderers on your behalf.

  A variant on the symptom for this theme exists: you may already be
  dutifully registering a dummy template or renderer for a template
  used by the code you're testing using ``testing_register_renderer``
  or ``registerTemplateRenderer``, but (perhaps unbeknownst to you)
  the code under test expects to be able to use a "real" template
  renderer implementation to retrieve or render *another* template
  that you forgot was being rendered as a side effect of calling the
  code you're testing.  This happened to work because it found the
  *real* template while the system was under test previously, and now
  it cannot.  The solution is the same.

  It may also help reduce confusion to use a *resource specification*
  to specify the template path in the test suite and code rather than
  a relative path in either.  A resource specification is unambiguous,
  while a relative path needs to be relative to "here", where "here"
  isn't always well-defined ("here" in a test suite may or may not be
  the same as "here" in the code under test).

1.3a5 (2010-07-14)
==================

Features
--------

- New internal exception: ``repoze.bfg.exceptions.URLDecodeError``.
  This URL is a subclass of the built-in Python exception named
  ``UnicodeDecodeError``.

- When decoding a URL segment to Unicode fails, the exception raised
  is now ``repoze.bfg.exceptions.URLDecodeError`` instead of
  ``UnicodeDecodeError``.  This makes it possible to register an
  exception view invoked specifically when ``repoze.bfg`` cannot
  decode a URL.

Bug Fixes
---------

- Fix regression in
  ``repoze.bfg.configuration.Configurator.add_static_view``.  Before
  1.3a4, view names that contained a slash were supported as route
  prefixes. 1.3a4 broke this by trying to treat them as full URLs.

Documentation
-------------

- The ``repoze.bfg.exceptions.URLDecodeError`` exception was added to
  the exceptions chapter of the API documentation.

Backwards Incompatibilities
----------------------------

- in previous releases, when a URL could not be decoded from UTF-8
  during traversal, a ``TypeError`` was raised.  Now the error which
  is raised is a ``repoze.bfg.exceptions.URLDecodeError``.

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)
==================

Features
--------

- A locale negotiator no longer needs to be registered explicitly. The
  default locale negotiator at
  ``repoze.bfg.i18n.default_locale_negotiator`` is now used
  unconditionally as... um, the default locale negotiator.

- The default locale negotiator has become more complex.

  * First, the negotiator looks for the ``_LOCALE_`` attribute of
    the request object (possibly set by a view or an event listener).
  
  * Then it looks for the ``request.params['_LOCALE_']`` value.

  * Then it looks for the ``request.cookies['_LOCALE_']`` value.

Backwards Incompatibilities
---------------------------

- The default locale negotiator now looks for the parameter named
  ``_LOCALE_`` rather than a parameter named ``locale`` in
  ``request.params``.

Behavior Changes
----------------

- A locale negotiator may now return ``None``, signifying that the
  default locale should be used.

Documentation
-------------

- Documentation concerning locale negotiation in the
  Internationalizationa and Localization chapter was updated.

- Expanded portion of i18n narrative chapter docs which discuss
  working with gettext files.

1.3a1 (2010-04-26)
==================

Features
--------

- Added "exception views".  When you use an exception (anything that
  inherits from the Python ``Exception`` builtin) as view context
  argument, e.g.::

      from repoze.bfg.view import bfg_view
      from repoze.bfg.exceptions import NotFound
      from webob.exc import HTTPNotFound

      @bfg_view(context=NotFound)
      def notfound_view(request):
          return HTTPNotFound()

  For the above example, when the ``repoze.bfg.exceptions.NotFound``
  exception is raised by any view or any root factory, the
  ``notfound_view`` view callable will be invoked and its response
  returned.

  Other normal view predicates can also be used in combination with an
  exception view registration::

      from repoze.bfg.view import bfg_view
      from repoze.bfg.exceptions import NotFound
      from webob.exc import HTTPNotFound

      @bfg_view(context=NotFound, route_name='home')
      def notfound_view(request):
          return HTTPNotFound()

  The above exception view names the ``route_name`` of ``home``,
  meaning that it will only be called when the route matched has a
  name of ``home``.  You can therefore have more than one exception
  view for any given exception in the system: the "most specific" one
  will be called when the set of request circumstances which match the
  view registration.  The only predicate that cannot be not be used
  successfully is ``name``.  The name used to look up an exception
  view is always the empty string.

  Existing (pre-1.3) normal views registered against objects
  inheriting from ``Exception`` will continue to work.  Exception
  views used for user-defined exceptions and system exceptions used as
  contexts will also work.

  The feature can be used with any view registration mechanism
  (``@bfg_view`` decorator, ZCML, or imperative ``config.add_view``
  styles).

  This feature was kindly contributed by Andrey Popp.

- Use "Venusian" (`http://docs.repoze.org/venusian
  <http://docs.repoze.org/venusian>`_) to perform ``bfg_view``
  decorator scanning rather than relying on a BFG-internal decorator
  scanner.  (Truth be told, Venusian is really just a generalization
  of the BFG-internal decorator scanner).

- Internationalization and localization features as documented in the
  narrative documentation chapter entitled ``Internationalization and
  Localization``.

- A new deployment setting named ``default_locale_name`` was added.
  If this string is present as a Paster ``.ini`` file option, it will
  be considered the default locale name.  The default locale name is
  used during locale-related operations such as language translation.

- It is now possible to turn on Chameleon template "debugging mode"
  for all Chameleon BFG templates by setting a BFG-related Paster
  ``.ini`` file setting named ``debug_templates``. The exceptions
  raised by Chameleon templates when a rendering fails are sometimes
  less than helpful.  ``debug_templates`` allows you to configure your
  application development environment so that exceptions generated by
  Chameleon during template compilation and execution will contain
  more helpful debugging information.  This mode is on by default in
  all new projects.

- Add a new method of the Configurator named ``derive_view`` which can
  be used to generate a BFG view callable from a user-supplied
  function, instance, or class. This useful for external framework and
  plugin authors wishing to wrap callables supplied by their users
  which follow the same calling conventions and response conventions
  as objects that can be supplied directly to BFG as a view callable.
  See the ``derive_view`` method in the
  ``repoze.bfg.configuration.Configurator`` docs.

ZCML
----

- Add a ``translationdir`` ZCML directive to support localization.

- Add a ``localenegotiator`` ZCML directive to support localization.

Deprecations
------------

-  The exception views feature replaces the need for the
   ``set_notfound_view`` and ``set_forbidden_view`` methods of the
   ``Configurator`` as well as the ``notfound`` and ``forbidden`` ZCML
   directives.  Those methods and directives will continue to work for
   the foreseeable future, but they are deprecated in the
   documentation.

Dependencies
------------

- A new install-time dependency on the ``venusian`` distribution was
  added.

- A new install-time dependency on the ``translationstring``
  distribution was added.

- Chameleon 1.2.3 or better is now required (internationalization and
  per-template debug settings).

Internal
--------

- View registrations and lookups are now done with three "requires"
  arguments instead of two to accomodate orthogonality of exception
  views.

- The ``repoze.bfg.interfaces.IForbiddenView`` and
  ``repoze.bfg.interfaces.INotFoundView`` interfaces were removed;
  they weren't APIs and they became vestigial with the addition of
  exception views.

- Remove ``repoze.bfg.compat.pkgutil_26.py`` and import alias
  ``repoze.bfg.compat.walk_packages``.  These were only required by
  internal scanning machinery; Venusian replaced the internal scanning
  machinery, so these are no longer required.

Documentation
-------------

- Exception view documentation was added to the ``Hooks`` narrative
  chapter.

- A new narrative chapter entitled ``Internationalization and
  Localization`` was added.

- The "Environment Variables and ``ini`` File Settings" chapter was
  changed: documentation about the ``default_locale_name`` setting was
  added.

- A new API chapter for the ``repoze.bfg.i18n`` module was added.

- Documentation for the new ``translationdir`` and
  ``localenegotiator`` ZCML directives were added.

- A section was added to the Templates chapter entitled "Nicer
  Exceptions in Templates" describing the result of setting
  ``debug_templates = true``.

Paster Templates
----------------

- All paster templates now create a ``setup.cfg`` which includes
  commands related to nose testing and Babel message catalog
  extraction/compilation.

- A ``default_locale_name = en`` setting was added to each existing paster
  template.

- A ``debug_templates = true`` setting was added to each existing
  paster template.

Licensing
---------

- The Edgewall (BSD) license was added to the LICENSES.txt file, as
  some code in the ``repoze.bfg.i18n`` derives from Babel source.

1.2 (2010-02-10)
================

- No changes from 1.2b6.

1.2b6 (2010-02-06)
==================

Backwards Incompatibilities
---------------------------

- Remove magical feature of ``repoze.bfg.url.model_url`` which
  prepended a fully-expanded urldispatch route URL before a the
  model's path if it was noticed that the request had matched a route.
  This feature was ill-conceived, and didn't work in all scenarios.

Bug Fixes
---------

- More correct conversion of provided ``renderer`` values to resource
  specification values (internal).

1.2b5 (2010-02-04)
==================

Bug Fixes
---------

- 1.2b4 introduced a bug whereby views added via a route configuration
  that named a view callable and also a ``view_attr`` became broken.
  Symptom: ``MyViewClass is not callable`` or the ``__call__`` of a
  class was being called instead of the method named via
  ``view_attr``.

- Fix a bug whereby a ``renderer`` argument to the ``@bfg_view``
  decorator that provided a package-relative template filename might
  not have been resolved properly.  Symptom: inappropriate ``Missing
  template resource`` errors.

1.2b4 (2010-02-03)
==================

Documentation
-------------

- Update GAE tutorial to use Chameleon instead of Jinja2 (now that
  it's possible).

Bug Fixes
---------

- Ensure that ``secure`` flag for AuthTktAuthenticationPolicy
  constructor does what it's documented to do (merge Daniel Holth's
  fancy-cookies-2 branch).

Features
--------

- Add ``path`` and ``http_only`` options to
  AuthTktAuthenticationPolicy constructor (merge Daniel Holth's
  fancy-cookies-2 branch).

Backwards Incompatibilities
---------------------------

- Remove ``view_header``, ``view_accept``, ``view_xhr``,
  ``view_path_info``, ``view_request_method``, ``view_request_param``,
  and ``view_containment`` predicate arguments from the
  ``Configurator.add_route`` argument list.  These arguments were
  speculative.  If you need the features exposed by these arguments,
  add a view associated with a route using the ``route_name`` argument
  to the ``add_view`` method instead.

- Remove ``view_header``, ``view_accept``, ``view_xhr``,
  ``view_path_info``, ``view_request_method``, ``view_request_param``,
  and ``view_containment`` predicate arguments from the ``route`` ZCML
  directive attribute set.  These attributes were speculative.  If you
  need the features exposed by these attributes, add a view associated
  with a route using the ``route_name`` attribute of the ``view`` ZCML
  directive instead.

Dependencies
------------

- Remove dependency on ``sourcecodegen`` (not depended upon by
  Chameleon 1.1.1+).

1.2b3 (2010-01-24)
==================

Bug Fixes
---------

- When "hybrid mode" (both traversal and urldispatch) is in use,
  default to finding route-related views even if a non-route-related
  view registration has been made with a more specific context.  The
  default used to be to find views with a more specific context first.
  Use the new ``use_global_views`` argument to the route definition to
  get back the older behavior.

Features
--------

- Add ``use_global_views`` argument to ``add_route`` method of
  Configurator.  When this argument is true, views registered for *no*
  route will be found if no more specific view related to the route is
  found.

- Add ``use_global_views`` attribute to ZCML ``<route>`` directive
  (see above).

Internal
--------

- When registering a view, register the view adapter with the
  "requires" interfaces as ``(request_type, context_type)`` rather
  than ``(context_type, request_type)``.  This provides for saner
  lookup, because the registration will always be made with a specific
  request interface, but registration may not be made with a specific
  context interface.  In general, when creating multiadapters, you
1384
  want to order the requires interfaces so that the elements which
1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862
  are more likely to be registered using specific interfaces are
  ordered before those which are less likely.

1.2b2 (2010-01-21)
==================

Bug Fixes
---------

- When the ``Configurator`` is passed an instance of
  ``zope.component.registry.Components`` as a ``registry`` constructor
  argument, fix the instance up to have the attributes we expect of an
  instance of ``repoze.bfg.registry.Registry`` when ``setup_registry``
  is called.  This makes it possible to use the global Zope component
  registry as a BFG application registry.

- When WebOb 0.9.7.1 was used, a deprecation warning was issued for
  the class attribute named ``charset`` within
  ``repoze.bfg.request.Request``.  BFG now *requires* WebOb >= 0.9.7,
  and code was added so that this deprecation warning has disappeared.

- Fix a view lookup ordering bug whereby a view with a larger number
  of predicates registered first (literally first, not "earlier") for
  a triad would lose during view lookup to one registered with fewer.

- Make sure views with exactly N custom predicates are always called
  before views with exactly N non-custom predicates given all else is
  equal in the view configuration.

Documentation
-------------

- Change renderings of ZCML directive documentation.

- Add a narrative documentation chapter: "Using the Zope Component
  Architecture in repoze.bfg".

Dependencies
------------

- Require WebOb >= 0.9.7

1.2b1 (2010-01-18)
==================

Bug Fixes
---------

- In ``bfg_routesalchemy``, ``bfg_alchemy`` paster templates and the
  ``bfgwiki2`` tutorial, clean up the SQLAlchemy connection by
  registering a ``repoze.tm.after_end`` callback instead of relying on
  a ``__del__`` method of a ``Cleanup`` class added to the WSGI
  environment.  The ``__del__`` strategy was fragile and caused
  problems in the wild.  Thanks to Daniel Holth for testing.

Features
--------

- Read logging configuration from PasteDeploy config file ``loggers``
  section (and related) when ``paster bfgshell`` is invoked.

Documentation
-------------

- Major rework in preparation for book publication.

1.2a11 (2010-01-05)
===================

Bug Fixes
---------

- Make ``paster bfgshell`` and ``paster create -t bfg_xxx`` work on
  Jython (fix minor incompatibility with treatment of ``__doc__`` at
  the class level).

- Updated dependency on ``WebOb`` to require a version which supports
  features now used in tests.

Features
--------

- Jython compatibility (at least when repoze.bfg.jinja2 is used as the
  templating engine; Chameleon does not work under Jython).

- Show the derived abspath of template resource specifications in the
  traceback when a renderer template cannot be found.

- Show the original traceback when a Chameleon template cannot be
  rendered due to a platform incompatibility.

1.2a10 (2010-01-04)
===================

Features
--------

- The ``Configurator.add_view`` method now accepts an argument named
  ``context``.  This is an alias for the older argument named
  ``for_``; it is preferred over ``for_``, but ``for_`` will continue
  to be supported "forever".

- The ``view`` ZCML directive now accepts an attribute named
  ``context``.  This is an alias for the older attribute named
  ``for``; it is preferred over ``for``, but ``for`` will continue to
  be supported "forever".

- The ``Configurator.add_route`` method now accepts an argument named
  ``view_context``.  This is an alias for the older argument named
  ``view_for``; it is preferred over ``view_for``, but ``view_for``
  will continue to be supported "forever".

- The ``route`` ZCML directive now accepts an attribute named
  ``view_context``.  This is an alias for the older attribute named
  ``view_for``; it is preferred over ``view_for``, but ``view_for``
  will continue to be supported "forever".

Documentation and Paster Templates
----------------------------------

- LaTeX rendering tweaks.

- All uses of the ``Configurator.add_view`` method that used its
  ``for_`` argument now use the ``context`` argument instead.

- All uses of the ``Configurator.add_route`` method that used its
  ``view_for`` argument now use the ``view_context`` argument instead.

- All uses of the ``view`` ZCML directive that used its ``for``
  attribute now use the ``context`` attribute instead.

- All uses of the ``route`` ZCML directive that used its ``view_for``
  attribute now use the ``view_context`` attribute instead.

- Add a (minimal) tutorial dealing with use of ``repoze.catalog`` in a
  ``repoze.bfg`` application.

Documentation Licensing
-----------------------

- Loosen the documentation licensing to allow derivative works: it is
  now offered under the `Creative Commons
  Attribution-Noncommercial-Share Alike 3.0 United States License
  <http://creativecommons.org/licenses/by-nc-sa/3.0/us/>`_.  This is
  only a documentation licensing change; the ``repoze.bfg`` software
  continues to be offered under the Repoze Public License at
  http://repoze.org/license.html (BSD-like).

1.2a9 (2009-12-27)
==================

Documentation Licensing
-----------------------

- The *documentation* (the result of ``make <html|latex|htmlhelp>``
  within the ``docs`` directory) in this release is now offered under
  the Creative Commons Attribution-Noncommercial-No Derivative Works
  3.0 United States License as described by
  http://creativecommons.org/licenses/by-nc-nd/3.0/us/ .  This is only
  a licensing change for the documentation; the ``repoze.bfg``
  software continues to be offered under the Repoze Public License
  at http://repoze.org/license.html (BSD-like).

Documentation
-------------

- Added manual index entries to generated index.

- Document the previously existing (but non-API)
  ``repoze.bfg.configuration.Configurator.setup_registry`` method as
  an official API of a ``Configurator``.

- Fix syntax errors in various documentation code blocks.

- Created new top-level documentation section: "ZCML Directives".
  This section contains detailed ZCML directive information, some of
  which was removed from various narrative chapters.

- The LaTeX rendering of the documentation has been improved.

- Added a "Fore-Matter" section with author, copyright, and licensing
  information.

1.2a8 (2009-12-24)
==================

Features
--------

- Add a ``**kw`` arg to the ``Configurator.add_settings`` API.

- Add ``hook_zca`` and ``unhook_zca`` methods to the ``Configurator``
  API.

- The ``repoze.bfg.testing.setUp`` method now returns a
  ``Configurator`` instance which can be used to do further
  configuration during unit tests.

Bug Fixes
---------

- The ``json`` renderer failed to set the response content type to
  ``application/json``.  It now does, by setting
  ``request.response_content_type`` unless this attribute is already
  set.

- The ``string`` renderer failed to set the response content type to
  ``text/plain``.  It now does, by setting
  ``request.response_content_type`` unless this attribute is already
  set.

Documentation
-------------

- General documentation improvements by using better Sphinx roles such
  as "class", "func", "meth", and so on.  This means that there are
  many more hyperlinks pointing to API documentation for API
  definitions in all narrative, tutorial, and API documentation
  elements.

- Added a description of imperative configuration in various places
  which only described ZCML configuration.

- A syntactical refreshing of various tutorials.

- Added the ``repoze.bfg.authentication``,
  ``repoze.bfg.authorization``, and ``repoze.bfg.interfaces`` modules
  to API documentation.

Deprecations
------------

- The ``repoze.bfg.testing.registerRoutesMapper`` API (added in an
  early 1.2 alpha) was deprecated.  Its import now generates a
  deprecation warning.

1.2a7 (2009-12-20)
==================

Features
--------

- Add four new testing-related APIs to the
  ``repoze.bfg.configuration.Configurator`` class:
  ``testing_securitypolicy``, ``testing_models``,
  ``testing_add_subscriber``, and ``testing_add_template``.  These
  were added in order to provide more direct access to the
  functionality of the ``repoze.bfg.testing`` APIs named
  ``registerDummySecurityPolicy``, ``registerModels``,
  ``registerEventListener``, and ``registerTemplateRenderer`` when a
  configurator is used.  The ``testing`` APIs named are nominally
  deprecated (although they will likely remain around "forever", as
  they are in heavy use in the wild).

- Add a new API to the ``repoze.bfg.configuration.Configurator``
  class: ``add_settings``.  This API can be used to add "settings"
  (information returned within via the
  ``repoze.bfg.settings.get_settings`` API) after the configurator has
  been initially set up.  This is most useful for testing purposes.

- Add a ``custom_predicates`` argument to the ``Configurator``
  ``add_view`` method, the ``bfg_view`` decorator and the attribute
  list of the ZCML ``view`` directive.  If ``custom_predicates`` is
  specified, it must be a sequence of predicate callables (a predicate
  callable accepts two arguments: ``context`` and ``request`` and
  returns ``True`` or ``False``).  The associated view callable will
  only be invoked if all custom predicates return ``True``.  Use one
  or more custom predicates when no existing predefined predicate is
  useful.  Predefined and custom predicates can be mixed freely.

- Add a ``custom_predicates`` argument to the ``Configurator``
  ``add_route`` and the attribute list of the ZCML ``route``
  directive.  If ``custom_predicates`` is specified, it must be a
  sequence of predicate callables (a predicate callable accepts two
  arguments: ``context`` and ``request`` and returns ``True`` or
  ``False``).  The associated route will match will only be invoked if
  all custom predicates return ``True``, else route matching
  continues.  Note that the value ``context`` will always be ``None``
  when passed to a custom route predicate.  Use one or more custom
  predicates when no existing predefined predicate is useful.
  Predefined and custom predicates can be mixed freely.

Internal
--------

- Remove the ``repoze.bfg.testing.registerTraverser`` function.  This
  function was never an API.

Documenation
------------

- Doc-deprecated most helper functions in the ``repoze.bfg.testing``
  module.  These helper functions likely won't be removed any time
  soon, nor will they generate a warning any time soon, due to their
  heavy use in the wild, but equivalent behavior exists in methods of
  a Configurator.

1.2a6 (2009-12-18)
==================

Features
--------

- The ``Configurator`` object now has two new methods: ``begin`` and
  ``end``.  The ``begin`` method is meant to be called before any
  "configuration" begins (e.g. before ``add_view``, et. al are
  called).  The ``end`` method is meant to be called after all
  "configuration" is complete.

  Previously, before there was imperative configuration at all (1.1
  and prior), configuration begin and end was invariably implied by
  the process of loading a ZCML file.  When a ZCML load happened, the
  threadlocal data structure containing the request and registry was
  modified before the load, and torn down after the load, making sure
  that all framework code that needed ``get_current_registry`` for the
  duration of the ZCML load was satisfied.

  Some API methods called during imperative configuration, (such as
  ``Configurator.add_view`` when a renderer is involved) end up for
  historical reasons calling ``get_current_registry``.  However, in
  1.2a5 and below, the Configurator supplied no functionality that
  allowed people to make sure that ``get_current_registry`` returned
  the registry implied by the configurator being used.  ``begin`` now
  serves this purpose.  Inversely, ``end`` pops the thread local
  stack, undoing the actions of ``begin``.

  We make this boundary explicit to reduce the potential for confusion
  when the configurator is used in different circumstances (e.g. in
  unit tests and app code vs. just in initial app setup).

  Existing code written for 1.2a1-1.2a5 which does not call ``begin``
  or ``end`` continues to work in the same manner it did before.  It
  is however suggested that this code be changed to call ``begin`` and
  ``end`` to reduce the potential for confusion in the future.

- All ``paster`` templates which generate an application skeleton now
  make use of the new ``begin`` and ``end`` methods of the
  Configurator they use in their respective copies of ``run.py`` and
  ``tests.py``.

Documentation
-------------

- All documentation that makes use of a ``Configurator`` object to do
  application setup and test setup now makes use of the new ``begin``
  and ``end`` methods of the configurator.

Bug Fixes
---------

- When a ``repoze.bfg.exceptions.NotFound`` or
  ``repoze.bfg.exceptions.Forbidden`` *class* (as opposed to instance)
  was raised as an exception within a root factory (or route root
  factory), the exception would not be caught properly by the
  ``repoze.bfg.`` Router and it would propagate to up the call stack,
  as opposed to rendering the not found view or the forbidden view as
  would have been expected.

- When Chameleon page or text templates used as renderers were added
  imperatively (via ``Configurator.add_view`` or some derivative),
  they too-eagerly attempted to look up the ``reload_templates``
  setting via ``get_settings``, meaning they were always registered in
  non-auto-reload-mode (the default).  Each now waits until its
  respective ``template`` attribute is accessed to look up the value.

- When a route with the same name as a previously registered route was
  added, the old route was not removed from the mapper's routelist.
  Symptom: the old registered route would be used (and possibly
  matched) during route lookup when it should not have had a chance to
  ever be used.

1.2a5 (2009-12-10)
==================

Features
--------

- When the ``repoze.bfg.exceptions.NotFound`` or
  ``repoze.bfg.exceptions.Forbidden`` error is raised from within a
  custom root factory or the ``factory`` of a route, the appropriate
  response is now sent to the requesting user agent (the result of the
  notfound view or the forbidden view, respectively).  When these
  errors are raised from within a root factory, the ``context`` passed
  to the notfound or forbidden view will be ``None``.  Also, the
  request will not be decorated with ``view_name``, ``subpath``,
  ``context``, etc. as would normally be the case if traversal had
  been allowed to take place.

Internals
---------

- The exception class representing the error raised by various methods
  of a ``Configurator`` is now importable as
  ``repoze.bfg.exceptions.ConfigurationError``.

Documentation
-------------

- General documentation freshening which takes imperative
  configuration into account in more places and uses glossary
  references more liberally.

- Remove explanation of changing the request type in a new request
  event subscriber, as other predicates are now usually an easier way
  to get this done.

- Added "Thread Locals" narrative chapter to documentation, and added
  a API chapter documenting the ``repoze.bfg.threadlocals`` module.

- Added a "Special Exceptions" section to the "Views" narrative
  documentation chapter explaining the effect of raising
  ``repoze.bfg.exceptions.NotFound`` and
  ``repoze.bfg.exceptions.Forbidden`` from within view code.

Dependencies
------------

- A new dependency on the ``twill`` package was added to the
  ``setup.py`` ``tests_require`` argument (Twill will only be
  downloaded when ``repoze.bfg`` ``setup.py test`` or ``setup.py
  nosetests`` is invoked).

1.2a4 (2009-12-07)
==================

Features
--------

- ``repoze.bfg.testing.DummyModel`` now accepts a new constructor
  keyword argument: ``__provides__``.  If this constructor argument is
  provided, it should be an interface or a tuple of interfaces.  The
  resulting model will then provide these interfaces (they will be
  attached to the constructed model via
  ``zope.interface.alsoProvides``).

Bug Fixes
---------

- Operation on GAE was broken, presumably because the
  ``repoze.bfg.configuration`` module began to attempt to import the
  ``repoze.bfg.chameleon_zpt`` and ``repoze.bfg.chameleon_text``
  modules, and these cannot be used on non-CPython platforms.  It now
  tolerates startup time import failures for these modules, and only
  raise an import error when a template from one of these packages is
  actually used.

1.2a3 (2009-12-02)
==================

Bug Fixes
---------

- The ``repoze.bfg.url.route_url`` function inappropriately passed
  along ``_query`` and/or ``_anchor`` arguments to the
  ``mapper.generate`` function, resulting in blowups.

- When two views were registered with differering ``for`` interfaces
  or classes, and the ``for`` of first view registered was a
  superclass of the second, the ``repoze.bfg`` view machinery would
  incorrectly associate the two views with the same "multiview".
  Multiviews are meant to be collections of views that have *exactly*
  the same for/request/viewname values, without taking inheritance
  into account.  Symptom: wrong view callable found even when you had
  correctly specified a ``for_`` interface/class during view
  configuration for one or both view configurations.

Backwards Incompatibilities
---------------------------

- The ``repoze.bfg.templating`` module has been removed; it had been
  deprecated in 1.1 and never actually had any APIs in it.

1.2a2 (2009-11-29)
==================

Bug Fixes
---------

1863
- The long description of this package (as shown on PyPI) was not
1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922
  valid reStructuredText, and so was not renderable.

- Trying to use an HTTP method name string such as ``GET`` as a
  ``request_type`` predicate argument caused a startup time failure
  when it was encountered in imperative configuration or in a
  decorator (symptom: ``Type Error: Required specification must be a
  specification``).  This now works again, although ``request_method``
  is now the preferred predicate argument for associating a view
  configuration with an HTTP request method.

Documentation
-------------

- Fixed "Startup" narrative documentation chapter; it was explaining
  "the old way" an application constructor worked.

1.2a1 (2009-11-28)
==================

Features
--------

- An imperative configuration mode.

  A ``repoze.bfg`` application can now begin its life as a single
  Python file.  Later, the application might evolve into a set of
  Python files in a package.  Even later, it might start making use of
  other configuration features, such as ``ZCML``.  But neither the use
  of a package nor the use of non-imperative configuration is required
  to create a simple ``repoze.bfg`` application any longer.

  Imperative configuration makes ``repoze.bfg`` competetive with
  "microframeworks" such as `Bottle <http://bottle.paws.de/>`_ and
  `Tornado <http://www.tornadoweb.org/>`_.  ``repoze.bfg`` has a good
  deal of functionality that most microframeworks lack, so this is
  hopefully a "best of both worlds" feature.

  The simplest possible ``repoze.bfg`` application is now::

     from webob import Response
     from wsgiref import simple_server
     from repoze.bfg.configuration import Configurator

     def hello_world(request):
         return Response('Hello world!')

     if __name__ == '__main__':
         config = Configurator()
         config.add_view(hello_world)
         app = config.make_wsgi_app()
         simple_server.make_server('', 8080, app).serve_forever()

- A new class now exists: ``repoze.bfg.configuration.Configurator``.
  This class forms the basis for sharing machinery between
  "imperatively" configured applications and traditional
  declaratively-configured applications.

- The ``repoze.bfg.testing.setUp`` function now accepts three extra
  optional keyword arguments: ``registry``, ``request`` and
  ``hook_zca``.

  If the ``registry`` argument is not ``None``, the argument will be
  treated as the registry that is set as the "current registry" (it
  will be returned by ``repoze.bfg.threadlocal.get_current_registry``)
  for the duration of the test.  If the ``registry`` argument is
  ``None`` (the default), a new registry is created and used for the
  duration of the test.

  The value of the ``request`` argument is used as the "current
  request" (it will be returned by
  ``repoze.bfg.threadlocal.get_current_request``) for the duration of
  the test; it defaults to ``None``.

  If ``hook_zca`` is ``True`` (the default), the
  ``zope.component.getSiteManager`` function will be hooked with a
  function that returns the value of ``registry`` (or the
  default-created registry if ``registry`` is ``None``) instead of the
  registry returned by ``zope.component.getGlobalSiteManager``,
  causing the Zope Component Architecture API (``getSiteManager``,
  ``getAdapter``, ``getUtility``, and so on) to use the testing
  registry instead of the global ZCA registry.

- The ``repoze.bfg.testing.tearDown`` function now accepts an
  ``unhook_zca`` argument.  If this argument is ``True`` (the
  default), ``zope.component.getSiteManager.reset()`` will be called.
  This will cause the result of the ``zope.component.getSiteManager``
  function to be the global ZCA registry (the result of
  ``zope.component.getGlobalSiteManager``) once again.

- The ``run.py`` module in various ``repoze.bfg`` ``paster`` templates
  now use a ``repoze.bfg.configuration.Configurator`` class instead of
  the (now-legacy) ``repoze.bfg.router.make_app`` function to produce
  a WSGI application.

Documentation
-------------

- The documentation now uses the "request-only" view calling
  convention in most examples (as opposed to the ``context, request``
  convention).  This is a documentation-only change; the ``context,
  request`` convention is also supported and documented, and will be
  "forever".

- ``repoze.bfg.configuration`` API documentation has been added.

- A narrative documentation chapter entitled "Creating Your First
  ``repoze.bfg`` Application" has been added.  This chapter details
  usage of the new ``repoze.bfg.configuration.Configurator`` class,
  and demonstrates a simplified "imperative-mode" configuration; doing
  ``repoze.bfg`` application configuration imperatively was previously
  much more difficult.

- A narrative documentation chapter entitled "Configuration,
  Decorations and Code Scanning" explaining ZCML- vs. imperative-
  vs. decorator-based configuration equivalence.

- The "ZCML Hooks" chapter has been renamed to "Hooks"; it documents
  how to override hooks now via imperative configuration and ZCML.

- The explanation about how to supply an alternate "response factory"
  has been removed from the "Hooks" chapter.  This feature may be
  removed in a later release (it still works now, it's just not
  documented).

- Add a section entitled "Test Set Up and Tear Down" to the
  unittesting chapter.

Bug Fixes
----------

- The ACL authorization policy debugging output when
  ``debug_authorization`` console debugging output was turned on
  wasn't as clear as it could have been when a view execution was
  denied due to an authorization failure resulting from the set of
  principals passed never having matched any ACE in any ACL in the
  lineage.  Now in this case, we report ``<default deny>`` as the ACE
  value and either the root ACL or ``<No ACL found on any object in
  model lineage>`` if no ACL was found.

- When two views were registered with the same ``accept`` argument,
  but were otherwise registered with the same arguments, if a request
  entered the application which had an ``Accept`` header that accepted
  *either* of the media types defined by the set of views registered
  with predicates that otherwise matched, a more or less "random" one
  view would "win".  Now, we try harder to use the view callable
  associated with the view configuration that has the most specific
  ``accept`` argument.  Thanks to Alberto Valverde for an initial
  patch.

Internals
---------

- The routes mapper is no longer a root factory wrapper.  It is now
  consulted directly by the router.

- The ``repoze.bfg.registry.make_registry`` callable has been removed.

- The ``repoze.bfg.view.map_view`` callable has been removed.

- The ``repoze.bfg.view.owrap_view`` callable has been removed.

- The ``repoze.bfg.view.predicate_wrap`` callable has been removed.

- The ``repoze.bfg.view.secure_view`` callable has been removed.

- The ``repoze.bfg.view.authdebug_view`` callable has been removed.

- The ``repoze.bfg.view.renderer_from_name`` callable has been
  removed.  Use ``repoze.bfg.configuration.Configurator.renderer_from_name``
  instead (still not an API, however).

- The ``repoze.bfg.view.derive_view`` callable has been removed.  Use
  ``repoze.bfg.configuration.Configurator.derive_view`` instead (still
  not an API, however).

- The ``repoze.bfg.settings.get_options`` callable has been removed.
  Its job has been subsumed by the ``repoze.bfg.settings.Settings``
  class constructor.

- The ``repoze.bfg.view.requestonly`` function has been moved to
  ``repoze.bfg.configuration.requestonly``.

- The ``repoze.bfg.view.rendered_response`` function has been moved to
  ``repoze.bfg.configuration.rendered_response``.

- The ``repoze.bfg.view.decorate_view`` function has been moved to
  ``repoze.bfg.configuration.decorate_view``.

- The ``repoze.bfg.view.MultiView`` class has been moved to
  ``repoze.bfg.configuration.MultiView``.

- The ``repoze.bfg.zcml.Uncacheable`` class has been removed.

- The ``repoze.bfg.resource.resource_spec`` function has been removed.

- All ZCML directives which deal with attributes which are paths now
  use the ``path`` method of the ZCML context to resolve a relative
  name to an absolute one (imperative configuration requirement).

- The ``repoze.bfg.scripting.get_root`` API now uses a 'real' WebOb
  request rather than a FakeRequest when it sets up the request as a
  threadlocal.

- The ``repoze.bfg.traversal.traverse`` API now uses a 'real' WebOb
  request rather than a FakeRequest when it calls the traverser.

- The ``repoze.bfg.request.FakeRequest`` class has been removed.

- Most uses of the ZCA threadlocal API (the ``getSiteManager``,
  ``getUtility``, ``getAdapter``, ``getMultiAdapter`` threadlocal API)
  have been removed from the core.  Instead, when a threadlocal is
  necessary, the core uses the
  ``repoze.bfg.threadlocal.get_current_registry`` API to obtain the
  registry.

- The internal ILogger utility named ``repoze.bfg.debug`` is now just
  an IDebugLogger unnamed utility.  A named utility with the old name
  is registered for b/w compat.

- The ``repoze.bfg.interfaces.ITemplateRendererFactory`` interface was
  removed; it has become unused.

- Instead of depending on the ``martian`` package to do code scanning,
  we now just use our own scanning routines.

- We now no longer have a dependency on ``repoze.zcml`` package;
  instead, the ``repoze.bfg`` package includes implementations of the
  ``adapter``, ``subscriber`` and ``utility`` directives.

- Relating to the following functions:

  ``repoze.bfg.view.render_view``

  ``repoze.bfg.view.render_view_to_iterable``

  ``repoze.bfg.view.render_view_to_response``

  ``repoze.bfg.view.append_slash_notfound_view``

  ``repoze.bfg.view.default_notfound_view``

  ``repoze.bfg.view.default_forbidden_view``

  ``repoze.bfg.configuration.rendered_response``

  ``repoze.bfg.security.has_permission``

  ``repoze.bfg.security.authenticated_userid``

  ``repoze.bfg.security.effective_principals``

  ``repoze.bfg.security.view_execution_permitted``

  ``repoze.bfg.security.remember``

  ``repoze.bfg.security.forget``

  ``repoze.bfg.url.route_url``

  ``repoze.bfg.url.model_url``

  ``repoze.bfg.url.static_url``

  ``repoze.bfg.traversal.virtual_root``

  Each of these functions now expects to be called with a request
  object that has a ``registry`` attribute which represents the
  current ``repoze.bfg`` registry.  They fall back to obtaining the
  registry from the threadlocal API.

Backwards Incompatibilites
--------------------------

- Unit tests which use ``zope.testing.cleanup.cleanUp`` for the
  purpose of isolating tests from one another may now begin to fail
  due to lack of isolation between tests.

  Here's why: In repoze.bfg 1.1 and prior, the registry returned by
  ``repoze.bfg.threadlocal.get_current_registry`` when no other
  registry had been pushed on to the threadlocal stack was the
  ``zope.component.globalregistry.base`` global registry (aka the
  result of ``zope.component.getGlobalSiteManager()``).  In repoze.bfg
  1.2+, however, the registry returned in this situation is the new
  module-scope ``repoze.bfg.registry.global_registry`` object.  The
  ``zope.testing.cleanup.cleanUp`` function clears the
  ``zope.component.globalregistry.base`` global registry
  unconditionally.  However, it does not know about the
  ``repoze.bfg.registry.global_registry`` object, so it does not clear
  it.

  If you use the ``zope.testing.cleanup.cleanUp`` function in the
  ``setUp`` of test cases in your unit test suite instead of using the
  (more correct as of 1.1) ``repoze.bfg.testing.setUp``, you will need
  to replace all calls to ``zope.testing.cleanup.cleanUp`` with a call
  to ``repoze.bfg.testing.setUp``.

  If replacing all calls to ``zope.testing.cleanup.cleanUp`` with a
  call to ``repoze.bfg.testing.setUp`` is infeasible, you can put this
  bit of code somewhere that is executed exactly **once** (*not* for
  each test in a test suite; in the `` __init__.py`` of your package
  or your package's ``tests`` subpackage would be a reasonable
  place)::

    import zope.testing.cleanup
    from repoze.bfg.testing import setUp
    zope.testing.cleanup.addCleanUp(setUp)

- When there is no "current registry" in the
  ``repoze.bfg.threadlocal.manager`` threadlocal data structure (this
  is the case when there is no "current request" or we're not in the
  midst of a ``r.b.testing.setUp``-bounded unit test), the ``.get``
  method of the manager returns a data structure containing a *global*
  registry.  In previous releases, this function returned the global
  Zope "base" registry: the result of
  ``zope.component.getGlobalSiteManager``, which is an instance of the
  ``zope.component.registry.Component`` class.  In this release,
  however, the global registry returns a globally importable instance
  of the ``repoze.bfg.registry.Registry`` class.  This registry
  instance can always be imported as
  ``repoze.bfg.registry.global_registry``.

  Effectively, this means that when you call
  ``repoze.bfg.threadlocal.get_current_registry`` when no request or
  ``setUp`` bounded unit test is in effect, you will always get back
  the global registry that lives in
  ``repoze.bfg.registry.global_registry``.  It also means that
  ``repoze.bfg`` APIs that *call* ``get_current_registry`` will use
  this registry.

  This change was made because ``repoze.bfg`` now expects the registry
  it uses to have a slightly different API than a bare instance of
  ``zope.component.registry.Components``.

- View registration no longer registers a
  ``repoze.bfg.interfaces.IViewPermission`` adapter (it is no longer
  checked by the framework; since 1.1, views have been responsible for
  providing their own security).

- The ``repoze.bfg.router.make_app`` callable no longer accepts the
  ``authentication_policy`` nor the ``authorization_policy``
  arguments.  This feature was deprecated in version 1.0 and has been
  removed.

- Obscure: the machinery which configured views with a
  ``request_type`` *and* a ``route_name`` would ignore the request
  interface implied by ``route_name`` registering a view only for the
  interface implied by ``request_type``.  In the unlikely event that
  you were trying to use these two features together, the symptom
  would have been that views that named a ``request_type`` but which
  were also associated with routes were not found when the route
  matched.  Now if a view is configured with both a ``request_type``
  and a ``route_name``, an error is raised.

- The ``route`` ZCML directive now no longer accepts the
  ``request_type`` or ``view_request_type`` attributes.  These
  attributes didn't actually work in any useful way (see entry above
  this one).

- Because the ``repoze.bfg`` package now includes implementations of
  the ``adapter``, ``subscriber`` and ``utility`` ZCML directives, it
  is now an error to have ``<include package="repoze.zcml"
  file="meta.zcml"/>`` in the ZCML of a ``repoze.bfg`` application.  A
  ZCML conflict error will be raised if your ZCML does so.  This
  shouldn't be an issue for "normal" installations; it has always been
  the responsibility of the ``repoze.bfg.includes`` ZCML to include
  this file in the past; it now just doesn't.

- The ``repoze.bfg.testing.zcml_configure`` API was removed.  Use
  the ``Configurator.load_zcml`` API instead.

Deprecations
------------

- The ``repoze.bfg.router.make_app`` function is now nominally
  deprecated.  Its import and usage does not throw a warning, nor will
  it probably ever disappear.  However, using a
  ``repoze.bfg.configuration.Configurator`` class is now the preferred
  way to generate a WSGI application.

  Note that ``make_app`` calls
  ``zope.component.getSiteManager.sethook(
  repoze.bfg.threadlocal.get_current_registry)`` on the caller's
  behalf, hooking ZCA global API lookups, for backwards compatibility
  purposes.  If you disuse ``make_app``, your calling code will need
  to perform this call itself, at least if your application uses the
  ZCA global API (``getSiteManager``, ``getAdapter``, etc).

Dependencies
------------

- A dependency on the ``martian`` package has been removed (its
  functionality is replaced internally).

- A dependency on the ``repoze.zcml`` package has been removed (its
  functionality is replaced internally).

1.1.1 (2009-11-21)
==================

Bug Fixes
---------

- "Hybrid mode" applications (applications which explicitly used
  traversal *after* url dispatch via ``<route>`` paths containing the
  ``*traverse`` element) were broken in 1.1-final and all 1.1 alpha
  and beta releases.  Views registered without a ``route_name`` route
  shadowed views registered with a ``route_name`` inappropriately.

1.1 (2009-11-15)
================

Internals
---------

- Remove dead IRouteRequirement interface from ``repoze.bfg.zcml``
  module.

Documentation
-------------

- Improve the "Extending an Existing Application" narrative chapter.

- Add more sections to the "Defending Design" chapter.

1.1b4 (2009-11-12)
==================

Bug Fixes
---------

- Use ``alsoProvides`` in the urldispatch module to attach an
  interface to the request rather than ``directlyProvides`` to avoid
  disturbing interfaces set in a NewRequest event handler.

Documentation
-------------

- Move 1.0.1 and previous changelog to HISTORY.txt.

- Add examples to ``repoze.bfg.url.model_url`` docstring.

- Add "Defending BFG Design" chapter to frontpage docs.

Templates
---------

- Remove ``ez_setup.py`` and its import from all paster templates,
  samples, and tutorials for ``distribute`` compatibility.  The
  documentation already explains how to install virtualenv (which will
  include some ``setuptools`` package), so these files, imports and
  usages were superfluous.

Deprecations
------------

- The ``options`` kw arg to the ``repoze.bfg.router.make_app``
  function is deprecated.  In its place is the keyword argument
  ``settings``.  The ``options`` keyword continues to work, and a
  deprecation warning is not emitted when it is detected.  However,
  the paster templates, code samples, and documentation now make
  reference to ``settings`` rather than ``options``.  This
  change/deprecation was mainly made for purposes of clarity and
  symmetry with the ``get_settings()`` API and dicussions of
  "settings" in various places in the docs: we want to use the same
  name to refer to the same thing everywhere.

1.1b3 (2009-11-06)
==================

Features
--------

- ``repoze.bfg.testing.registerRoutesMapper`` testing facility added.
  This testing function registers a routes "mapper" object in the
  registry, for tests which require its presence.  This function is
  documented in the ``repoze.bfg.testing`` API documentation.

Bug Fixes
---------

- Compound statements that used an assignment entered into in an
  interactive IPython session invoked via ``paster bfgshell`` no
  longer fail to mutate the shell namespace correctly.  For example,
  this set of statements used to fail::

    In [2]: def bar(x): return x
      ...:
    In [3]: list(bar(x) for x in 'abc')
    Out[3]: NameError: 'bar'

  In this release, the ``bar`` function is found and the correct
  output is now sent to the console.  Thanks to Daniel Holth for the
  patch.

- The ``bfgshell`` command did not function properly; it was still
  expecting to be able to call the root factory with a bare
  ``environ`` rather than a request object.

Backwards Incompatibilities
---------------------------

- The ``repoze.bfg.scripting.get_root`` function now expects a
  ``request`` object as its second argument rather than an
  ``environ``.

1.1b2 (2009-11-02)
==================

Bug Fixes
---------

- Prevent PyPI installation failure due to ``easy_install`` trying way
  too hard to guess the best version of Paste.  When ``easy_install``
  pulls from PyPI it reads links off various pages to determine "more
  up to date" versions. It incorrectly picks up a link for an ancient
  version of a package named "Paste-Deploy-0.1" (note the dash) when
  trying to find the "Paste" distribution and somehow believes it's
  the latest version of "Paste".  It also somehow "helpfully" decides
  to check out a version of this package from SVN.  We pin the Paste
  dependency version to a version greater than 1.7 to work around
  this ``easy_install`` bug.

Documentation
-------------

- Fix "Hybrid" narrative chapter: stop claiming that ``<view>``
  statements that mention a route_name need to come afer (in XML
  order) the ``<route>`` statement which creates the route.  This
  hasn't been true since 1.1a1.

- "What's New in ``repoze.bfg`` 1.1" document added to narrative
  documentation.

Features
--------

- Add a new event type: ``repoze.bfg.events.AfterTraversal``.  Events
  of this type will be sent after traversal is completed, but before
  any view code is invoked.  Like ``repoze.bfg.events.NewRequest``,
  This event will have a single attribute: ``request`` representing
  the current request.  Unlike the request attribute of
  ``repoze.bfg.events.NewRequest`` however, during an AfterTraversal
  event, the request object will possess attributes set by the
  traverser, most notably ``context``, which will be the context used
  when a view is found and invoked.  The interface
  ``repoze.bfg.events.IAfterTraversal`` can be used to subscribe to
  the event.  For example::

    <subscriber for="repoze.bfg.interfaces.IAfterTraversal"
                handler="my.app.handle_after_traverse"/>

  Like any framework event, a subscriber function should expect one
  parameter: ``event``.

Dependencies
------------

- Rather than depending on ``chameleon.core`` and ``chameleon.zpt``
  distributions individually, depend on Malthe's repackaged
  ``Chameleon`` distribution (which includes both ``chameleon.core``
  and ``chameleon.zpt``).

1.1b1 (2009-11-01)
==================

Bug Fixes
---------

- The routes root factory called route factories and the default route
  factory with an environ rather than a request.  One of the symptoms
  of this bug: applications generated using the ``bfg_zodb`` paster
  template in 1.1a9 did not work properly.

- Reinstate ``renderer`` alias for ``view_renderer`` in the
  ``<route>`` ZCML directive (in-the-wild 1.1a bw compat).

- ``bfg_routesalchemy`` paster template: change ``<route>``
  declarations: rename ``renderer`` attribute to ``view_renderer``.

- Header values returned by the ``authtktauthenticationpolicy``
  ``remember`` and ``forget`` methods would be of type ``unicode``.
  This violated the WSGI spec, causing a ``TypeError`` to be raised
  when these headers were used under ``mod_wsgi``.

- If a BFG app that had a route matching the root URL was mounted
  under a path in modwsgi, ala ``WSGIScriptAlias /myapp
  /Users/chrism/projects/modwsgi/env/bfg.wsgi``, the home route (a
  route with the path of ``'/'`` or ``''``) would not match when the
  path ``/myapp`` was visited (only when the path ``/myapp/`` was
  visited).  This is now fixed: if the urldispatch root factory notes
  that the PATH_INFO is empty, it converts it to a single slash before
  trying to do matching.

Documentation
-------------

- In ``<route>`` declarations in tutorial ZCML, rename ``renderer``
  attribute to ``view_renderer`` (fwd compat).

- Fix various tutorials broken by 1.1a9 ``<route>`` directive changes.

Internal
--------

- Deal with a potential circref in the traversal module.

1.1a9 (2009-10-31)
==================

Bug Fixes
---------

- An incorrect ZCML conflict would be encountered when the
  ``request_param`` predicate attribute was used on the ZCML ``view``
  directive if any two otherwise same-predicated views had the
  combination of a predicate value with an ``=`` sign and one without
  (e.g. ``a`` vs. ``a=123``).

Features
--------

- In previous versions of BFG, the "root factory" (the ``get_root``
  callable passed to ``make_app`` or a function pointed to by the
  ``factory`` attribute of a route) was called with a "bare" WSGI
  environment.  In this version, and going forward, it will be called
  with a ``request`` object.  The request object passed to the factory
  implements dictionary-like methods in such a way that existing root
  factory code which expects to be passed an environ will continue to
  work.

- The ``__call__`` of a plugin "traverser" implementation (registered
  as an adapter for ``ITraverser`` or ``ITraverserFactory``) will now
  receive a *request* as the single argument to its ``__call__``
  method.  In previous versions it was passed a WSGI ``environ``
  object.  The request object passed to the factory implements
  dictionary-like methods in such a way that existing traverser code
  which expects to be passed an environ will continue to work.

- The ZCML ``route`` directive's attributes ``xhr``,
  ``request_method``, ``path_info``, ``request_param``, ``header`` and
  ``accept`` are now *route* predicates rather than *view* predicates.
  If one or more of these predicates is specified in the route
  configuration, all of the predicates must return true for the route
  to match a request.  If one or more of the route predicates
  associated with a route returns ``False`` when checked during a
  request, the route match fails, and the next match in the routelist
  is tried.  This differs from the previous behavior, where no route
  predicates existed and all predicates were considered view
  predicates, because in that scenario, the next route was not tried.

Documentation
-------------

- Various changes were made to narrative and API documentation
  supporting the change from passing a request rather than an environ
  to root factories and traversers.

Internal
--------

- The request implements dictionary-like methods that mutate and query
  the WSGI environ.  This is only for the purpose of backwards
  compatibility with root factories which expect an ``environ`` rather
  than a request.

- The ``repoze.bfg.request.create_route_request_factory`` function,
  which returned a request factory was removed in favor of a
  ``repoze.bfg.request.route_request_interface`` function, which
  returns an interface.

- The ``repoze.bfg.request.Request`` class, which is a subclass of
  ``webob.Request`` now defines its own ``__setattr__``,
  ``__getattr__`` and ``__delattr__`` methods, which override the
  default WebOb behavior.  The default WebOb behavior stores
  attributes of the request in ``self.environ['webob.adhoc_attrs']``,
  and retrieves them from that dictionary during a ``__getattr__``.
  This behavior was undesirable for speed and "expectation" reasons.
  Now attributes of the ``request`` are stored in ``request.__dict__``
  (as you otherwise might expect from an object that did not override
  these methods).

- The router no longer calls ``repoze.bfg.traversal._traverse`` and
  does its work "inline" (speed).

- Reverse the order in which the router calls the request factory and
  the root factory.  The request factory is now called first; the
  resulting request is passed to the root factory.

- The ``repoze.bfg.request.request_factory`` function has been
  removed.  Its functionality is no longer required.

- The "routes root factory" that wraps the default root factory when
  there are routes mentioned in the configuration now attaches an
  interface to the request via ``zope.interface.directlyProvides``.
  This replaces logic in the (now-gone)
  ``repoze.bfg.request.request_factory`` function.

- The ``route`` and ``view`` ZCML directives now register an interface
  as a named utility (retrieved from
  ``repoze.bfg.request.route_request_interface``) rather than a
  request factory (the previous return value of the now-missing 
  ``repoze.bfg.request.create_route_request_factory``.

- The ``repoze.bfg.functional`` module was renamed to
  ``repoze.bfg.compat``.

Backwards Incompatibilities
---------------------------

- Explicitly revert the feature introduced in 1.1a8: where the name
  ``root`` is available as an attribute of the request before a
  NewRequest event is emitted.  This makes some potential future
  features impossible, or at least awkward (such as grouping traversal
  and view lookup into a single adapter lookup).

- The ``containment``, ``attr`` and ``renderer`` attributes of the
  ``route`` ZCML directive were removed.

1.1a8 (2009-10-27)
==================

Features
--------

- Add ``path_info`` view configuration predicate.

- ``paster bfgshell`` now supports IPython if it's available for
  import.  Thanks to Daniel Holth for the initial patch.

- Add ``repoze.bfg.testing.registerSettings`` API, which is documented
  in the "repoze.bfg.testing" API chapter.  This allows for
  registration of "settings" values obtained via
  ``repoze.bfg.settings.get_settings()`` for use in unit tests.

- The name ``root`` is available as an attribute of the request
  slightly earlier now (before a NewRequest event is emitted).
  ``root`` is the result of the application "root factory".

- Added ``max_age`` parameter to ``authtktauthenticationpolicy`` ZCML
  directive.  If this value is set, it must be an integer representing
  the number of seconds which the auth tkt cookie will survive.
  Mainly, its existence allows the auth_tkt cookie to survive across
  browser sessions.

Bug Fixes
---------

- Fix bug encountered during "scan" (when ``<scan ..>`` directive is
  used in ZCML) introduced in 1.1a7.  Symptom: ``AttributeError:
  object has no attribute __provides__`` raised at startup time.

- The ``reissue_time`` argument to the ``authtktauthenticationpolicy``
  ZCML directive now actually works.  When it is set to an integer
  value, an authticket set-cookie header is appended to the response
  whenever a request requires authentication and 'now' minus the
  authticket's timestamp is greater than ``reissue_time`` seconds.

Documentation
-------------

- Add a chapter titled "Request and Response" to the narrative
  documentation, content cribbed from the WebOb documentation.

- Call out predicate attributes of ZCML directive within "Views"
  chapter.

- Fix route_url documentation (``_query`` argument documented as
  ``query`` and ``_anchor`` argument documented as ``anchor``).

Backwards Incompatibilities
---------------------------

- The ``authtkt`` authentication policy ``remember`` method now no
  longer honors ``token`` or ``userdata`` keyword arguments.

Internal
--------

- Change how ``bfg_view`` decorator works when used as a class method
  decorator.  In 1.1a7, the``scan``directive actually tried to grope
  every class in scanned package at startup time, calling ``dir``
  against each found class, and subsequently invoking ``getattr``
  against each thing found by ``dir`` to see if it was a method.  This
  led to some strange symptoms (e.g. ``AttributeError: object has no
  attribute __provides__``), and was generally just a bad idea.  Now,
  instead of groping classes for methods at startup time, we just
  cause the ``bfg_view`` decorator itself to populate the method's
  class' ``__dict__`` when it is used as a method decorator.  This
  also requires a nasty _getframe thing but it's slightly less nasty
  than the startup time groping behavior.  This is essentially a
  reversion back to 1.1a6 "grokking" behavior plus some special magic
  for using the ``bfg_view`` decorator as method decorator inside the
  ``bfg_view`` class itself.

- The router now checks for a ``global_response_headers`` attribute of
  the request object before returning a response.  If this value
  exists, it is presumed to be a sequence of two-tuples, representing
  a set of headers to append to the 'normal' response headers.  This
  feature is internal, rather than exposed externally, because it's
  unclear whether it will stay around in the long term.  It was added
  to support the ``reissue_time`` feature of the authtkt
  authentication policy.

- The interface ITraverserFactory is now just an alias for ITraverser.

1.1a7 (2009-10-18)
==================

Features
--------

- More than one ``@bfg_view`` decorator may now be stacked on top of
  any number of others.  Each invocation of the decorator registers a
  single view configuration.  For instance, the following combination
  of decorators and a function will register two view configurations
  for the same view callable::

    from repoze.bfg.view import bfg_view

    @bfg_view(name='edit')
    @bfg_view(name='change')
    def edit(context, request):
        pass

  This makes it possible to associate more than one view configuration
  with a single callable without requiring any ZCML.

- The ``@bfg_view`` decorator can now be used against a class method::

    from webob import Response
    from repoze.bfg.view import bfg_view

    class MyView(object):
        def __init__(self, context, request):
            self.context = context
            self.request = request

        @bfg_view(name='hello')
        def amethod(self):
            return Response('hello from %s!' % self.context)

  When the bfg_view decorator is used against a class method, a view
  is registered for the *class* (it's a "class view" where the "attr"
  happens to be the name of the method it is attached to), so the
  class it's defined within must have a suitable constructor: one that
  accepts ``context, request`` or just ``request``.

Documentation
-------------

- Added ``Changing the Traverser`` and ``Changing How
  :mod:`repoze.bfg.url.model_url` Generates a URL`` to the "Hooks"
  narrative chapter of the docs.

Internal
--------

- Remove ``ez_setup.py`` and imports of it within ``setup.py``.  In
  the new world, and as per virtualenv setup instructions, people will
  already have either setuptools or distribute.

1.1a6 (2009-10-15)
==================

Features
--------

- Add ``xhr``, ``accept``, and ``header`` view configuration
  predicates to ZCML view declaration, ZCML route declaration, and
  ``bfg_view`` decorator.  See the ``Views`` narrative documentation
  chapter for more information about these predicates.

- Add ``setUp`` and ``tearDown`` functions to the
  ``repoze.bfg.testing`` module.  Using ``setUp`` in a test setup and
  ``tearDown`` in a test teardown is now the recommended way to do
  component registry setup and teardown.  Previously, it was
  recommended that a single function named
  ``repoze.bfg.testing.cleanUp`` be called in both the test setup and
  tear down.  ``repoze.bfg.testing.cleanUp`` still exists (and will
  exist "forever" due to its widespread use); it is now just an alias
  for ``repoze.bfg.testing.setUp`` and is nominally deprecated.

- The BFG component registry is now available in view and event
  subscriber code as an attribute of the request
  ie. ``request.registry``.  This fact is currently undocumented
  except for this note, because BFG developers never need to interact
  with the registry directly anywhere else.

- The BFG component registry now inherits from ``dict``, meaning that
  it can optionally be used as a simple dictionary.  *Component*
  registrations performed against it via e.g. ``registerUtility``,
  ``registerAdapter``, and similar API methods are kept in a
  completely separate namespace than its dict members, so using the
  its component API methods won't effect the keys and values in the
  dictionary namespace.  Likewise, though the component registry
  "happens to be" a dictionary, use of mutating dictionary methods
  such as ``__setitem__`` will have no influence on any component
  registrations made against it.  In other words, the registry object
  you obtain via e.g. ``repoze.bfg.threadlocal.get_current_registry``
  or ``request.registry`` happens to be both a component registry and
  a dictionary, but using its component-registry API won't impact data
  added to it via its dictionary API and vice versa.  This is a
  forward compatibility move based on the goals of "marco".

- Expose and document ``repoze.bfg.testing.zcml_configure`` API.  This
  function populates a component registry from a ZCML file for testing
  purposes.  It is documented in the "Unit and Integration Testing"
  chapter.

Documentation
-------------

- Virtual hosting narrative docs chapter updated with info about
  ``mod_wsgi``.

- Point all index URLs at the literal 1.1 index (this alpha cycle may
  go on a while).

- Various tutorial test modules updated to use
  ``repoze.bfg.testing.setUp`` and ``repoze.bfg.testing.tearDown``
  methods in order to encourage this as best practice going forward.

- Added "Creating Integration Tests" section to unit testing narrative
  documentation chapter.  As a result, the name of the unittesting
  chapter is now "Unit and Integration Testing".

Backwards Incompatibilities
---------------------------

- Importing ``getSiteManager`` and ``get_registry`` from
  ``repoze.bfg.registry`` is no longer supported.  These imports were
  deprecated in repoze.bfg 1.0.  Import of ``getSiteManager`` should
  be done as ``from zope.component import getSiteManager``.  Import of
  ``get_registry`` should be done as ``from repoze.bfg.threadlocal
  import get_current_registry``.  This was done to prevent a circular
  import dependency.

- Code bases which alternately invoke both
  ``zope.testing.cleanup.cleanUp`` and ``repoze.bfg.testing.cleanUp``
  (treating them equivalently, using them interchangeably) in the
  setUp/tearDown of unit tests will begin to experience test failures
  due to lack of test isolation.  The "right" mechanism is
  ``repoze.bfg.testing.cleanUp`` (or the combination of
  ``repoze.bfg.testing.setUp`` and
  ``repoze.bfg.testing.tearDown``). but a good number of legacy
  codebases will use ``zope.testing.cleanup.cleanUp`` instead.  We
  support ``zope.testing.cleanup.cleanUp`` but not in combination with
  ``repoze.bfg.testing.cleanUp`` in the same codebase.  You should use
  one or the other test cleanup function in a single codebase, but not
  both.

Internal
--------

- Created new ``repoze.bfg.configuration`` module which assumes
  responsibilities previously held by the ``repoze.bfg.registry`` and
  ``repoze.bfg.router`` modules (avoid a circular import dependency).

- The result of the ``zope.component.getSiteManager`` function in unit
  tests set up with ``repoze.bfg.testing.cleanUp`` or
  ``repoze.bfg.testing.setUp`` will be an instance of
  ``repoze.bfg.registry.Registry`` instead of the global
  ``zope.component.globalregistry.base`` registry.  This also means
  that the threadlocal ZCA API functions such as ``getAdapter`` and
  ``getUtility`` as well as internal BFG machinery (such as
  ``model_url`` and ``route_url``) will consult this registry within
  unit tests. This is a forward compatibility move based on the goals
  of "marco".

- Removed ``repoze.bfg.testing.addCleanUp`` function and associated
  module-scope globals.  This was never an API.

1.1a5 (2009-10-10)
==================

Documentation
-------------

- Change "Traversal + ZODB" and "URL Dispatch + SQLAlchemy" Wiki
  tutorials to make use of the new-to-1.1 "renderer" feature (return
  dictionaries from all views).

- Add tests to the "URL Dispatch + SQLAlchemy" tutorial after the
  "view" step.

- Added a diagram of model graph traversal to the "Traversal"
  narrative chapter of the documentation.

- An ``exceptions`` API chapter was added, documenting the new
  ``repoze.bfg.exceptions`` module.

- Describe "request-only" view calling conventions inside the
  urldispatch narrative chapter, where it's most helpful.

- Add a diagram which explains the operation of the BFG router to the
  "Router" narrative chapter.

Features
--------

- Add a new ``repoze.bfg.testing`` API: ``registerRoute``, for
  registering routes to satisfy calls to
  e.g. ``repoze.bfg.url.route_url`` in unit tests.

- The ``notfound`` and ``forbidden`` ZCML directives now accept the
  following addtional attributes: ``attr``, ``renderer``, and
  ``wrapper``.  These have the same meaning as they do in the context
  of a ZCML ``view`` directive.

- For behavior like Django's ``APPEND_SLASH=True``, use the
  ``repoze.bfg.view.append_slash_notfound_view`` view as the Not Found
  view in your application.  When this view is the Not Found view
  (indicating that no view was found), and any routes have been
  defined in the configuration of your application, if the value of
  ``PATH_INFO`` does not already end in a slash, and if the value of
  ``PATH_INFO`` *plus* a slash matches any route's path, do an HTTP
  redirect to the slash-appended PATH_INFO.  Note that this will
  *lose* ``POST`` data information (turning it into a GET), so you
  shouldn't rely on this to redirect POST requests.

- Speed up ``repoze.bfg.location.lineage`` slightly.

- Speed up ``repoze.bfg.encode.urlencode`` (nee'
  ``repoze.bfg.url.urlencode``) slightly.

- Speed up ``repoze.bfg.traversal.model_path``.

- Speed up ``repoze.bfg.traversal.model_path_tuple`` slightly.

- Speed up ``repoze.bfg.traversal.traverse`` slightly.

- Speed up ``repoze.bfg.url.model_url`` slightly.

- Speed up ``repoze.bfg.url.route_url`` slightly.

- Sped up ``repoze.bfg.traversal.ModelGraphTraverser:__call__``
  slightly.

- Minor speedup of ``repoze.bfg.router.Router.__call__``.

- New ``repoze.bfg.exceptions`` module was created to house exceptions
  that were previously sprinkled through various modules.

Internal
--------

- Move ``repoze.bfg.traversal._url_quote`` into ``repoze.bfg.encode``
  as ``url_quote``.

Deprecations
------------

- The import of ``repoze.bfg.view.NotFound`` is deprecated in favor of
  ``repoze.bfg.exceptions.NotFound``.  The old location still
  functions, but emits a deprecation warning.

- The import of ``repoze.bfg.security.Unauthorized`` is deprecated in
  favor of ``repoze.bfg.exceptions.Forbidden``.  The old location
  still functions but emits a deprecation warning.  The rename from
2923
  ``Unauthorized`` to ``Forbidden`` brings parity to the name of
2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613
  the exception and the system view it invokes when raised.

Backwards Incompatibilities
---------------------------

- We previously had a Unicode-aware wrapper for the
  ``urllib.urlencode`` function named ``repoze.bfg.url.urlencode``
  which delegated to the stdlib function, but which marshalled all
  unicode values to utf-8 strings before calling the stdlib version.
  A newer replacement now lives in ``repoze.bfg.encode`` The
  replacement does not delegate to the stdlib.

  The replacement diverges from the stdlib implementation and the
  previous ``repoze.bfg.url`` url implementation inasmuch as its
  ``doseq`` argument is now a decoy: it always behaves in the
  ``doseq=True`` way (which is the only sane behavior) for speed
  purposes.

  The old import location (``repoze.bfg.url.urlencode``) still
  functions and has not been deprecated.

- In 0.8a7, the return value expected from an object implementing
  ``ITraverserFactory`` was changed from a sequence of values to a
  dictionary containing the keys ``context``, ``view_name``,
  ``subpath``, ``traversed``, ``virtual_root``, ``virtual_root_path``,
  and ``root``.  Until now, old-style traversers which returned a
  sequence have continued to work but have generated a deprecation
  warning.  In this release, traversers which return a sequence
  instead of a dictionary will no longer work.

1.1a4 (2009-09-23)
==================

Bug Fixes
---------

- On 64-bit Linux systems, views that were members of a multiview
  (orderings of views with predicates) were not evaluated in the
  proper order.  Symptom: in a configuration that had two views with
  the same name but one with a ``request_method=POST`` predicate and
  one without, the one without the predicate would be called
  unconditionally (even if the request was a POST request).  Thanks
  much to Sebastien Douche for providing the buildbots that pointed
  this out.

Documentation
-------------

- Added a tutorial which explains how to use ``repoze.session``
  (ZODB-based sessions) in a ZODB-based repoze.bfg app.

- Added a tutorial which explains how to add ZEO to a ZODB-based
  ``repoze.bfg`` application.

- Added a tutorial which explains how to run a ``repoze.bfg``
  application under `mod_wsgi <http://code.google.com/p/modwsgi/>`_.
  See "Running a repoze.bfg Application under mod_wsgi" in the
  tutorials section of the documentation.

Features
--------

- Add a ``repoze.bfg.url.static_url`` API which is capable of
  generating URLs to static resources defined by the ``<static>`` ZCML
  directive.  See the "Views" narrative chapter's section titled
  "Generating Static Resource URLs" for more information.

- Add a ``string`` renderer.  This renderer converts a non-Response
  return value of any view callble into a string.  It is documented in
  the "Views" narrative chapter.

- Give the ``route`` ZCML directive the ``view_attr`` and
  ``view_renderer`` parameters (bring up to speed with 1.1a3
  features).  These can also be spelled as ``attr`` and ``renderer``.

Backwards Incompatibilities
---------------------------

- An object implementing the ``IRenderer`` interface (and
  ``ITemplateRenderer`, which is a subclass of ``IRenderer``) must now
  accept an extra ``system`` argument in its ``__call__`` method
  implementation.  Values computed by the system (as opposed to by the
  view) are passed by the system in the ``system`` parameter, which
  will always be a dictionary.  Keys in the dictionary include:
  ``view`` (the view object that returned the value),
  ``renderer_name`` (the template name or simple name of the
  renderer), ``context`` (the context object passed to the view), and
  ``request`` (the request object passed to the view).  Previously
  only ITemplateRenderers received system arguments as elements inside
  the main ``value`` dictionary.

Internal
--------

- The way ``bfg_view`` declarations are scanned for has been modified.
  This should have no external effects.

- Speed: do not register an ITraverserFactory in configure.zcml;
  instead rely on queryAdapter and a manual default to
  ModelGraphTraverser.

- Speed: do not register an IContextURL in configure.zcml; instead
  rely on queryAdapter and a manual default to TraversalContextURL.

- General speed microimprovements for helloworld benchmark: replace
  try/excepts with statements which use 'in' keyword.

1.1a3 (2009-09-16)
==================

Documentation
-------------

- The "Views" narrative chapter in the documentation has been updated
  extensively to discuss "renderers".

Features
--------

- A ``renderer`` attribute has been added to view configurations,
  replacing the previous (1.1a2) version's ``template`` attribute.  A
  "renderer" is an object which accepts the return value of a view and
  converts it to a string.  This includes, but is not limited to,
  templating systems.

- A new interface named ``IRenderer`` was added.  The existing
  interface, ``ITemplateRenderer`` now derives from this new
  interface.  This interface is internal.

- A new interface named ``IRendererFactory`` was added.  An existing
  interface named ``ITemplateRendererFactory`` now derives from this
  interface.  This interface is internal.

- The ``view`` attribute of the ``view`` ZCML directive is no longer
  required if the ZCML directive also has a ``renderer`` attribute.
  This is useful when the renderer is a template renderer and no names
  need be passed to the template at render time.

- A new zcml directive ``renderer`` has been added.  It is documented
  in the "Views" narrative chapter of the documentation.

- A ZCML ``view`` directive (and the associated ``bfg_view``
  decorator) can now accept a "wrapper" value.  If a "wrapper" value
  is supplied, it is the value of a separate view's *name* attribute.
  When a view with a ``wrapper`` attribute is rendered, the "inner"
  view is first rendered normally.  Its body is then attached to the
  request as "wrapped_body", and then a wrapper view name is looked up
  and rendered (using ``repoze.bfg.render_view_to_response``), passed
  the request and the context.  The wrapper view is assumed to do
  something sensible with ``request.wrapped_body``, usually inserting
  its structure into some other rendered template.  This feature makes
  it possible to specify (potentially nested) "owrap" relationships
  between views using only ZCML or decorators (as opposed always using
  ZPT METAL and analogues to wrap view renderings in outer wrappers).

Dependencies
------------

- When used under Python < 2.6, BFG now has an installation time
  dependency on the ``simplejson`` package.

Deprecations
------------

- The ``repoze.bfg.testing.registerDummyRenderer`` API has been
  deprecated in favor of
  ``repoze.bfg.testing.registerTemplateRenderer``.  A deprecation
  warning is *not* issued at import time for the former name; it will
  exist "forever"; its existence has been removed from the
  documentation, however.

- The ``repoze.bfg.templating.renderer_from_cache`` function has been
  moved to ``repoze.bfg.renderer.template_renderer_factory``.  This
  was never an API, but code in the wild was spotted that used it.  A
  deprecation warning is issued at import time for the former.

Backwards Incompatibilities
---------------------------

- The ``ITemplateRenderer`` interface has been changed.  Previously
  its ``__call__`` method accepted ``**kw``.  It now accepts a single
  positional parameter named ``kw`` (REVISED: it accepts two
  positional parameters as of 1.1a4: ``value`` and ``system``).  This
  is mostly an internal change, but it was exposed in APIs in one
  place: if you've used the
  ``repoze.bfg.testing.registerDummyRenderer`` API in your tests with
  a custom "renderer" argument with your own renderer implementation,
  you will need to change that renderer implementation to accept
  ``kw`` instead of ``**kw`` in its ``__call__`` method (REVISED: make
  it accept ``value`` and ``system`` positional arguments as of 1.1a4).

- The ``ITemplateRendererFactory`` interface has been changed.
  Previously its ``__call__`` method accepted an ``auto_reload``
  keyword parameter.  Now its ``__call__`` method accepts no keyword
  parameters.  Renderers are now themselves responsible for
  determining details of auto-reload.  This is purely an internal
  change.  This interface was never external.

- The ``template_renderer`` ZCML directive introduced in 1.1a2 has
  been removed.  It has been replaced by the ``renderer`` directive.

- The previous release (1.1a2) added a view configuration attribute
  named ``template``.  In this release, the attribute has been renamed
  to ``renderer``.  This signifies that the attribute is more generic:
  it can now be not just a template name but any renderer name (ala
  ``json``).  

- In the previous release (1.1a2), the Chameleon text template
  renderer was used if the system didn't associate the ``template``
  view configuration value with a filename with a "known" extension.
  In this release, you must use a ``renderer`` attribute which is a
  path that ends with a ``.txt`` extension
  (e.g. ``templates/foo.txt``) to use the Chameleon text renderer.

1.1a2 (2009-09-14)
==================

Features
--------

- A ZCML ``view`` directive (and the associated ``bfg_view``
  decorator) can now accept an "attr" value.  If an "attr" value is
  supplied, it is considered a method named of the view object to be
  called when the response is required.  This is typically only good
  for views that are classes or instances (not so useful for
  functions, as functions typically have no methods other than
  ``__call__``).

- A ZCML ``view`` directive (and the associated ``bfg_view``
  decorator) can now accept a "template" value.  If a "template" value
  is supplied, and the view callable returns a dictionary, the
  associated template is rendered with the dictionary as keyword
  arguments.  See the section named "Views That Have a ``template``"
  in the "Views" narrative documentation chapter for more information.

1.1a1 (2009-09-06)
==================

Bug Fixes
---------

- "tests" module removed from the bfg_alchemy paster template; these
  tests didn't work.

- Bugfix: the ``discriminator`` for the ZCML "route" directive was
  incorrect.  It was possible to register two routes that collided
  without the system spitting out a ConfigurationConflictError at
  startup time.

Features
--------

- Feature addition: view predicates.  These are exposed as the
  ``request_method``, ``request_param``, and ``containment``
  attributes of a ZCML ``view`` declaration, or the respective
  arguments to a ``@bfg_view`` decorator.  View predicates can be used
  to register a view for a more precise set of environment parameters
  than was previously possible.  For example, you can register two
  views with the same ``name`` with different ``request_param``
  attributes.  If the ``request.params`` dict contains 'foo'
  (request_param="foo"), one view might be called; if it contains
  'bar' (request_param="bar"), another view might be called.
  ``request_param`` can also name a key/value pair ala ``foo=123``.
  This will match only when the ``foo`` key is in the request.params
  dict and it has the value '123'.  This particular example makes it
  possible to write separate view functions for different form
  submissions.  The other predicates, ``containment`` and
  ``request_method`` work similarly.  ``containment`` is a view
  predicate that will match only when the context's graph lineage has
  an object possessing a particular class or interface, for example.
  ``request_method`` is a view predicate that will match when the HTTP
  ``REQUEST_METHOD`` equals some string (eg. 'POST').

- The ``@bfg_view`` decorator now accepts three additional arguments:
  ``request_method``, ``request_param``, and ``containment``.
  ``request_method`` is used when you'd like the view to match only a
  request with a particular HTTP ``REQUEST_METHOD``; a string naming
  the ``REQUEST_METHOD`` can also be supplied as ``request_type`` for
  backwards compatibility.  ``request_param`` is used when you'd like
  a view to match only a request that contains a particular
  ``request.params`` key (with or without a value).  ``containment``
  is used when you'd like to match a request that has a context that
  has some class or interface in its graph lineage.  These are
  collectively known as "view predicates".

- The ``route`` ZCML directive now honors ``view_request_method``,
  ``view_request_param`` and ``view_containment`` attributes, which
  pass along these values to the associated view if any is provided.
  Additionally, the ``request_type`` attribute can now be spelled as