Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Upgrade Aspen to 0.42 #788

Merged
merged 8 commits into from
Dec 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ env: requirements.txt requirements_tests.txt
--extra-search-dir=./vendor/ \
./env/
./$(env_bin)/pip --version
./$(env_bin)/pip install -f file:///$(PWD)/vendor -r requirements.txt
./$(env_bin)/pip install -f file:///$(PWD)/vendor -r requirements_tests.txt
./$(env_bin)/pip install --no-index --find-links=file:///$(PWD)/vendor -r requirements.txt
./$(env_bin)/pip install --no-index --find-links=file:///$(PWD)/vendor -r requirements_tests.txt

clean:
rm -rf env
Expand Down
Empty file added inside_gratipay/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
12 changes: 8 additions & 4 deletions configure-aspen.py → inside_gratipay/main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import os
import string
import random
from os.path import basename, dirname, join, realpath, isdir
from os.path import basename, dirname

from aspen import Response
import canonizer
import gfm
from nav import NavItem
from aspen.website import Website

from . import canonizer, gfm
from .nav import NavItem


website = Website(www_root='www', project_root='.')


# Manually register markdown renderer to work around Heroku deployment woes.
Expand Down
4 changes: 2 additions & 2 deletions nav.py → inside_gratipay/nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
from os.path import join, realpath, isfile, isdir, basename

from aspen import resources
from aspen.resources.static_resource import StaticResource
from aspen.http.resource import Static


def get_simplate_context(website, fs):
resource = resources.get(website, fs)
return {} if isinstance(resource, StaticResource) else resource.pages[0]
return {} if isinstance(resource, Static) else resource.pages[0]


class NavItem(OrderedDict):
Expand Down
21 changes: 11 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@

aspen==0.37
filesystem_tree==1.0.1
first==2.0.1
mimeparse==0.1.3
dependency_injection==1.1.0
algorithm==1.0.0
algorithm==1.0.0
dependency_injection==1.1.0
filesystem_tree==1.0.1
python-mimeparse==0.1.4
aspen==0.42

MarkupSafe==0.18
Jinja2==2.7.1
aspen-jinja2==0.3
MarkupSafe==0.18
Jinja2==2.7.1
aspen-jinja2==0.4

simplejson==2.3.2

Expand All @@ -17,5 +16,7 @@ mistune_contrib==0.1

honcho==0.5.0

six==1.10.0
libsass==0.3.0
six==1.10.0

--editable .
1 change: 1 addition & 0 deletions requirements_tests.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
py==1.4.29
pytest==2.9.2
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from setuptools import setup, find_packages

setup(name='inside_gratipay', packages=find_packages())
19 changes: 6 additions & 13 deletions startapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,18 @@
PORT = 8536 # default/devserver port

import sys
from aspen.website import Website

aspen_config = [
'--www_root=www/',
'--project_root=.'
]


for param in sys.argv:
if param.startswith('--port'):
_, PORT = param.split('=')
PORT = int(PORT)


# by WSGI convention, we need to create webapp object
# and by default most WSGI servers look for 'application'
application = Website(aspen_config)
from inside_gratipay.main import website as application

if __name__ == '__main__':
from wsgiref.simple_server import make_server
print("* Running development server on http://%s:%s" % (HOST, PORT))
print("* Running development server on http://%s:%s" % (HOST or 'localhost', PORT))
make_server(HOST, PORT, application).serve_forever()

5 changes: 4 additions & 1 deletion tests/py/test_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
from pytest import yield_fixture

from aspen.testing.client import Client
from inside_gratipay.main import website

@yield_fixture
def client():
yield Client(www_root='www', project_root='')
client = Client(www_root='www', project_root='.')
client._website = website
Copy link
Contributor

@JessaWitzel JessaWitzel Dec 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for? Why are we defining a _website variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're telling Aspen's testing infrastructure to use the website that we are making over in inside_gratipay/main.py, which is configured how we want it.

Under previous versions of Aspen, Aspen would look in the project root for a magically named file ("configure-aspen.py") and take configuration from there. The magic is gone in 0.42.

yield client

def test_disallowed_methods(client):
for disallowed in ['TRACE', 'trAce', 'DELETE', 'PUT', 'OPTIONS', 'JUNK']:
Expand Down
Binary file removed vendor/aspen-0.37-py27-none-any.whl
Binary file not shown.
Binary file added vendor/aspen-0.42-py2-none-any.whl
Binary file not shown.
Binary file removed vendor/aspen-jinja2-0.3.tar.gz
Binary file not shown.
Binary file added vendor/aspen-jinja2-0.4.tar.gz
Binary file not shown.
Binary file removed vendor/mimeparse-0.1.3.tar.gz
Binary file not shown.
Binary file added vendor/py-1.4.29.tar.gz
Binary file not shown.
Binary file added vendor/pytest-2.9.2.tar.gz
Binary file not shown.
Binary file added vendor/python-mimeparse-0.1.4.tar.gz
Binary file not shown.