Did I find the right examples for you? yes no

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)
When used as a commit veto, the logic in this function will cause the
transaction to be aborted if:

- An ``X-Tm`` response header with the value ``abort`` (or any value
  other than ``commit``) exists.

- The response status code starts with ``4`` or ``5``.

Otherwise the transaction will be allowed to commit.

        def default_commit_veto(request, response):
    """
    When used as a commit veto, the logic in this function will cause the
    transaction to be aborted if:

    - An ``X-Tm`` response header with the value ``abort`` (or any value
      other than ``commit``) exists.

    - The response status code starts with ``4`` or ``5``.

    Otherwise the transaction will be allowed to commit.
    """
    xtm = response.headers.get('x-tm')
    if xtm is not None:
        return xtm != 'commit'
    return response.status.startswith(('4', '5'))
        


src/p/y/pyramid_tm-0.7/pyramid_tm/tests.py   pyramid_tm(Download)
    def _callFUT(self, response, request=None):
        from pyramid_tm import default_commit_veto
        return default_commit_veto(request, response)
 
    def test_it_true_500(self):

src/p/y/pyramid_tm-HEAD/pyramid_tm/tests.py   pyramid_tm(Download)
    def _callFUT(self, response, request=None):
        from pyramid_tm import default_commit_veto
        return default_commit_veto(request, response)
 
    def test_it_true_500(self):