Giter Site home page Giter Site logo

pylons / pyramid-cookiecutter-zodb Goto Github PK

View Code? Open in Web Editor NEW
3.0 9.0 9.0 71 KB

[DEPRECATED - Please use https://github.com/pylons/pyramid-cookiecutter-starter instead] A Cookiecutter (project template) for creating a Pyramid project using ZODB for persistent storage, traversal for routing, and Chameleon for templating.

Python 68.83% CSS 31.17%
cookiecutter-template pyramid zodb traversal chameleon

pyramid-cookiecutter-zodb's Issues

pshell raises NoTransaction exception in a project that has no database files (yet)

Following what I've found in the ZODB wiki traveral tutorial (https://docs.pylonsproject.org/projects/pyramid/en/latest/tutorials/wiki/index.html), I've installed cookiecutter and did:

cookiecutter gh:Pylons/pyramid-cookiecutter-zodb --checkout 1.9-branch

Then, without done any changes, tried to open a shell on the project:

pshell development.ini

Got this traceback:

$ pshell development.ini
2017-10-21 08:58:41,941 INFO  [chameleon.config:38][MainThread] directory cache: /home/wu/pyramid-zodb-traversal/chameleon.
Traceback (most recent call last):
  File "/home/wu/pyramid-zodb-traversal/envs/testapp/bin/pshell", line 11, in <module>
    sys.exit(main())
  File "/home/wu/pyramid-zodb-traversal/envs/testapp/lib/python3.6/site-packages/pyramid/scripts/pshell.py", line 19, in main
    return command.run()
  File "/home/wu/pyramid-zodb-traversal/envs/testapp/lib/python3.6/site-packages/pyramid/scripts/pshell.py", line 124, in run
    env = self.bootstrap(config_uri, options=config_vars)
  File "/home/wu/pyramid-zodb-traversal/envs/testapp/lib/python3.6/site-packages/pyramid/paster.py", line 108, in bootstrap
    env = prepare(request)
  File "/home/wu/pyramid-zodb-traversal/envs/testapp/lib/python3.6/site-packages/pyramid/scripting.py", line 98, in prepare
    root = root_factory(request)
  File "/home/wu/pyramid-zodb-traversal/repos/Testapp/testapp/__init__.py", line 14, in root_factory
    return appmaker(conn.root())
  File "/home/wu/pyramid-zodb-traversal/repos/Testapp/testapp/models/__init__.py", line 18, in appmaker
    zodb_root['app_root'] = app_root
  File "/home/wu/pyramid-zodb-traversal/envs/testapp/lib/python3.6/site-packages/persistent/mapping.py", line 64, in __setitem__
    self._p_changed = 1
  File "/home/wu/pyramid-zodb-traversal/envs/testapp/lib/python3.6/site-packages/ZODB/Connection.py", line 835, in register
    self._register(obj)
  File "/home/wu/pyramid-zodb-traversal/envs/testapp/lib/python3.6/site-packages/ZODB/Connection.py", line 845, in _register
    self.transaction_manager.get().join(self)
  File "/home/wu/pyramid-zodb-traversal/envs/testapp/lib/python3.6/site-packages/transaction/_manager.py", line 87, in get
    raise NoTransaction()
transaction.interfaces.NoTransaction
$

Tried pserve instead:

pserve --reload development.ini

and the app seemed to be "started" right:

$ pserve --reload development.ini
Starting monitor for PID 61548.
2017-10-21 09:03:53,546 INFO  [chameleon.config:38][MainThread] directory cache: /home/wu/pyramid-zodb-traversal/chameleon.
Starting server in PID 61548.
Serving on http://localhost:6543
Serving on http://localhost:6543
$

After that, the ZODB database files are there:

$ ls -l Data.*
-rw-r--r--  1 wu  wu   166 Oct 21 09:03 Data.fs
-rw-r--r--  1 wu  wu     9 Oct 21 09:03 Data.fs.index
-rw-r--r--  1 wu  wu     7 Oct 21 09:03 Data.fs.lock
-rw-r--r--  1 wu  wu   106 Oct 21 09:03 Data.fs.tmp
$

(hint, look at the database - Data.fs - size)

After that I tried pshell again and I got the same traceback but, after
started pserve again, I opened http://localhost:6543 in a browser (got there
the pyramid welcome page). Then I looked at the database files again:

$ ls -l Data.*
-rw-r--r--  1 wu  wu   456 Oct 21 09:04 Data.fs
-rw-r--r--  1 wu  wu    31 Oct 21 09:03 Data.fs.index
-rw-r--r--  1 wu  wu     7 Oct 21 09:03 Data.fs.lock
-rw-r--r--  1 wu  wu   258 Oct 21 09:04 Data.fs.tmp
$

and then I did stop pserve and tried pshell:

$ pshell development.ini
2017-10-21 09:04:18,005 INFO  [chameleon.config:38][MainThread] directory cache: /home/wu/pyramid-zodb-traversal/chameleon.
Python 3.6.1 (default, Jun 29 2017, 15:42:29)
[GCC 4.2.1 20070719 ] on openbsd6
Type "help" for more information.

Environment:
  app          The WSGI application.
  registry     Active Pyramid registry.
  request      Active request object.
  root         Root of the default resource tree.
  root_factory Default root factory used to create `root`.

>>>

It worked just fine.

So, something is preventing pshell from working on a project that still has no
database (which worked fine in previous versions, as I've been using
pyramid+zodb for years now without this issue)

I was wondering if this could be related to issue #22, which removed some
transaction commits when calling the appmaker code...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.