-
Notifications
You must be signed in to change notification settings - Fork 5
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
Showing
37 changed files
with
569 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Contributing | ||
------------ | ||
|
||
Install the development environment: | ||
|
||
```sh | ||
$ pip install virtualenv # might require sudo/admin privileges | ||
$ git clone https://github.com/clld/clld.git # you may also clone a suitable fork | ||
$ cd amsd | ||
$ python -m virtualenv .venv | ||
$ source .venv/bin/activate # Windows: .venv\Scripts\activate.bat | ||
$ pip install -r requirements.txt # installs the cloned version with dev-tools in development mode | ||
``` | ||
|
||
Then create a database: | ||
|
||
```sh | ||
$ su - postgres | ||
$ createdb amsd | ||
``` | ||
|
||
and initialize it, either | ||
- loading a dump of the production DB, using the app's `load_db` task from the | ||
`appconfig` package | ||
- or by running `python amsd/scripts/initializedb.py development.ini` (may require access to the appropriate data repository). | ||
|
||
Now you should be able to run the tests: | ||
|
||
```sh | ||
$ pytest | ||
``` |
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 amsd *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.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,47 @@ | ||
[alembic] | ||
script_location = migrations | ||
|
||
# set to 'true' to run the environment during | ||
# the 'revision' command, regardless of autogenerate | ||
# revision_environment = false | ||
|
||
sqlalchemy.url = postgresql://postgres@/amsd | ||
|
||
[production] | ||
script_location = migrations | ||
sqlalchemy.url = postgresql://amsd@/amsd | ||
|
||
# Logging configuration | ||
[loggers] | ||
keys = root,sqlalchemy,alembic | ||
|
||
[handlers] | ||
keys = console | ||
|
||
[formatters] | ||
keys = generic | ||
|
||
[logger_root] | ||
level = WARN | ||
handlers = console | ||
qualname = | ||
|
||
[logger_sqlalchemy] | ||
level = WARN | ||
handlers = | ||
qualname = sqlalchemy.engine | ||
|
||
[logger_alembic] | ||
level = INFO | ||
handlers = | ||
qualname = alembic | ||
|
||
[handler_console] | ||
class = StreamHandler | ||
args = (sys.stderr,) | ||
level = NOTSET | ||
formatter = generic | ||
|
||
[formatter_generic] | ||
format = %(levelname)-5.5s [%(name)s] %(message)s | ||
datefmt = %H:%M:%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,12 @@ | ||
from pyramid.config import Configurator | ||
|
||
# we must make sure custom models are known at database initialization! | ||
from amsd import models | ||
|
||
|
||
def main(global_config, **settings): | ||
""" This function returns a Pyramid WSGI application. | ||
""" | ||
config = Configurator(settings=settings) | ||
config.include('clldmpg') | ||
return config.make_wsgi_app() |
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 @@ | ||
def includeme(config): | ||
pass |
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,8 @@ | ||
[clld] | ||
menuitems_list = contributions parameters languages contributors sentences sources | ||
app_template = amsd.mako | ||
github_repos = clld/amsd | ||
pacific_centered_maps = 0 | ||
|
||
[mako] | ||
directories_list = amsd:templates clldmpg:templates clld:web/templates |
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,10 @@ | ||
from clld.web.assets import environment | ||
from clldutils.path import Path | ||
|
||
import amsd | ||
|
||
|
||
environment.append_path( | ||
Path(amsd.__file__).parent.joinpath('static').as_posix(), | ||
url='/amsd:static/') | ||
environment.load_path = list(reversed(environment.load_path)) |
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 @@ | ||
def includeme(config): | ||
pass |
Empty file.
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 @@ | ||
def includeme(config): | ||
pass |
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,25 @@ | ||
from zope.interface import implementer | ||
from sqlalchemy import ( | ||
Column, | ||
String, | ||
Unicode, | ||
Integer, | ||
Boolean, | ||
ForeignKey, | ||
UniqueConstraint, | ||
) | ||
from sqlalchemy.orm import relationship, backref | ||
from sqlalchemy.ext.declarative import declared_attr | ||
from sqlalchemy.ext.hybrid import hybrid_property | ||
|
||
from clld import interfaces | ||
from clld.db.meta import Base, CustomModelMixin | ||
#from clld.db.models.common import Language | ||
|
||
|
||
#----------------------------------------------------------------------------- | ||
# specialized common mapper classes | ||
#----------------------------------------------------------------------------- | ||
#@implementer(interfaces.ILanguage) | ||
#class amsdLanguage(CustomModelMixin, Language): | ||
# pk = Column(Integer, ForeignKey('language.pk'), primary_key=True) |
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 @@ | ||
# |
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,42 @@ | ||
from __future__ import unicode_literals | ||
import sys | ||
|
||
from clld.scripts.util import initializedb, Data | ||
from clld.db.meta import DBSession | ||
from clld.db.models import common | ||
|
||
import amsd | ||
from amsd import models | ||
|
||
|
||
def main(args): | ||
data = Data() | ||
|
||
dataset = common.Dataset( | ||
id=amsd.__name__, | ||
name="--TODO--", | ||
publisher_name="Max Planck Institute for the Science of Human History", | ||
publisher_place="Jena", | ||
publisher_url="http://www.shh.mpg.de", | ||
license="http://creativecommons.org/licenses/by/4.0/", | ||
domain='amsd.clld.org', | ||
jsondata={ | ||
'license_icon': 'cc-by.png', | ||
'license_name': 'Creative Commons Attribution 4.0 International License'}) | ||
|
||
DBSession.add(dataset) | ||
|
||
# | ||
# TODO: add editors! | ||
# | ||
|
||
def prime_cache(args): | ||
"""If data needs to be denormalized for lookup, do that here. | ||
This procedure should be separate from the db initialization, because | ||
it will have to be run periodically whenever data has been updated. | ||
""" | ||
|
||
|
||
if __name__ == '__main__': # pragma: no cover | ||
initializedb(create=main, prime_cache=prime_cache) | ||
sys.exit(0) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
|
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 @@ | ||
|
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,7 @@ | ||
<%inherit file="app.mako"/> | ||
|
||
<%block name="brand"> | ||
<a href="${request.resource_url(request.dataset)}" class="brand">${request.dataset.name}</a> | ||
</%block> | ||
|
||
${next.body()} |
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,68 @@ | ||
<%inherit file="../home_comp.mako"/> | ||
|
||
<h2>Welcome to the Australian Message Stick Database</h2> | ||
|
||
<p class="lead"> | ||
Message sticks are carved graphic devices from Indigenous Australia, used to | ||
facilitate long-distance communication. This database is a digital | ||
repository of 1024 message sticks and associated metadata located in museums | ||
across the world. It also stores photographs and sketches of messages that | ||
are no longer extant. The database is searchable via 30 fields, including | ||
linguistic area, semantic domain, motifs and source. The full dataset will | ||
be migrated to this location soon. In the meantime click <a | ||
href="https://cdhrsys.anu.edu.au/occams_v1c/index.php" target="_blank">here</a> | ||
to visit the beta version and the Help link for access instructions. | ||
</p> | ||
|
||
<h2>Example</h2> | ||
<img width="180" height="180" | ||
src="${request.static_url('amsd:static/1520350500.png')}" class="image"/> | ||
|
||
<p> | ||
The Australian Message Stick Database contains data licensed under various | ||
conditions depending on agreements with museums (see individual records for | ||
details). No restricted or sacred items are included. It has been developed | ||
by The Mint Research Group at The Max Planck Institute for the Science of | ||
Human History. | ||
</p> | ||
|
||
<h3>How to access the Australian Message Sticks Database</h3> | ||
<p>The beta version can be accessed from <a | ||
href="https://cdhrsys.anu.edu.au/occams_v1c/index.php">https://cdhrsys.anu.edu.au/occams_v1c/index.php</a>.<br/> | ||
Please contact Piers Kelly (kelly [AT] shh.mpg.de) for log-in credentials or | ||
for a zipped copy of the database. | ||
</p> | ||
|
||
<div class="row-fluid"> | ||
<div class="span4 well well-small"> | ||
<h3>How to cite:</h3> | ||
<p> | ||
Kelly, Piers (ed.). 2018. The Australian Message Stick Database | ||
(beta version) | ||
</p> | ||
</div> | ||
<div class="span4" style="padding: 20px; text-align: center;"> | ||
<img width="200" height="200" | ||
src="${request.static_url('amsd:static/amsd_logo.png')}" | ||
class="image"/> | ||
</div> | ||
<div class="span4"> | ||
<table class="table table-nonfluid"> | ||
<tbody> | ||
<tr> | ||
<th>Artefacts</th> | ||
<td class="right">1024</td> | ||
</tr> | ||
<tr> | ||
<th>Linguistic areas</th> | ||
<td class="right">54</td> | ||
</tr> | ||
<tr> | ||
<th>Motifs</th> | ||
<td class="right">37</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
|
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 @@ | ||
from amsd import models | ||
import pytest | ||
|
||
pytest_plugins = ['clld'] |
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 @@ | ||
def test_home(app): | ||
app.get_html('/legal', status=200) |
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,9 @@ | ||
# coding: utf8 | ||
from __future__ import unicode_literals, print_function, division | ||
|
||
from amsd.scripts.initializedb import main, prime_cache | ||
|
||
|
||
def test_dbinit(db): | ||
main(None) | ||
prime_cache(None) |
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,7 @@ | ||
from __future__ import unicode_literals | ||
import time | ||
|
||
|
||
def test_ui(selenium): | ||
selenium.browser.get(selenium.url('/download')) | ||
time.sleep(3) |
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,7 @@ | ||
""" | ||
This module will be available in templates as ``u``. | ||
This module is also used to lookup custom template context providers, i.e. functions | ||
following a special naming convention which are called to update the template context | ||
before rendering resource's detail or index views. | ||
""" |
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 @@ | ||
# |
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 @@ | ||
Files in this directory can be conveniently accessed from scripts using | ||
|
||
args.data_file('path', 'relative', 'to', 'here') |
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,43 @@ | ||
[app:main] | ||
use = egg:amsd | ||
|
||
pyramid.reload_templates = true | ||
pyramid.debug_authorization = false | ||
pyramid.debug_notfound = false | ||
pyramid.debug_routematch = false | ||
pyramid.default_locale_name = en | ||
pyramid.includes = | ||
pyramid_tm | ||
sqlalchemy.url = postgresql://chrzyki@/amsd | ||
|
||
[server:main] | ||
use = egg:waitress#main | ||
host = 127.0.0.1 | ||
port = 6543 | ||
|
||
[loggers] | ||
keys = root, amsd | ||
|
||
[handlers] | ||
keys = console | ||
|
||
[formatters] | ||
keys = generic | ||
|
||
[logger_root] | ||
level = INFO | ||
handlers = console | ||
|
||
[logger_amsd] | ||
level = DEBUG | ||
handlers = | ||
qualname = amsd | ||
|
||
[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 |
Oops, something went wrong.