-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2e94ee
commit 05e7550
Showing
13 changed files
with
277 additions
and
12 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
include *.txt *.ini *.cfg *.rst | ||
recursive-include atramhasis *.ico *.png *.css *.gif *.jpg *.pt *.txt *.jinja2 *.js *.html *.xml | ||
graft atramhasis/scaffolds |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from pyramid.scaffolds import PyramidTemplate | ||
|
||
|
||
class AtramhasisTemplate(PyramidTemplate): | ||
_template_dir = 'atramhasis_scaffold' | ||
summary = 'Create an Atramhasis implementation' | ||
|
||
|
||
class AtramhasisDemoTemplate(PyramidTemplate): | ||
_template_dir = 'atramhasis_demo' | ||
summary = 'Create an Atramhasis demo' |
18 changes: 18 additions & 0 deletions
18
atramhasis/scaffolds/atramhasis_demo/+package+/__init__.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,18 @@ | ||
from pyramid.config import Configurator | ||
|
||
|
||
def main(global_config, **settings): | ||
""" This function returns a Pyramid WSGI application. | ||
""" | ||
|
||
print("--{{project}}--MAIN--") | ||
|
||
# Set up pyramid | ||
config = Configurator(settings=settings) | ||
|
||
#Add skos support | ||
config.include('{{package}}.skos') | ||
|
||
config.scan() | ||
|
||
return config.make_wsgi_app() |
81 changes: 81 additions & 0 deletions
81
atramhasis/scaffolds/atramhasis_demo/+package+/skos/__init__.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,81 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import os | ||
import csv | ||
|
||
from skosprovider.providers import ( | ||
DictionaryProvider, | ||
SimpleCsvProvider | ||
) | ||
|
||
import logging | ||
log = logging.getLogger(__name__) | ||
|
||
larch = { | ||
'id': '1', | ||
'uri': 'http://id.trees.org/1', | ||
'labels': [ | ||
{'type': 'prefLabel', 'language': 'en', 'label': 'The Larch'}, | ||
{'type': 'prefLabel', 'language': 'nl', 'label': 'De Lariks'} | ||
], | ||
'notes': [ | ||
{'type': 'definition', 'language': 'en', 'note': 'A type of tree.'} | ||
] | ||
} | ||
|
||
chestnut = { | ||
'id': '2', | ||
'uri': 'http://id.trees.org/2', | ||
'labels': [ | ||
{'type': 'prefLabel', 'language': 'en', 'label': 'The Chestnut'}, | ||
{'type': 'altLabel', 'language': 'nl', 'label': 'De Paardekastanje'} | ||
], | ||
'notes': [ | ||
{ | ||
'type': 'definition', 'language': 'en', | ||
'note': 'A different type of tree.' | ||
} | ||
] | ||
} | ||
|
||
species = { | ||
'id': 3, | ||
'uri': 'http://id.trees.org/3', | ||
'labels': [ | ||
{'type': 'prefLabel', 'language': 'en', 'label': 'Trees by species'}, | ||
{'type': 'prefLabel', 'language': 'nl', 'label': 'Bomen per soort'} | ||
], | ||
'type': 'collection', | ||
'members': ['1', '2'] | ||
} | ||
|
||
TREES = DictionaryProvider( | ||
{'id': 'TREES', 'default_language': 'nl'}, | ||
[larch, chestnut, species] | ||
) | ||
|
||
|
||
def unicode_csv_reader(utf8_data, dialect=csv.excel, **kwargs): | ||
csv_reader = csv.reader(utf8_data, dialect=dialect, **kwargs) | ||
for row in csv_reader: | ||
yield [unicode(cell, 'utf-8') for cell in row] | ||
|
||
reader = unicode_csv_reader( | ||
open(os.path.join(os.path.dirname(__file__), 'menu.csv'), 'r'), | ||
delimiter=',', | ||
quotechar='"' | ||
) | ||
|
||
MENU = SimpleCsvProvider( | ||
{'id': 'MENU'}, | ||
reader | ||
) | ||
|
||
|
||
def includeme(config): | ||
config.include('pyramid_skosprovider') | ||
config.scan('pyramid_skosprovider') | ||
skosregis = config.get_skos_registry() | ||
skosregis.register_provider(TREES) | ||
skosregis.register_provider(MENU) | ||
|
11 changes: 11 additions & 0 deletions
11
atramhasis/scaffolds/atramhasis_demo/+package+/skos/menu.csv
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,11 @@ | ||
1,"Egg and Bacon", | ||
2,"Egg, sausage and Bacon", | ||
3,"Egg and Spam", | ||
4,"Spam Egg Sausage and Spam", | ||
5,"Egg, Bacon and Spam", | ||
6,"Egg, Bacon, sausage and Spam", | ||
7,"Spam, Bacon, sausage and Spam", | ||
8,"Spam, Egg, Spam, Spam, Bacon and Spam", | ||
9,"Spam, Spam, Spam, Egg and Spam", | ||
10,"Spam, Spam, Spam, Spam, Spam, Spam, Spam, baked beans, Spam, Spam, Spam and Spam", | ||
11,"Lobster Thermidor", "Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provencale manner with shallots and aubergines, garnished with truffle pâté, brandy and a fried egg on top and Spam" |
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,4 @@ | ||
0.0 | ||
--- | ||
|
||
- Initial version |
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,2 @@ | ||
include *.txt *.ini *.cfg *.rst | ||
recursive-include {{package}} *.ico *.png *.css *.gif *.jpg *.pt *.txt *.jinja2 *.js *.html *.xml |
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,3 @@ | ||
{{project}} README | ||
|
||
This is a Atramhasis demo application |
Binary file not shown.
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,76 @@ | ||
### | ||
# app configuration | ||
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html | ||
### | ||
|
||
[app:main] | ||
use = egg:atramhasis | ||
|
||
pyramid.reload_templates = true | ||
pyramid.debug_authorization = false | ||
pyramid.debug_notfound = false | ||
pyramid.debug_routematch = false | ||
pyramid.default_locale_name = en | ||
pyramid.includes = | ||
pyramid_debugtoolbar | ||
pyramid_tm | ||
|
||
sqlalchemy.url = sqlite:///%(here)s/atramhasis.sqlite | ||
|
||
# By default, the toolbar only appears for clients from IP addresses | ||
# '127.0.0.1' and '::1'. | ||
# debugtoolbar.hosts = 127.0.0.1 ::1 | ||
|
||
### | ||
# wsgi server configuration | ||
### | ||
|
||
[server:main] | ||
use = egg:waitress#main | ||
host = 0.0.0.0 | ||
port = 6543 | ||
|
||
### | ||
# logging configuration | ||
# http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html | ||
### | ||
|
||
[loggers] | ||
keys = root, atramhasis, sqlalchemy, {{package_logger}} | ||
|
||
[handlers] | ||
keys = console | ||
|
||
[formatters] | ||
keys = generic | ||
|
||
[logger_root] | ||
level = INFO | ||
handlers = console | ||
|
||
[logger_atramhasis] | ||
level = DEBUG | ||
handlers = | ||
qualname = atramhasis | ||
|
||
[logger_sqlalchemy] | ||
level = INFO | ||
handlers = | ||
qualname = sqlalchemy.engine | ||
# "level = INFO" logs SQL queries. | ||
# "level = DEBUG" logs SQL queries and results. | ||
# "level = WARN" logs neither. (Recommended for production systems.) | ||
|
||
[logger_{{package_logger}}] | ||
level = DEBUG | ||
handlers = | ||
qualname = {{package}} | ||
|
||
[handler_console] | ||
class = StreamHandler | ||
args = (sys.stderr,) | ||
level = NOTSET | ||
formatter = generic | ||
|
||
[formatter_generic] | ||
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s |
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,50 @@ | ||
import os | ||
|
||
from setuptools import setup, find_packages | ||
|
||
here = os.path.abspath(os.path.dirname(__file__)) | ||
with open(os.path.join(here, 'README.txt')) as f: | ||
README = f.read() | ||
with open(os.path.join(here, 'CHANGES.txt')) as f: | ||
CHANGES = f.read() | ||
|
||
requires = [ | ||
'pyramid', | ||
'pyramid_debugtoolbar', | ||
'pyramid_tm', | ||
'SQLAlchemy', | ||
'transaction', | ||
'zope.sqlalchemy', | ||
'waitress', | ||
'skosprovider', | ||
'skosprovider_sqlalchemy', | ||
'pyramid_skosprovider', | ||
'pyramid_jinja2', | ||
'alembic' | ||
] | ||
|
||
setup(name='{{project}}', | ||
version='0.0', | ||
description='{{project}}', | ||
long_description=README + '\n\n' + CHANGES, | ||
classifiers=[ | ||
"Programming Language :: Python", | ||
"Framework :: Pyramid", | ||
"Topic :: Internet :: WWW/HTTP", | ||
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application", | ||
], | ||
author='', | ||
author_email='', | ||
url='', | ||
keywords='web pyramid pylons', | ||
packages=find_packages(), | ||
include_package_data=True, | ||
zip_safe=False, | ||
install_requires=requires, | ||
tests_require=requires, | ||
test_suite="{{package}}", | ||
entry_points="""\ | ||
[paste.app_factory] | ||
main = {{package}}:main | ||
""", | ||
) |
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