summaryrefslogtreecommitdiffabout
authorWojciech Polak <polak@gnu.org>2019-09-10 15:57:03 (GMT)
committer Wojciech Polak <polak@gnu.org>2019-09-10 15:57:03 (GMT)
commit6ee2cdd2573866484089da12a892ed1c888b5dc6 (patch) (side-by-side diff)
tree1aa384a19c98e28c5e3a63f3b66a2d7418ed75f9
parentca0711ba17c457de6f8fba2c56e536c7f846dd2b (diff)
downloadglifestream-6ee2cdd2573866484089da12a892ed1c888b5dc6.tar.gz
glifestream-6ee2cdd2573866484089da12a892ed1c888b5dc6.tar.bz2
Upgrade codebase to Django 1.11
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--.gitignore5
-rw-r--r--AUTHORS2
-rw-r--r--INSTALL.md6
-rw-r--r--glifestream/apis/fb.py4
-rw-r--r--glifestream/apis/friendfeed.py4
-rw-r--r--glifestream/apis/twitter.py3
-rw-r--r--glifestream/bookmarklet/urls.py11
-rw-r--r--glifestream/gauth/models.py6
-rw-r--r--glifestream/gauth/templates/login.html4
-rw-r--r--glifestream/gauth/templates/openid.html4
-rw-r--r--glifestream/gauth/urls.py13
-rw-r--r--glifestream/gauth/views.py44
-rw-r--r--glifestream/settings-sample.py59
-rw-r--r--glifestream/stream/models.py13
-rw-r--r--glifestream/stream/views.py2
-rw-r--r--glifestream/templates/base.html8
-rw-r--r--glifestream/templates/stream-pure.html1
-rw-r--r--glifestream/templates/stream.atom2
-rw-r--r--glifestream/templates/stream.html4
-rw-r--r--glifestream/templates/stream.json2
-rw-r--r--glifestream/urls.py89
-rw-r--r--glifestream/usettings/templates/oauth.html2
-rw-r--r--glifestream/usettings/templates/oid.html4
-rw-r--r--glifestream/usettings/templates/pshb.html4
-rw-r--r--glifestream/usettings/templates/services.html2
-rw-r--r--glifestream/usettings/templates/settings.html12
-rw-r--r--glifestream/usettings/urls.py33
-rw-r--r--glifestream/usettings/views.py14
-rw-r--r--glifestream/utils/html.py13
-rw-r--r--requirements.txt9
30 files changed, 205 insertions, 174 deletions
diff --git a/.gitignore b/.gitignore
index d4ae399..fcdaf8d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,11 @@
*.pyc
*.pyo
*.mo
+*.iml
+.idea/
+pip-selfcheck.json
+pyvenv.cfg
+venv*/
bin/
include/
lib/
diff --git a/AUTHORS b/AUTHORS
index 16e8109..64be22d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,7 +1,7 @@
Authors of gLifestream
======================
- Wojciech Polak (http://wojciechpolak.org/)
+ Wojciech Polak (https://wojciechpolak.org/)
This software is shipped with a third-party icon sets and software
diff --git a/INSTALL.md b/INSTALL.md
index 159b8ac..c651917 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -1,10 +1,10 @@
gLifestream -- INSTALL
-Copyright (C) 2009-2015 Wojciech Polak
+Copyright (C) 2009-2019 Wojciech Polak
gLifestream requirements
========================
-- Django 1.7 or later -- a Python Web framework (https://www.djangoproject.com/)
+- Django 1.11 -- a Python Web framework (https://www.djangoproject.com/)
- A database supported by Django (e.g. MySQL, PostgreSQL).
- Universal Feed Parser (https://pypi.python.org/pypi/feedparser)
@@ -98,7 +98,7 @@ Alias /static "/usr/local/django/glifestream/static"
```
More detailed information is available at:
-http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
+https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/
See https://docs.djangoproject.com/en/dev/howto/deployment/
for usual Django applications deployment.
diff --git a/glifestream/apis/fb.py b/glifestream/apis/fb.py
index 1c162cc..2e7cf6d 100644
--- a/glifestream/apis/fb.py
+++ b/glifestream/apis/fb.py
@@ -13,10 +13,10 @@
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
-from django.conf import settings
-from django.utils.html import strip_tags, strip_entities
+from django.utils.html import strip_tags
from django.template.defaultfilters import urlizetrunc
from glifestream.filters import expand, truncate
+from glifestream.utils.html import strip_entities
from glifestream.utils.time import from_rfc3339, mtime, now
from glifestream.stream.models import Entry
from glifestream.stream import media
diff --git a/glifestream/apis/friendfeed.py b/glifestream/apis/friendfeed.py
index 2bed88c..03bf78f 100644
--- a/glifestream/apis/friendfeed.py
+++ b/glifestream/apis/friendfeed.py
@@ -15,11 +15,11 @@
import re
import datetime
-from django.utils.html import strip_tags, strip_entities
+from django.utils.html import strip_tags
from glifestream.filters import truncate
from glifestream.gauth import gls_oauth
from glifestream.utils.time import mtime, now
-from glifestream.utils.html import bytes_to_human
+from glifestream.utils.html import bytes_to_human, strip_entities
from glifestream.stream.models import Entry
from glifestream.stream import media
diff --git a/glifestream/apis/twitter.py b/glifestream/apis/twitter.py
index 57cfb29..61f1701 100644
--- a/glifestream/apis/twitter.py
+++ b/glifestream/apis/twitter.py
@@ -15,9 +15,10 @@
import datetime
from django.utils.encoding import force_text
-from django.utils.html import strip_tags, strip_entities
+from django.utils.html import strip_tags
from glifestream.filters import expand, truncate, twyntax
from glifestream.gauth import gls_oauth
+from glifestream.utils.html import strip_entities
from glifestream.utils.time import mtime, now
from glifestream.stream.models import Entry
from glifestream.stream import media
diff --git a/glifestream/bookmarklet/urls.py b/glifestream/bookmarklet/urls.py
index 8611725..7f962ac 100644
--- a/glifestream/bookmarklet/urls.py
+++ b/glifestream/bookmarklet/urls.py
@@ -13,11 +13,10 @@
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
-from django.conf.urls import patterns, url
+from django.conf.urls import url
from glifestream.bookmarklet import views
-urlpatterns = patterns(
- '',
- (r'js$', views.js),
- (r'frame$', views.frame),
-)
+urlpatterns = [
+ url(r'js$', views.js),
+ url(r'frame$', views.frame),
+]
diff --git a/glifestream/gauth/models.py b/glifestream/gauth/models.py
index 7e0e5d4..a49e81b 100644
--- a/glifestream/gauth/models.py
+++ b/glifestream/gauth/models.py
@@ -22,8 +22,8 @@ from glifestream.stream.models import Service
@python_2_unicode_compatible
class OAuthClient (models.Model):
- service = models.ForeignKey(Service, verbose_name=_('Service'),
- null=False, blank=False, unique=True)
+ service = models.OneToOneField(Service, on_delete=models.CASCADE, verbose_name=_('Service'),
+ null=False, blank=False, unique=True)
identifier = models.CharField('Identifier', max_length=64, null=False,
blank=False)
secret = models.CharField('Secret', max_length=128, null=False,
@@ -49,7 +49,7 @@ class OAuthClient (models.Model):
@python_2_unicode_compatible
class OpenId (models.Model):
- user = models.ForeignKey(User, db_index=True)
+ user = models.ForeignKey(User, on_delete=models.CASCADE, db_index=True)
identity = models.CharField(_('Identity'), max_length=128, null=False,
blank=False)
diff --git a/glifestream/gauth/templates/login.html b/glifestream/gauth/templates/login.html
index da09087..87def5d 100644
--- a/glifestream/gauth/templates/login.html
+++ b/glifestream/gauth/templates/login.html
@@ -1,12 +1,12 @@
{% extends "base.html" %}
-{% load i18n %}{% load url from future %}
+{% load i18n %}
{% block main %}
<section id="login">
<div id="loginbox">
{% if form.errors %}<p class="error">{% trans "Invalid username or password" %}</p>{% endif %}
-<form name="loginform" method="post" action="{% url 'glifestream.gauth.views.login' %}">
+<form name="loginform" method="post" action="{% url 'login' %}">
<p>
<label>{% trans "Username" %}<br />
<input type="text" name="username" id="username" size="20" />
diff --git a/glifestream/gauth/templates/openid.html b/glifestream/gauth/templates/openid.html
index 856c978..8a34730 100644
--- a/glifestream/gauth/templates/openid.html
+++ b/glifestream/gauth/templates/openid.html
@@ -1,12 +1,12 @@
{% extends "base.html" %}
-{% load i18n %}{% load url from future %}
+{% load i18n %}
{% block main %}
<section id="login">
<div id="loginbox">
{% if page.msg %}<p class="error">{{ page.msg }}</p>{% endif %}
-<form name="loginform" method="post" action="{% url 'glifestream.gauth.views.openid' %}">
+<form name="loginform" method="post" action="{% url 'openid' %}">
<p>
<label>{% trans "OpenID" %}<br />
<input type="text" name="openid_identifier" id="openid_identifier" maxlength="128" />
diff --git a/glifestream/gauth/urls.py b/glifestream/gauth/urls.py
index d8c1a71..aca3957 100644
--- a/glifestream/gauth/urls.py
+++ b/glifestream/gauth/urls.py
@@ -13,12 +13,11 @@
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
-from django.conf.urls import patterns, url
+from django.conf.urls import url
from glifestream.gauth import views
-urlpatterns = patterns(
- '',
- (r'login-friend$', views.login_friend),
- (r'xrds$', views.xrds),
- (r'openid$', views.openid),
-)
+urlpatterns = [
+ url(r'login-friend$', views.login_friend, name='login-friend'),
+ url(r'xrds$', views.xrds, name='xrds'),
+ url(r'openid$', views.openid, name='openid'),
+]
diff --git a/glifestream/gauth/views.py b/glifestream/gauth/views.py
index c879847..548041d 100644
--- a/glifestream/gauth/views.py
+++ b/glifestream/gauth/views.py
@@ -17,10 +17,10 @@ from django.conf import settings
from django.core import urlresolvers
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.models import User
-from django.contrib.sites.models import RequestSite, Site
+from django.contrib.sites.models import Site
+from django.contrib.sites.requests import RequestSite
from django.http import HttpResponse, HttpResponseRedirect
-from django.shortcuts import render_to_response
-from django.template import RequestContext
+from django.shortcuts import render
from django.utils.translation import ugettext as _
from django.views.decorators.cache import never_cache
from glifestream.gauth import gls_openid
@@ -40,8 +40,7 @@ except ImportError:
def login(request, template_name='login.html',
redirect_field_name=REDIRECT_FIELD_NAME):
- redirect_to = request.REQUEST.get(redirect_field_name,
- urlresolvers.reverse('index'))
+ redirect_to = request.GET.get(redirect_field_name, urlresolvers.reverse('index'))
if request.method == 'POST':
form = AuthenticationRememberMeForm(data=request.POST,)
@@ -75,22 +74,20 @@ def login(request, template_name='login.html',
'theme': common.get_theme(request),
}
- return render_to_response(template_name,
- {'page': page,
- 'form': form,
- 'site': current_site,
- 'site_name': current_site.name,
- 'is_secure': request.is_secure(),
- redirect_field_name: redirect_to},
- context_instance=RequestContext(request))
+ return render(request, template_name,
+ {'page': page,
+ 'form': form,
+ 'site': current_site,
+ 'site_name': current_site.name,
+ 'is_secure': request.is_secure(),
+ redirect_field_name: redirect_to})
@never_cache
def login_friend(request, template_name='registration/login.html',
redirect_field_name=REDIRECT_FIELD_NAME):
- redirect_to = request.REQUEST.get(redirect_field_name,
- urlresolvers.reverse('index'))
+ redirect_to = request.GET.get(redirect_field_name, urlresolvers.reverse('index'))
if not redirect_to or '//' in redirect_to or ' ' in redirect_to:
redirect_to = settings.BASE_URL + '/'
@@ -150,7 +147,7 @@ def xrds(request, **args):
"""
body = xrds_tpl % (request.build_absolute_uri('openid'),
request.build_absolute_uri(
- urlresolvers.reverse('glifestream.usettings.views.openid')))
+ urlresolvers.reverse('usettings-openid')))
res = HttpResponse(body, content_type='application/xrds+xml')
res['X-Robots-Tag'] = 'noindex'
return res
@@ -220,11 +217,10 @@ def openid(request, template_name='openid.html',
'msg': msg,
}
- return render_to_response(template_name,
- {'page': page,
- 'form': form,
- 'site': current_site,
- 'site_name': current_site.name,
- 'is_secure': request.is_secure(),
- redirect_field_name: redirect_to},
- context_instance=RequestContext(request))
+ return render(request, template_name,
+ {'page': page,
+ 'form': form,
+ 'site': current_site,
+ 'site_name': current_site.name,
+ 'is_secure': request.is_secure(),
+ redirect_field_name: redirect_to})
diff --git a/glifestream/settings-sample.py b/glifestream/settings-sample.py
index 78cc203..8a9c1d7 100644
--- a/glifestream/settings-sample.py
+++ b/glifestream/settings-sample.py
@@ -5,7 +5,6 @@ SITE_ROOT = os.path.dirname(os.path.realpath(__file__))
BASE_DIR = SITE_ROOT
DEBUG = True
-TEMPLATE_DEBUG = DEBUG
ALLOWED_HOSTS = [
'localhost'
@@ -80,6 +79,24 @@ MIDDLEWARE_CLASSES = (
'django.middleware.cache.FetchFromCacheMiddleware',
)
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [
+ os.path.join(SITE_ROOT, 'templates'),
+ ],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.template.context_processors.debug',
+ 'django.template.context_processors.request',
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ },
+]
+
ROOT_URLCONF = 'glifestream.urls'
WSGI_APPLICATION = 'glifestream.wsgi.application'
@@ -89,10 +106,11 @@ TEMPLATE_DIRS = (
)
INSTALLED_APPS = (
+ 'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
- 'django.contrib.admin',
+ 'django.contrib.sites',
'django.contrib.staticfiles',
'pipeline',
'glifestream.gauth',
@@ -102,6 +120,8 @@ INSTALLED_APPS = (
'glifestream.bookmarklet',
)
+SITE_ID = 1
+
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = os.path.abspath(os.path.join(SITE_ROOT, '../media'))
@@ -133,23 +153,24 @@ STATICFILES_DIRS = (
os.path.join(SITE_ROOT, 'static'),
)
-PIPELINE_DISABLE_WRAPPER = True
-PIPELINE_JS_COMPRESSOR = None
-PIPELINE_CSS_COMPRESSOR = None
-
-PIPELINE_JS = {
- 'main': {
- 'source_filenames': (
- 'js/jquery.js',
- 'js/glifestream.js',
- ),
- 'output_filename': 'js/main.js',
- },
- 'tinymce': {
- 'source_filenames': (
- 'js/tinymce/tinymce.min.js',
- ),
- 'output_filename': 'js/tinymce.js',
+PIPELINE = {
+ 'DISABLE_WRAPPER': True,
+ 'JS_COMPRESSOR': None,
+ 'CSS_COMPRESSOR': None,
+ 'JAVASCRIPT': {
+ 'main': {
+ 'source_filenames': (
+ 'js/jquery.js',
+ 'js/glifestream.js',
+ ),
+ 'output_filename': 'js/main.js',
+ },
+ 'tinymce': {
+ 'source_filenames': (
+ 'js/tinymce/tinymce.min.js',
+ ),
+ 'output_filename': 'js/tinymce.js',
+ }
}
}
diff --git a/glifestream/stream/models.py b/glifestream/stream/models.py
index 7e8089f..35dca2c 100644
--- a/glifestream/stream/models.py
+++ b/glifestream/stream/models.py
@@ -73,7 +73,8 @@ class Service (models.Model):
@python_2_unicode_compatible
class Entry (models.Model):
- service = models.ForeignKey(Service, verbose_name=_('Service'),
+ service = models.ForeignKey(Service, on_delete=models.CASCADE,
+ verbose_name=_('Service'),
null=False, blank=False)
title = models.CharField(_('Title'), max_length=255)
link = models.URLField(_('Link'),)
@@ -120,7 +121,7 @@ class Entry (models.Model):
@python_2_unicode_compatible
class Media (models.Model):
- entry = models.ForeignKey(Entry, verbose_name=_('Entry'),
+ entry = models.ForeignKey(Entry, on_delete=models.CASCADE, verbose_name=_('Entry'),
null=False, blank=False)
file = models.FileField(upload_to='upload/%Y/%m/%d')
@@ -135,8 +136,8 @@ class Media (models.Model):
@python_2_unicode_compatible
class Favorite (models.Model):
- user = models.ForeignKey(User, db_index=True)
- entry = models.ForeignKey(Entry, verbose_name=_('Entry'),
+ user = models.ForeignKey(User, on_delete=models.CASCADE, db_index=True)
+ entry = models.ForeignKey(Entry, on_delete=models.CASCADE, verbose_name=_('Entry'),
null=False, blank=False)
date_added = models.DateTimeField(auto_now_add=True)
@@ -152,7 +153,7 @@ class Favorite (models.Model):
@python_2_unicode_compatible
class List (models.Model):
- user = models.ForeignKey(User, db_index=True)
+ user = models.ForeignKey(User, on_delete=models.CASCADE, db_index=True)
name = models.CharField(_('Name'), max_length=48, null=False, blank=False)
slug = models.CharField(_('Slug'), max_length=48, null=False, blank=True,
editable=False)
@@ -174,7 +175,7 @@ class List (models.Model):
class Pshb (models.Model):
hash = models.CharField('ID', max_length=20, unique=True)
- service = models.ForeignKey(Service, verbose_name=_('Service'),
+ service = models.ForeignKey(Service, on_delete=models.CASCADE, verbose_name=_('Service'),
null=False, blank=False)
hub = models.CharField('Hub', max_length=128)
secret = models.CharField('Secret', max_length=16, null=True, blank=True)
diff --git a/glifestream/stream/views.py b/glifestream/stream/views.py
index 35ad817..51e5c30 100644
--- a/glifestream/stream/views.py
+++ b/glifestream/stream/views.py
@@ -457,7 +457,7 @@ def index(request, **args):
'is_secure': request.is_secure(),
'user': request.user})
res['X-XRDS-Location'] = request.build_absolute_uri(
- urlresolvers.reverse('glifestream.gauth.views.xrds'))
+ urlresolvers.reverse('xrds'))
return res
diff --git a/glifestream/templates/base.html b/glifestream/templates/base.html
index 5ba9105..35dbef9 100644
--- a/glifestream/templates/base.html
+++ b/glifestream/templates/base.html
@@ -1,4 +1,4 @@
-{% load i18n media static pipeline %}{% load url from future %}{% load firstof from future %}<!DOCTYPE html>
+{% load i18n media static pipeline %}<!DOCTYPE html>
<html>
<head>
@@ -26,11 +26,11 @@
<a href="{% url 'index' %}" title="{% trans "My private stream" %}">{% trans "Home" %}</a> |
<a href="{% url 'public' %}" title="{% trans "My publicly visible stream" %}" accesskey="2">{% trans "Public" %}</a> |
{% if user.is_staff %}<a href="{% url 'settings' %}">{% trans "Settings" %}</a> |{% endif %}
- <a href="{% url 'django.contrib.auth.views.logout' %}">{% trans "Logout" %}</a>
+ <a href="{% url 'logout' %}">{% trans "Logout" %}</a>
{% else %}
{% if friend %}<span class="text">{% trans "Hello" %}
<a href="{{ user.fb_profile_url }}" target="_blank"><b>{{ user.fb_username }}</b></a></span> |
- <a href="{% url 'django.contrib.auth.views.logout' %}">{% trans "Logout" %}</a>
+ <a href="{% url 'logout' %}">{% trans "Logout" %}</a>
{% else %}
{% if page.login_url %}<a href="{{ page.login_url }}" rel="nofollow">{% trans "Login" %}</a>{% endif %}
{% endif %}
@@ -52,7 +52,7 @@
{% if page.need_fbc %}
<div id="fb-root"></div>
-<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
+<script type="text/javascript" src="https://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
function fb_login_friend () { window.location = '{% url "gauth.views.login_friend" %}'; }
$(document).ready (function () {
diff --git a/glifestream/templates/stream-pure.html b/glifestream/templates/stream-pure.html
index 81c5de4..690f1e2 100644
--- a/glifestream/templates/stream-pure.html
+++ b/glifestream/templates/stream-pure.html
@@ -1,5 +1,4 @@
{% load i18n media gls_filters %}
-{% load url from future %}{% load firstof from future %}
{% for entry in entries %}
<article id="entry-{{ entry.id }}" class="hentry e-{% firstof entry.service.cls entry.service.api %}{% if not entry.service.public %} private{% endif %}">
{% spaceless %}
diff --git a/glifestream/templates/stream.atom b/glifestream/templates/stream.atom
index a9907fe..d5d8912 100644
--- a/glifestream/templates/stream.atom
+++ b/glifestream/templates/stream.atom
@@ -1,4 +1,4 @@
-{% load firstof from future %}{% load gls_filters %}<?xml version="1.0" encoding="UTF-8"?>
+{% load gls_filters %}<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
xmlns:georss="http://www.georss.org/georss"
diff --git a/glifestream/templates/stream.html b/glifestream/templates/stream.html
index 140390f..7bcde0a 100644
--- a/glifestream/templates/stream.html
+++ b/glifestream/templates/stream.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-{% load i18n %}{% load url from future %}{% load firstof from future %}
+{% load i18n %}
{% block sidebar %}
<aside id="sidebar">
@@ -44,7 +44,7 @@
{% if authed %}
<aside id="share">
<span tabindex="0" class="link" id="ashare">{% trans "Add content" %}</span>
- <form action="{% url 'stream.views.api' cmd='share' %}" method="post" enctype="multipart/form-data">
+ <form action="{% url 'api' cmd='share' %}" method="post" enctype="multipart/form-data">
<div class="fieldset" style="display:none">
<h3><label for="status">{% trans "What's up?" %}</label></h3>
<div class="editor">
diff --git a/glifestream/templates/stream.json b/glifestream/templates/stream.json
index 2f03365..90227da 100644
--- a/glifestream/templates/stream.json
+++ b/glifestream/templates/stream.json
@@ -1,4 +1,4 @@
-{% load firstof from future %}{% load gls_filters %}{% if callback %}{{ callback }}({% endif %}{
+{% load gls_filters %}{% if callback %}{{ callback }}({% endif %}{
"title": "{% firstof page.title "Lifestream" %}",
"updated": "{{ page.updated|gls_hdate }}",
"generator": "gLifestream",
diff --git a/glifestream/urls.py b/glifestream/urls.py
index 958fafc..c65d14e 100644
--- a/glifestream/urls.py
+++ b/glifestream/urls.py
@@ -14,66 +14,65 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
from django.conf import settings
-from django.conf.urls import patterns, url, include
+from django.conf.urls import url, include
from django.contrib import admin
+from django.contrib.auth.views import logout
+from django.views.static import serve as static_serve
admin.autodiscover()
from glifestream.stream import views as sv
+from glifestream.gauth.views import login
handler404 = 'glifestream.stream.views.page_not_found'
-urlpatterns = patterns(
- '',
+urlpatterns = [
url(r'^$', sv.index, name='index'),
- (r'^(?P<year>\d{4})/$', sv.index),
- (r'^(?P<year>\d{4})/(?P<month>\d{2})/$', sv.index),
- (r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$',
- sv.index),
+ url(r'^(?P<year>\d{4})/$', sv.index),
+ url(r'^(?P<year>\d{4})/(?P<month>\d{2})/$', sv.index),
+ url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$', sv.index),
- (r'^public/$', sv.index, {'ctx': 'public'}, 'public'),
- (r'^public/(?P<year>\d{4})/$', sv.index, {
+ url(r'^public/$', sv.index, {'ctx': 'public'}, name='public'),
+ url(r'^public/(?P<year>\d{4})/$', sv.index, {
'ctx': 'public'}),
- (r'^public/(?P<year>\d{4})/(?P<month>\d{2})/$', sv.index,
- {'ctx': 'public'}),
- (r'^public/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$', sv.index,
- {'ctx': 'public'}),
+ url(r'^public/(?P<year>\d{4})/(?P<month>\d{2})/$', sv.index,
+ {'ctx': 'public'}),
+ url(r'^public/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$', sv.index,
+ {'ctx': 'public'}),
- (r'^entry/(?P<entry>\d+)(/.*)?$', sv.index, {}, 'entry'),
- (r'^api/(?P<cmd>[a-z]+)$', sv.api),
+ url(r'^entry/(?P<entry>\d+)(/.*)?$', sv.index, {}, name='entry'),
+ url(r'^api/(?P<cmd>[a-z]+)$', sv.api, name='api'),
- (r'^favorites/$', sv.index, {
- 'ctx': 'favorites'}, 'favorites'),
- (r'^favorites/(?P<year>\d{4})/$', sv.index, {
- 'ctx': 'favorites'}),
- (r'^favorites/(?P<year>\d{4})/(?P<month>\d{2})/$',
- sv.index, {'ctx': 'favorites'}),
- (r'^favorites/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$',
- sv.index, {'ctx': 'favorites'}),
+ url(r'^favorites/$', sv.index, {
+ 'ctx': 'favorites'}, name='favorites'),
+ url(r'^favorites/(?P<year>\d{4})/$', sv.index, {
+ 'ctx': 'favorites'}),
+ url(r'^favorites/(?P<year>\d{4})/(?P<month>\d{2})/$',
+ sv.index, {'ctx': 'favorites'}),
+ url(r'^favorites/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$',
+ sv.index, {'ctx': 'favorites'}),
- (r'^list/(?P<list>[a-z0-9\-]+)/$', sv.index, {}, 'list'),
- (r'^list/(?P<list>[a-z0-9\-]+)/(?P<year>\d{4})/$', sv.index),
- (r'^list/(?P<list>[a-z0-9\-]+)/(?P<year>\d{4})/(?P<month>\d{2})/$',
- sv.index),
- (r'^list/(?P<list>[a-z0-9\-]+)/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$',
- sv.index),
+ url(r'^list/(?P<list>[a-z0-9\-]+)/$', sv.index, {}, name='list'),
+ url(r'^list/(?P<list>[a-z0-9\-]+)/(?P<year>\d{4})/$', sv.index),
+ url(r'^list/(?P<list>[a-z0-9\-]+)/(?P<year>\d{4})/(?P<month>\d{2})/$',
+ sv.index),
+ url(r'^list/(?P<list>[a-z0-9\-]+)/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$',
+ sv.index),
- (r'^pshb/(?P<id>[a-f0-9]{20})$',
- sv.pshb_dispatcher, {}, 'pshb'),
+ url(r'^pshb/(?P<id>[a-f0-9]{20})$',
+ sv.pshb_dispatcher, {}, name='pshb'),
- (r'^login/?$', 'glifestream.gauth.views.login'),
- (r'^logout/?$', 'django.contrib.auth.views.logout',
- {'next_page': './'}),
+ url(r'^login/?$', login, name='login'),
+ url(r'^logout/?$', logout, {'next_page': './'}, name='logout'),
- (r'^auth/', include('glifestream.gauth.urls')),
- (r'^bookmarklet/', include(
- 'glifestream.bookmarklet.urls')),
- (r'^settings/', include('glifestream.usettings.urls')),
+ url(r'^auth/', include('glifestream.gauth.urls')),
+ url(r'^bookmarklet/', include(
+ 'glifestream.bookmarklet.urls')),
+ url(r'^settings/', include('glifestream.usettings.urls')),
- (r'^admin/', include(admin.site.urls)),
-)
+ url(r'^admin/', include(admin.site.urls)),
+]
-urlpatterns += patterns(
- '',
- (r'^media/(?P<path>.*)$', 'django.views.static.serve',
- {'document_root': settings.MEDIA_ROOT})
-)
+urlpatterns += [
+ url(r'^media/(?P<path>.*)$', static_serve,
+ {'document_root': settings.MEDIA_ROOT})
+]
diff --git a/glifestream/usettings/templates/oauth.html b/glifestream/usettings/templates/oauth.html
index 5aac634..2b9f095 100644
--- a/glifestream/usettings/templates/oauth.html
+++ b/glifestream/usettings/templates/oauth.html
@@ -1,4 +1,4 @@
-{% load i18n media %}{% load firstof from future %}<!DOCTYPE html>
+{% load i18n media %}<!DOCTYPE html>
<html>
<head>
diff --git a/glifestream/usettings/templates/oid.html b/glifestream/usettings/templates/oid.html
index 47eb6a9..98fc46e 100644
--- a/glifestream/usettings/templates/oid.html
+++ b/glifestream/usettings/templates/oid.html
@@ -1,5 +1,5 @@
{% extends "settings.html" %}
-{% load i18n %}{% load url from future %}
+{% load i18n %}
{% block settings %}
<p class="bold">{% trans "Attached identities:" %}</p>
@@ -10,7 +10,7 @@
{% endfor %}
</ul>
- <form id="oid-form" method="post" action="{% url 'glifestream.usettings.views.openid' %}">
+ <form id="oid-form" method="post" action="{% url 'usettings-openid' %}">
<fieldset>
{% if page.msg %}
<ul class="errorlist">
diff --git a/glifestream/usettings/templates/pshb.html b/glifestream/usettings/templates/pshb.html
index ed02a54..d37247a 100644
--- a/glifestream/usettings/templates/pshb.html
+++ b/glifestream/usettings/templates/pshb.html
@@ -1,5 +1,5 @@
{% extends "settings.html" %}
-{% load i18n %}{% load url from future %}
+{% load i18n %}
{% block settings %}
<p class="bold">{% trans "PubSubHubbub subscriptions" %}
@@ -31,7 +31,7 @@
{% endif %}
{% if services %}
- <form id="pshb-form" method="post" action="{% url 'glifestream.usettings.views.pshb' %}">
+ <form id="pshb-form" method="post" action="{% url 'usettings-pshb' %}">
<select name="subscribe">
<option value="">-- {% trans "service" %} --</option>
{% for s in services %}
diff --git a/glifestream/usettings/templates/services.html b/glifestream/usettings/templates/services.html
index e51ac5b..dff736f 100644
--- a/glifestream/usettings/templates/services.html
+++ b/glifestream/usettings/templates/services.html
@@ -1,5 +1,5 @@
{% extends "settings.html" %}
-{% load media i18n %}{% load url from future %}
+{% load media i18n %}
{% block settings %}
<p id="add-service">
diff --git a/glifestream/usettings/templates/settings.html b/glifestream/usettings/templates/settings.html
index e383fef..a45526a 100644
--- a/glifestream/usettings/templates/settings.html
+++ b/glifestream/usettings/templates/settings.html
@@ -1,14 +1,14 @@
{% extends "base.html" %}
-{% load i18n %}{% load url from future %}
+{% load i18n %}
{% block main %}
<section id="settings">
<ul class="tabs">
- <li><a href="{% url 'glifestream.usettings.views.services' %}"{% ifequal page.menu "services" %} class="active"{% endifequal %}>{% trans "Services" %}</a></li>
- <li><a href="{% url 'glifestream.usettings.views.lists' %}"{% ifequal page.menu "lists" %} class="active"{% endifequal %}>{% trans "Lists" %}</a></li>
- <li><a href="{% url 'glifestream.usettings.views.pshb' %}"{% ifequal page.menu "pshb" %} class="active"{% endifequal %}>{% trans "PubSubHub" %}</a></li>
- <li><a href="{% url 'glifestream.usettings.views.openid' %}"{% ifequal page.menu "openid" %} class="active"{% endifequal %}>{% trans "OpenID" %}</a></li>
- <li><a href="{% url 'glifestream.usettings.views.tools' %}"{% ifequal page.menu "tools" %} class="active"{% endifequal %}>{% trans "Tools" %}</a></li>
+ <li><a href="{% url 'usettings-services' %}"{% ifequal page.menu "services" %} class="active"{% endifequal %}>{% trans "Services" %}</a></li>
+ <li><a href="{% url 'usettings-lists' %}"{% ifequal page.menu "lists" %} class="active"{% endifequal %}>{% trans "Lists" %}</a></li>
+ <li><a href="{% url 'usettings-pshb' %}"{% ifequal page.menu "pshb" %} class="active"{% endifequal %}>{% trans "PubSubHub" %}</a></li>
+ <li><a href="{% url 'usettings-openid' %}"{% ifequal page.menu "openid" %} class="active"{% endifequal %}>{% trans "OpenID" %}</a></li>
+ <li><a href="{% url 'usettings-tools' %}"{% ifequal page.menu "tools" %} class="active"{% endifequal %}>{% trans "Tools" %}</a></li>
</ul>
{% block settings %}{% endblock %}
</section>
diff --git a/glifestream/usettings/urls.py b/glifestream/usettings/urls.py
index 6758ab1..e449a5e 100644
--- a/glifestream/usettings/urls.py
+++ b/glifestream/usettings/urls.py
@@ -13,23 +13,22 @@
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
-from django.conf.urls import patterns, url
+from django.conf.urls import url
from django.views.generic.base import RedirectView
from glifestream.usettings import views
-urlpatterns = patterns(
- '',
- url(r'^$', RedirectView.as_view(url='services'), name='settings'),
- (r'api/(?P<cmd>[a-z\-]+)$', views.api),
- (r'services$', views.services),
- (r'services/import$', views.opml, {
- 'cmd': 'import'}, 'opml-import'),
- (r'services/export$', views.opml, {
- 'cmd': 'export'}, 'opml-export'),
- (r'lists$', views.lists),
- (r'lists/(?P<list>[a-z0-9\-]+)$', views.lists),
- (r'pshb$', views.pshb),
- (r'openid$', views.openid),
- (r'tools$', views.tools),
- (r'oauth/(?P<id>[0-9]+)$', views.oauth),
-)
+urlpatterns = [
+ url(r'^$', RedirectView.as_view(url='services', permanent=False), name='settings'),
+ url(r'api/(?P<cmd>[a-z\-]+)$', views.api),
+ url(r'services$', views.services, name='usettings-services'),
+ url(r'services/import$', views.opml, {
+ 'cmd': 'import'}, 'opml-import'),
+ url(r'services/export$', views.opml, {
+ 'cmd': 'export'}, 'opml-export'),
+ url(r'lists$', views.lists, name='usettings-lists'),
+ url(r'lists/(?P<list>[a-z0-9\-]+)$', views.lists, name='usettings-lists-slug'),
+ url(r'pshb$', views.pshb, name='usettings-pshb'),
+ url(r'openid$', views.openid, name='usettings-openid'),
+ url(r'tools$', views.tools, name='usettings-tools'),
+ url(r'oauth/(?P<id>[0-9]+)$', views.oauth, name='usettings-oauth'),
+]
diff --git a/glifestream/usettings/views.py b/glifestream/usettings/views.py
index 9ff64f5..f05af2c 100644
--- a/glifestream/usettings/views.py
+++ b/glifestream/usettings/views.py
@@ -106,13 +106,13 @@ def lists(request, **args):
if request.POST.get('delete', False):
list.delete()
return HttpResponseRedirect(
- urlresolvers.reverse('glifestream.usettings.views.lists'))
+ urlresolvers.reverse('usettings-lists'))
else:
form = ListForm(request.POST, instance=list)
if form.is_valid():
form.save()
return HttpResponseRedirect(
- urlresolvers.reverse('glifestream.usettings.views.lists',
+ urlresolvers.reverse('usettings-lists-slug',
args=[list.slug]))
else:
form = ListForm(instance=list)
@@ -208,8 +208,7 @@ def openid(request, **args):
try:
db = OpenId(user=request.user, identity=rs['identity_url'])
db.save()
- return HttpResponseRedirect(
- urlresolvers.reverse('glifestream.usettings.views.openid'))
+ return HttpResponseRedirect(urlresolvers.reverse('usettings-openid'))
except IntegrityError:
pass
elif 'msg' in rs:
@@ -268,7 +267,7 @@ def oauth(request, **args):
id = args['id']
callback_url = request.build_absolute_uri(
- urlresolvers.reverse('glifestream.usettings.views.oauth', args=[id]))
+ urlresolvers.reverse('usettings-oauth', args=[id]))
service = Service.objects.get(id=id)
c = gls_oauth.OAuth1Client(service=service,
@@ -313,8 +312,7 @@ def oauth(request, **args):
try:
c.get_access_token()
c.save()
- return HttpResponseRedirect(urlresolvers.reverse(
- 'glifestream.usettings.views.oauth', args=[id]))
+ return HttpResponseRedirect(urlresolvers.reverse('usettings-oauth', args=[id]))
except Exception as e:
page['msg'] = e
@@ -368,7 +366,7 @@ def opml(request, **args):
_import_service(xml_url, title, cls)
return HttpResponseRedirect(
- urlresolvers.reverse('glifestream.usettings.views.services'))
+ urlresolvers.reverse('usettings-services'))
elif cmd == 'export':
excluded_apis = ('selfposts', 'fb')
diff --git a/glifestream/utils/html.py b/glifestream/utils/html.py
index 9fe6b99..ed75356 100644
--- a/glifestream/utils/html.py
+++ b/glifestream/utils/html.py
@@ -13,6 +13,11 @@
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
+import re
+from django.utils import six
+from django.utils.encoding import force_text
+from django.utils.functional import allow_lazy
+
try:
from bs4 import BeautifulSoup
except ImportError:
@@ -44,3 +49,11 @@ def bytes_to_human(bytes, precision=2):
precision = 0
return format % (precision, size, suffix)
return format % (precision, size, suffixes[-1])
+
+
+def strip_entities(value):
+ """Returns the given HTML with all entities (&something;) stripped."""
+ return re.sub(r'&(?:\w+|#\d+);', '', force_text(value))
+
+
+strip_entities = allow_lazy(strip_entities, six.text_type)
diff --git a/requirements.txt b/requirements.txt
index 351aab2..470a624 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,11 +1,12 @@
-Django ==1.7.*
-django-pipeline ==1.4.*
+Django ==1.11.*
+django-pipeline ==1.6.*
mysqlclient ==1.4.*
feedparser ==5.1.*
-Pillow ==2.7.*
+Pillow ==6.1.*
workerpool ==0.9.*
python-memcached ==1.54
-python-openid ==2.2.*
+python-openid ==2.2.*; python_version < '3.0'
+python3-openid ==3.1.*; python_version >= '3.0'
requests-oauthlib ==0.4.*
beautifulsoup4 ==4.3.*
Markdown ==2.6.*

Return to:

Send suggestions and report system problems to the System administrator.