From 6ee2cdd2573866484089da12a892ed1c888b5dc6 Mon Sep 17 00:00:00 2001 From: Wojciech Polak Date: Tue, 10 Sep 2019 17:57:03 +0200 Subject: Upgrade codebase to Django 1.11 --- .gitignore | 5 ++ AUTHORS | 2 +- INSTALL.md | 6 +- glifestream/apis/fb.py | 4 +- glifestream/apis/friendfeed.py | 4 +- glifestream/apis/twitter.py | 3 +- glifestream/bookmarklet/urls.py | 11 ++-- glifestream/gauth/models.py | 6 +- glifestream/gauth/templates/login.html | 4 +- glifestream/gauth/templates/openid.html | 4 +- glifestream/gauth/urls.py | 13 ++-- glifestream/gauth/views.py | 44 ++++++------- glifestream/settings-sample.py | 59 ++++++++++++------ glifestream/stream/models.py | 13 ++-- glifestream/stream/views.py | 2 +- glifestream/templates/base.html | 8 +-- glifestream/templates/stream-pure.html | 1 - glifestream/templates/stream.atom | 2 +- glifestream/templates/stream.html | 4 +- glifestream/templates/stream.json | 2 +- glifestream/urls.py | 89 +++++++++++++-------------- glifestream/usettings/templates/oauth.html | 2 +- glifestream/usettings/templates/oid.html | 4 +- glifestream/usettings/templates/pshb.html | 4 +- glifestream/usettings/templates/services.html | 2 +- glifestream/usettings/templates/settings.html | 12 ++-- glifestream/usettings/urls.py | 33 +++++----- glifestream/usettings/views.py | 14 ++--- glifestream/utils/html.py | 13 ++++ requirements.txt | 9 +-- 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 . -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 . -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 %}
{% if form.errors %}

{% trans "Invalid username or password" %}

{% endif %} -
+

{% if page.msg %}

{{ page.msg }}

{% endif %} - +

- +