Remove use of python3-future
This commit is contained in:
parent
6c83c6289f
commit
60010999d2
8 changed files with 37 additions and 26 deletions
42
README.md
42
README.md
|
@ -1,13 +1,18 @@
|
|||
Software Freedom Conservancy website
|
||||
====================================
|
||||
|
||||
|
||||
Contributing
|
||||
============
|
||||
------------
|
||||
|
||||
The canonical location for this repository is [on Conservancy’s
|
||||
Kallithea instance](http://k.sfconservancy.org/website). Copies of
|
||||
Kallithea instance](https://k.sfconservancy.org/website). Copies of
|
||||
this repository elsewhere, such as Github, are for backup purposes
|
||||
only..
|
||||
|
||||
|
||||
License
|
||||
=======
|
||||
-------
|
||||
|
||||
The software included herein, such as the Python source files, are generally
|
||||
licensed [AGPLv3](AGPLv3)-or-later. The Javascript is a hodgepodge of
|
||||
|
@ -17,22 +22,37 @@ the notices at the top of each Javascript file for licensing details.
|
|||
The content and text (such as the HTML files) is currently
|
||||
[CC-BY-SA-3.0](CC-By-SA-3.0).
|
||||
|
||||
Server Configuration
|
||||
====================
|
||||
|
||||
conservancy's webserver runs on a machine called
|
||||
dogwood.sfconservancy.org, which is a standard Debian installation.
|
||||
Server configuration
|
||||
--------------------
|
||||
|
||||
conservancy's webserver runs on a machine called aspen.sfconservancy.org, which
|
||||
is a standard Debian installation.
|
||||
|
||||
The following packages are installed to make Django and Apache work on a
|
||||
squeeze install:
|
||||
|
||||
$ aptitude install python-django apache2 sqlite3 python2.5-sqlite libapache2-mod-python
|
||||
$ aptitude install python-django apache2 sqlite3 python3-sqlite libapache2-mod-wsgi-py3
|
||||
|
||||
|
||||
|
||||
Django Setup
|
||||
============
|
||||
Django setup
|
||||
------------
|
||||
|
||||
0. Make sure the Python module 'djangopw', with the global variable
|
||||
'djangoadmin_password' is somewhere importable in the default
|
||||
PYTHON_PATH.
|
||||
|
||||
|
||||
Local development
|
||||
---------
|
||||
|
||||
python3 -m pip install -r requirements.txt
|
||||
cd www
|
||||
python manage.py runserver
|
||||
|
||||
Deploying
|
||||
---------
|
||||
|
||||
Changes pushed to the https://k.sfconservancy.org/website repository are
|
||||
automatically deployed to the production website by the `conservancy-www-update`
|
||||
SystemD timer. See `systemd/conservancy-www-update.timer` for details.
|
||||
|
|
|
@ -2,6 +2,5 @@ beautifulsoup4==4.9.3
|
|||
Django==1.11.29
|
||||
soupsieve==1.9.6
|
||||
html5lib==0.999999999
|
||||
future
|
||||
|
||||
django_countries==5.5 # Supports both Python 2 and 3.
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
from past.builtins import basestring
|
||||
from builtins import object
|
||||
import hashlib
|
||||
|
||||
from django.conf import settings
|
||||
from django.template import RequestContext
|
||||
|
||||
# This is backwards compatibilty support for a custom function we wrote
|
||||
# ourselves that is no longer necessary in modern Django.
|
||||
from django.shortcuts import render as render_template_with_context
|
||||
|
||||
|
||||
class ParameterValidator(object):
|
||||
def __init__(self, given_hash_or_params, params_hash_key=None):
|
||||
if params_hash_key is None:
|
||||
|
@ -17,7 +16,7 @@ class ParameterValidator(object):
|
|||
self.given_hash = given_hash_or_params.get(params_hash_key)
|
||||
seed = getattr(settings, 'CONSERVANCY_SECRET_KEY', '').encode('utf-8')
|
||||
self.hasher = hashlib.sha256(seed)
|
||||
if isinstance(self.given_hash, basestring):
|
||||
if isinstance(self.given_hash, str):
|
||||
self.hash_type = type(self.given_hash)
|
||||
else:
|
||||
self.hash_type = type(self.hasher.hexdigest())
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
from future import standard_library
|
||||
standard_library.install_aliases()
|
||||
from builtins import object
|
||||
from django.db import models
|
||||
from django.conf import settings
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
from __future__ import division
|
||||
from past.utils import old_div
|
||||
from builtins import object
|
||||
import random
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
||||
class FundraisingGoal(models.Model):
|
||||
"""Conservancy fundraiser Goal"""
|
||||
|
||||
|
@ -19,7 +19,7 @@ class FundraisingGoal(models.Model):
|
|||
return self.fundraiser_code_name
|
||||
|
||||
def percentage_there(self):
|
||||
return (old_div(self.fundraiser_so_far_amount, self.fundraiser_goal_amount) ) * 100
|
||||
return self.fundraiser_so_far_amount / self.fundraiser_goal_amount * 100
|
||||
|
||||
class Meta(object):
|
||||
ordering = ('fundraiser_code_name',)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
from future import standard_library
|
||||
standard_library.install_aliases()
|
||||
from builtins import object
|
||||
from django.db import models
|
||||
from django.conf import settings
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
from future import standard_library
|
||||
standard_library.install_aliases()
|
||||
from builtins import zip
|
||||
import urllib.parse
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from builtins import object
|
||||
from future.utils import raise_
|
||||
from django import http
|
||||
from django.conf import settings
|
||||
from django.utils.cache import patch_response_headers
|
||||
|
@ -29,7 +28,7 @@ class ForceCanonicalHostnameMiddleware(object):
|
|||
if settings.APPEND_SLASH and (old_url[1][-1] != '/') and ('.' not in old_url[1].split('/')[-1]):
|
||||
new_url[1] = new_url[1] + '/'
|
||||
if settings.DEBUG and request.method == 'POST':
|
||||
raise_(RuntimeError, "You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to %s%s (note the trailing slash), or set APPEND_SLASH=False in your Django settings." % (new_url[0], new_url[1]))
|
||||
raise(RuntimeError, "You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to %s%s (note the trailing slash), or set APPEND_SLASH=False in your Django settings." % (new_url[0], new_url[1]))
|
||||
# Strip trailing index.html
|
||||
if new_url[1].endswith('/index.html'):
|
||||
new_url[1] = new_url[1][:new_url[1].rfind('index.html')]
|
||||
|
|
Loading…
Reference in a new issue