Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get rid of the transaction.commit() in the models.appmaker function #22

Closed
mmerickel opened this issue Jul 25, 2017 · 1 comment · Fixed by #25
Closed

get rid of the transaction.commit() in the models.appmaker function #22

mmerickel opened this issue Jul 25, 2017 · 1 comment · Fixed by #25

Comments

@mmerickel
Copy link
Member

This is using the wrong transaction manager and is unnecessary regardless as the transaction should not be committed mid-request.

related: Pylons/pyramid#3137

@stevepiercy
Copy link
Member

Well, it was not as simple as deleting two lines:
https://github.com/Pylons/pyramid-cookiecutter-zodb/blob/latest/%7B%7Bcookiecutter.repo_name%7D%7D/%7B%7Bcookiecutter.repo_name%7D%7D/models.py#L12-L13

To reproduce, delete those two lines, then generate a project from the cookiecutter:

$ cookiecutter .

Accept the defaults, follow the generated README.txt, and visit the URL. Stack trace:

$ env/bin/pserve development.ini 
Starting server in PID 32405.
Serving on http://localhost:6543
Serving on http://localhost:6543
2017-07-25 20:29:03,737 ERROR [waitress:341][waitress] Exception when serving /
Traceback (most recent call last):
  File "/Users/stevepiercy/projects/pyramid-cookiecutter-zodb/pyramid_scaffold/env/lib/python3.6/site-packages/waitress/channel.py", line 338, in service
    task.service()
  File "/Users/stevepiercy/projects/pyramid-cookiecutter-zodb/pyramid_scaffold/env/lib/python3.6/site-packages/waitress/task.py", line 169, in service
    self.execute()
  File "/Users/stevepiercy/projects/pyramid-cookiecutter-zodb/pyramid_scaffold/env/lib/python3.6/site-packages/waitress/task.py", line 399, in execute
    app_iter = self.channel.server.application(env, start_response)
  File "/Users/stevepiercy/projects/pyramid-cookiecutter-zodb/pyramid_scaffold/env/lib/python3.6/site-packages/pyramid/router.py", line 270, in __call__
    response = self.execution_policy(environ, self)
  File "/Users/stevepiercy/projects/pyramid-cookiecutter-zodb/pyramid_scaffold/env/lib/python3.6/site-packages/pyramid_retry/__init__.py", line 134, in retry_policy
    return request.invoke_exception_view(reraise=True)
  File "/Users/stevepiercy/projects/pyramid-cookiecutter-zodb/pyramid_scaffold/env/lib/python3.6/site-packages/pyramid/view.py", line 755, in invoke_exception_view
    reraise_(*exc_info)
  File "/Users/stevepiercy/projects/pyramid-cookiecutter-zodb/pyramid_scaffold/env/lib/python3.6/site-packages/pyramid/compat.py", line 148, in reraise
    raise value
  File "/Users/stevepiercy/projects/pyramid-cookiecutter-zodb/pyramid_scaffold/env/lib/python3.6/site-packages/pyramid_retry/__init__.py", line 114, in retry_policy
    response = router.invoke_request(request)
  File "/Users/stevepiercy/projects/pyramid-cookiecutter-zodb/pyramid_scaffold/env/lib/python3.6/site-packages/pyramid/router.py", line 260, in invoke_request
    request._process_finished_callbacks()
  File "/Users/stevepiercy/projects/pyramid-cookiecutter-zodb/pyramid_scaffold/env/lib/python3.6/site-packages/pyramid/request.py", line 147, in _process_finished_callbacks
    callback(self)
  File "/Users/stevepiercy/projects/pyramid-cookiecutter-zodb/pyramid_scaffold/env/lib/python3.6/site-packages/pyramid_zodbconn/__init__.py", line 57, in finished
    primary_conn.transaction_manager.abort()
  File "/Users/stevepiercy/projects/pyramid-cookiecutter-zodb/pyramid_scaffold/env/lib/python3.6/site-packages/transaction/_manager.py", line 136, in abort
    return self.get().abort()
  File "/Users/stevepiercy/projects/pyramid-cookiecutter-zodb/pyramid_scaffold/env/lib/python3.6/site-packages/transaction/_manager.py", line 87, in get
    raise NoTransaction()
transaction.interfaces.NoTransaction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants