Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated bunsen to work with Pyramid 1.3
- Loading branch information
Showing
40 changed files
with
70 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
*.pyc | ||
*.pyo | ||
*.DS_Store | ||
/projectFilesBackup | ||
/tester | ||
/build | ||
/dist |
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
bunsen/paster_templates/pyramid_template/+package+/models/__init__.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from pyramid.scaffolds import PyramidTemplate | ||
|
||
class BunsenTemplate(PyramidTemplate): | ||
_template_dir = "pyramid_template" | ||
summary = "A Pyramid project setup with URL Dispatch, Jinja2, SQLAlchemy, WTForms and more." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
bunsen/scaffolds/pyramid_template/+package+/models/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import logging | ||
import transaction | ||
from sqlalchemy.orm import sessionmaker, scoped_session | ||
from sqlalchemy.ext.declarative import declarative_base | ||
from sqlalchemy import Column, Integer, Text | ||
from zope.sqlalchemy import ZopeTransactionExtension | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension())) | ||
Base = declarative_base() | ||
|
||
class MyModel(Base): | ||
__tablename__ = 'models' | ||
id = Column(Integer, primary_key=True) | ||
name = Column(Text, unique=True) | ||
value = Column(Integer) | ||
|
||
def __init__(self, name, value): | ||
self.name = name | ||
self.value = value |
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions
32
bunsen/scaffolds/pyramid_template/+package+/scripts/initializedb.py_tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
import sys | ||
import transaction | ||
|
||
from sqlalchemy import engine_from_config | ||
|
||
from pyramid.paster import get_appsettings | ||
from pyramid.paster import setup_logging | ||
|
||
from {{package}}.models import DBSession | ||
from {{package}}.models import MyModel | ||
from {{package}}.models import Base | ||
|
||
|
||
def usage(argv): | ||
cmd = os.path.basename(argv[0]) | ||
print('usage: %s <config_uri>\n' | ||
'(example: "%s development.ini")' % (cmd, cmd)) | ||
sys.exit(1) | ||
|
||
def main(argv=sys.argv): | ||
if len(argv) != 2: | ||
usage(argv) | ||
config_uri = argv[1] | ||
setup_logging(config_uri) | ||
settings = get_appsettings(config_uri) | ||
engine = engine_from_config(settings, 'sqlalchemy.') | ||
DBSession.configure(bind=engine) | ||
Base.metadata.create_all(engine) | ||
with transaction.manager: | ||
model = MyModel(name='one', value=1) | ||
DBSession.add(model) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters