Skip to main content

A package which allows Pyramid requests to join the active transaction

Project description

https://travis-ci.org/Pylons/pyramid_tm.png?branch=master Documentation Status

pyramid_tm is a package which allows Pyramid requests to join the active transaction as provided by the transaction package.

See http://docs.pylonsproject.org/projects/pyramid_tm/en/latest/ or docs/index.rst in this distribution for detailed documentation.

Changes

2.1 (2017-06-07)

  • On Pyramid >= 1.7 any errors raised from pyramid_tm invoking request.tm.abort and request.tm.commit will be caught and used to lookup and execute an exception view to return an error response. This exception view will be executed with an inactive transaction manager. See https://github.com/Pylons/pyramid_tm/pull/61

2.0 (2017-04-11)

Major Features

Backward Incompatibilities

  • The tm.attempts setting has been removed and retry support has been moved into a new package named pyramid_retry. If you want retry support then please look at that library for more information about installing and enabling it. See https://github.com/Pylons/pyramid_tm/pull/55

  • The pyramid_tm tween has been moved over the EXCVIEW tween. If you have any hacks in your application that are opening a new transaction inside your exception views then it’s likely you will want to remove them or re-evaluate when upgrading. See https://github.com/Pylons/pyramid_tm/pull/55

  • Drop support for Pyramid < 1.5.

Minor Features

  • Support for Python 3.6.

1.1.1 (2016-11-21)

1.1.0 (2016-11-19)

  • Support transaction 2.x.

  • The transaction’s request path and userid are now coerced to unicode by first decoding as utf-8 and falling back to latin-1. If the userid does not conform to these restrictions then set tm.annotate_user = no in your settings. See https://github.com/Pylons/pyramid_tm/pull/50

1.0.2 (2016-11-18)

1.0.1 (2016-10-24)

  • Removes the AttributeError when request.tm is accessed outside the tween. It turns out this broke subrequests as well as pshell and pyramid.paster.bootstrapp CLI scripts, especially when using the global transaction manager which can be tracked outside of the tween. See https://github.com/Pylons/pyramid_tm/pull/48

1.0 (2016-09-12)

  • Drop Python 2.6, 3.2 and 3.3 support.

  • Add Python 3.5 support.

  • Subtle bugs can occur if you use the transaction manager during a request in which pyramid_tm is disabled via an activate_hook. To combat these types of errors, attempting to access request.tm will now raise an AttributeError when pyramid_tm is inactive. See https://github.com/Pylons/pyramid_tm/pull/46

0.12.1 (2015-11-25)

  • Fix compatibility with 1.2 and 1.3 again. This wasn’t fully fixed in the 0.12 release as the tween was relying on request properties working (which they do not inside tweens in older versions). See https://github.com/Pylons/pyramid_tm/pull/39

0.12 (2015-05-20)

0.11 (2015-02-04)

0.10 (2015-01-06)

0.9 (2014-12-30)

0.8 (2014-11-12)

0.7 (2012-12-30)

  • Write unauthenticated userid and request.path_info as transaction metadata via t.setUser and t.note respectively during a commit.

0.6 (2012-12-26)

  • Disuse the confusing and bug-ridden generator-plus-context-manager “attempts” mechanism from the transaction package for retrying retryable exceptions (e.g. ZODB ConflictError). Use a simple while loop plus a counter and imperative logic instead.

0.5 (2012-06-26)

Bug Fixes

  • When a non-retryable exception was raised as the result of a call to transaction.manager.commit, the exception was not reraised properly. Symptom: an unrecoverable exception such as Unsupported: Storing blobs in <somestorage> is not supported. would be swallowed inappropriately.

0.4 (2012-03-28)

Bug Fixes

Testing

  • No longer tested under Python 2.5 by tox.ini (and therefore no longer tested under 2.5 by the Pylons Jenkins server). The package may still work under 2.5, but automated tests will no longer show breakage when it changes in ways that break 2.5 support.

  • Squash test deprecation warnings under Python 3.2.

0.3 (2011-09-27)

Features

  • The transaction manager has been converted to a Pyramid 1.2 “tween” (instead of an event subscriber). It will be slotted directly “below” the exception view handler, meaning it will have a chance to handle exceptions before they are turned into responses. This means it’s best to “raise HTTPFound(…)” instead of “return HTTPFound(…)” if you want an HTTP exception to abort the transaction.

  • The transaction manager will now retry retryable exceptions (such as a ZODB conflict error) if tm.attempts is configured to be more than the default of 1. See the Retrying section of the documentation.

  • Python 3.2 compatibility (requires Pyramid 1.3dev+).

Backwards Incompatibilities

  • Incompatible with Pyramid < 1.2a1. Use pyramid_tm version 0.2 if you need compatibility with an older Pyramid installation.

  • The default_commit_veto commit veto callback is no longer configured into the system by default. Use tm.commit_veto = pyramid_tm.default_commit_veto in the deployment settings to add it. This is for parity with repoze.tm2, which doesn’t configure in a commit veto by default either.

  • The default_commit_veto no longer checks for the presence of the X-Tm-Abort header when attempting to figure out whether the transaction should be aborted (although it still checks for the X-Tm header). Use version 0.2 or a custom commit veto function if your application depends on the X-Tm-Abort header.

  • A commit veto is now called with two arguments: request and response. The request is the webob request that caused the transaction manager to become active. The response is the response returned by the Pyramid application. This call signature is incompatible with older versions. The call signature of a pyramid_tm 0.2 and older commit veto accepted three arguments: environ, status, and headers. If you’re using a custom commit_veto function, you’ll need to either convert your existing function to use the new calling convention or use a wrapper to make it compatible with the new calling convention. Here’s a simple wrapper function (bwcompat_commit_veto_wrapper) that will allow you to use your existing custom commit veto function:

    def bwcompat_commit_veto_wrapper(request, response):
        return my_custom_commit_veto(request.environ, response.status,
                                     response.headerlist)

Deprecations

  • The pyramid_tm.commit_veto configuration setting is now canonically spelled as tm.commit_veto. The older spelling will continue to work, but may raise a deprecation error when used.

0.2 (2011-07-18)

  • A new header X-Tm is now honored by the default_commit_veto commit veto hook. If this header exists in the headerlist, its value must be a string. If its value is commit, the transaction will be committed regardless of the status code or the value of X-Tm-Abort. If the value of the X-Tm header is abort (or any other string value except commit), the transaction will be aborted, regardless of the status code or the value of X-Tm-Abort.

0.1 (2011-02-23)

  • Initial release, based on repoze.tm2

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyramid_tm-2.1.tar.gz (38.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyramid_tm-2.1-py2.py3-none-any.whl (19.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pyramid_tm-2.1.tar.gz.

File metadata

  • Download URL: pyramid_tm-2.1.tar.gz
  • Upload date:
  • Size: 38.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyramid_tm-2.1.tar.gz
Algorithm Hash digest
SHA256 7d9bf39582757f72eac12ec4f69a03415161f90538eb3dc4415ebd76100f56a6
MD5 0fc90fe117e446c2ba304b646045c531
BLAKE2b-256 692e71e588ff66ec1a756296efa475ba26ab024443b9d531b98e3a054ed23388

See more details on using hashes here.

File details

Details for the file pyramid_tm-2.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pyramid_tm-2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9802ebf8eb0de11933a149da3b84a0d1aee5c23a5ab1f38ecd46135e805c6abc
MD5 bdb8ae878ca29d02d60f8a8fbac7c7da
BLAKE2b-256 5d0fea206b683fc986463a134dd5a9c711d7762663f58c0eba69fe6e43278b3a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page