Branch: refs/heads/master Author: Enrico Tröger enrico.troeger@uvena.de Committer: Enrico Tröger enrico.troeger@uvena.de Date: Sun, 05 Jun 2022 11:47:08 UTC Commit: 2a52c53f3bfb4194c93ba34e757c9e9641cda6bc https://github.com/geany/www.geany.org/commit/2a52c53f3bfb4194c93ba34e757c9e...
Log Message: ----------- Upgrade to Mezzanine 5 and Django 4
This disables the currently unused django-link-shortener" app which is not yet compatible with Django 4.
Modified Paths: -------------- geany/settings.py geany/templates/pages/documentation/screenshots.html geany/templates/twitter/tweets.html geany/urls.py geany/urls_legacy.py latest_version/urls.py news/models.py news/templates/news/list_embedded.html news/urls.py pastebin/forms.py pastebin/models.py pastebin/static/css/pastebin.css pastebin/templates/pastebin/widgets/radio.html pastebin/urls.py pastebin/views.py requirements.txt static_docs/urls.py
Modified: geany/settings.py 15 lines changed, 5 insertions(+), 10 deletions(-) =================================================================== @@ -1,4 +1,3 @@ -# coding: utf-8 # LICENCE: This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -12,13 +11,11 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see http://www.gnu.org/licenses/.
-from __future__ import absolute_import, unicode_literals - import logging import os import warnings
-from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from markdown.extensions.toc import TocExtension
@@ -219,6 +216,8 @@ } DATABASE_ROUTERS = ['nightlybuilds.database_routers.NightlyBuildsRouter']
+DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' +
######### # PATHS # @@ -280,9 +279,6 @@ 'latest_version.context_processors.latest_version', 'mezzanine.pages.context_processors.page', ], - 'builtins': [ - 'mezzanine.template.loader_tags', - ], }, }, ] @@ -322,7 +318,6 @@ "mezzanine.pages", "mezzanine.forms", "mezzanine.galleries", - "mezzanine.twitter",
# we "geany.apps.GeanyAppConfig", @@ -339,7 +334,7 @@ "honeypot", # for pastebin "mezzanine_pagedown", "mezzanine_sync_pages.apps.MezzanineSyncPagesAppConfig", - "shortener", + #"shortener", # disabled until it is fixed for Django 4.0 or we remove it completely PACKAGE_NAME_FILEBROWSER, PACKAGE_NAME_GRAPPELLI, ) @@ -600,7 +595,7 @@ def skip_404_not_found(record): message='^mezzanine_pagedown.filters.custom needs to ensure that any untrusted inputs.*', category=FutureWarning, module='mezzanine.core.templatetags.mezzanine_tags', - lineno=487) + lineno=495)
################## # LOCAL SETTINGS #
Modified: geany/templates/pages/documentation/screenshots.html 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -1,6 +1,6 @@ {% extends "pages/page.html" %}
-{% load mezzanine_tags staticfiles %} +{% load mezzanine_tags static %}
{% block extra_css %} <link rel="stylesheet" href="{% static "mezzanine/css/magnific-popup.css" %}">
Modified: geany/templates/twitter/tweets.html 24 lines changed, 0 insertions(+), 24 deletions(-) =================================================================== @@ -1,24 +0,0 @@ - -{% load twitter_tags i18n %} - -{% tweets_default as tweets %} - -{% if tweets %} -<h3>{% trans "Recent Tweets" %}</h3> -<ul class="list-unstyled tweets"> - {% for tweet in tweets %} - <li> - <img src="{{ tweet.profile_image_url }}" alt=""> - <a href="http://twitter.com/{{ tweet.user_name }}">@{{ tweet.user_name }}</a> - {% if tweet.user_name != tweet.full_name %}<span class="name">@{{ tweet.full_name }}</span>{% endif %} - <span class="timespan">{{ tweet.created_at|timesince }} {% trans "ago" %}</span> - {% if tweet.is_retweet %} - <p><span class="recycle">♻</span> - <img class="retweet" src="{{ tweet.retweeter_profile_image_url }}"> - <a href="http://twitter.com/{{ tweet.retweeter_user_name }}">@{{ tweet.retweeter_full_name }}</a></p> - {% endif %} - <div>{{ tweet.text|safe }}</div> - </li> - {% endfor %} -</ul> -{% endif %}
Modified: geany/urls.py 37 lines changed, 18 insertions(+), 19 deletions(-) =================================================================== @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # LICENCE: This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -12,10 +11,10 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see http://www.gnu.org/licenses/.
-from django.conf.urls import include, url from django.conf.urls.i18n import i18n_patterns from django.contrib import admin from django.contrib.sitemaps.views import sitemap +from django.urls import include, path, re_path from django.views.generic.base import TemplateView from django.views.i18n import set_language from django.views.static import serve as static_serve @@ -37,57 +36,57 @@ urlpatterns = i18n_patterns( # Change the admin prefix here to use an alternate URL for the # admin interface, which would be marginally more secure. - url('^admin/clearcache/', include('clearcache.urls')), - url("^admin/", include(admin.site.urls)), + path('admin/clearcache/', include('clearcache.urls')), + path("admin/", include(admin.site.urls)), )
if settings.USE_MODELTRANSLATION: urlpatterns += ( - url('^i18n/$', set_language, name='set_language'), + path('i18n/', set_language, name='set_language'), )
# Geany patterns urlpatterns += ( # use our custom sitemap implementation - url(r"^sitemap.xml$", sitemap, sitemaps, name='django.contrib.sitemaps.views.sitemap'), + path('sitemap.xml', sitemap, sitemaps, name='django.contrib.sitemaps.views.sitemap'),
# Release Notes, NEWS, etc. - url(r"^", include("static_docs.urls")), + re_path('^', include('static_docs.urls')),
# nightly builds - url(r"^download/nightly-builds/$", NightlyBuildsView.as_view(), name='nightlybuilds'), + path('download/nightly-builds/', NightlyBuildsView.as_view(), name='nightlybuilds'),
# /service/version.php (for the UpdateChecker plugin) - url(r"^", include("latest_version.urls")), + re_path('^', include('latest_version.urls')),
# Pastebin - url(r"^p/", include("pastebin.urls")), + path('p/', include('pastebin.urls')),
# URL Shortener - url(r'^s/', include('urlshortener.urls')), + #path('s/', include('urlshortener.urls')), # disabled until it is fixed for Django 4.0
# /news/ News - url(r"^news/", include("news.urls")), + path('news/', include('news.urls')),
# home page - url(r"^$", TemplateView.as_view(template_name='home.html'), name='home'), + path('', TemplateView.as_view(template_name='home.html'), name='home'),
# pagedown - url(r"^pagedown/", include(mezzanine_pagedown.urls)), + path('pagedown/', include(mezzanine_pagedown.urls)),
# legacy URLs (redirect for old website deeplinks) - url(r"^", include(urls_legacy)), + re_path('^', include(urls_legacy)),
# everything else - url(r"^", include("mezzanine.urls")), + re_path('^', include('mezzanine.urls')), )
# Adds ``STATIC_URL`` to the context of error pages, so that error # pages can use JS, CSS and images. -handler404 = "mezzanine.core.views.page_not_found" -handler500 = "mezzanine.core.views.server_error" +handler404 = 'mezzanine.core.views.page_not_found' +handler500 = 'mezzanine.core.views.server_error'
if settings.DEBUG: urlpatterns += ( - url(r'^media/(?P<path>.*)$', static_serve, {'document_root': settings.MEDIA_ROOT, }),) + path('media/<path>/', static_serve, {'document_root': settings.MEDIA_ROOT, }),)
Modified: geany/urls_legacy.py 7 lines changed, 3 insertions(+), 4 deletions(-) =================================================================== @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # LICENCE: This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -12,7 +11,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see http://www.gnu.org/licenses/.
-from django.conf.urls import url +from django.urls import re_path from django.views.generic.base import RedirectView
@@ -188,13 +187,13 @@ def _add_url_mappings(mapping, urlpatterns_): if old_url.startswith('/'): old_url = old_url[1:]
- url_pattern = url( + url_pattern = re_path( fr'^{old_url}$', RedirectView.as_view(url=new_url, permanent=True)) urlpatterns_.append(url_pattern) # add pattern variant with trailing slash if old_url[-1] != '/': - url_pattern = url( + url_pattern = re_path( fr'^{old_url}/$', RedirectView.as_view(url=new_url, permanent=True)) urlpatterns_.append(url_pattern)
Modified: latest_version/urls.py 11 lines changed, 5 insertions(+), 6 deletions(-) =================================================================== @@ -1,4 +1,3 @@ -# coding: utf-8 # LICENCE: This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -12,19 +11,19 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see http://www.gnu.org/licenses/.
-from django.conf.urls import url +from django.urls import path from django.views.generic import TemplateView
urlpatterns = ( # pylint: disable=invalid-name # special url for the UpdateChecker Geany plugin - url( - r'^service/version/', + path( + 'service/version/', TemplateView.as_view(template_name='latest_version.txt', content_type='text/plain'), name='latest_version'), # legacy url for the UpdateChecker Geany plugin - url( - r'^service/version.php', + path( + 'service/version.php', TemplateView.as_view(template_name='latest_version.txt', content_type='text/plain'), name='latest_version_legacy'), )
Modified: news/models.py 3 lines changed, 1 insertions(+), 2 deletions(-) =================================================================== @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # LICENCE: This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -16,7 +15,7 @@ from django.urls import reverse from django.utils import timezone from django.utils.timezone import now -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from mezzanine.core.fields import RichTextField from mezzanine.core.models import CONTENT_STATUS_CHOICES, CONTENT_STATUS_PUBLISHED from mezzanine.utils.models import get_user_model_name
Modified: news/templates/news/list_embedded.html 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -1,4 +1,4 @@ -{% load static from staticfiles %} +{% load static %}
<ul class="list-group"> {% for newspost in recent_news_posts %}
Modified: news/urls.py 9 lines changed, 4 insertions(+), 5 deletions(-) =================================================================== @@ -1,4 +1,3 @@ -# coding: utf-8 # LICENCE: This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -12,14 +11,14 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see http://www.gnu.org/licenses/.
-from django.conf.urls import url +from django.urls import path, re_path
from news.feeds import LatestNewsPostsFeed from news.views import NewsDetailView, NewsListView
urlpatterns = ( # pylint: disable=invalid-name - url(r'^$', NewsListView.as_view(), name='news_list'), - url(r'^feed/$', LatestNewsPostsFeed(), name='news_feed'), - url(r'^(?P<newspost_slug>.+)/$', NewsDetailView.as_view(), name='news_detail'), + path('', NewsListView.as_view(), name='news_list'), + path('feed/', LatestNewsPostsFeed(), name='news_feed'), + re_path(r'^(?P<newspost_slug>.+)/$', NewsDetailView.as_view(), name='news_detail'), )
Modified: pastebin/forms.py 10 lines changed, 7 insertions(+), 3 deletions(-) =================================================================== @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # LICENCE: This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -16,7 +15,7 @@
from django import forms from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _
from pastebin.highlight import LEXER_DEFAULT, LEXER_LIST from pastebin.models import Snippet, Spamword @@ -36,6 +35,11 @@ EXPIRE_DEFAULT = 3600 * 24 * 30
+class ExpiryOptionsWidget(forms.RadioSelect): + template_name = 'pastebin/widgets/radio.html' + option_inherits_attrs = False + + class SnippetForm(forms.ModelForm):
lexer = forms.ChoiceField( @@ -48,7 +52,7 @@ class SnippetForm(forms.ModelForm): choices=EXPIRE_CHOICES, initial=EXPIRE_DEFAULT, label=_('Expires'), - widget=forms.RadioSelect, + widget=ExpiryOptionsWidget, )
# ----------------------------------------------------------------------
Modified: pastebin/models.py 3 lines changed, 1 insertions(+), 2 deletions(-) =================================================================== @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # LICENCE: This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -21,7 +20,7 @@ from django.db import models from django.urls import reverse from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _
from pastebin.highlight import LEXER_DEFAULT
Modified: pastebin/static/css/pastebin.css 29 lines changed, 2 insertions(+), 27 deletions(-) =================================================================== @@ -31,33 +31,8 @@ form.new-snippet-form { font-weight: 200; }
-.new-snippet-form ul#id_expire_options { - margin-left: 5px; - margin-bottom: 0px; - width: auto; - border: none; - background-color: inherit; /* overwrite the color set by .form-control */ - box-shadow: inherit; /* overwrite the shadow set by .form-control */ -} - -.new-snippet-form ul#id_expire_options li { - list-style: none; -} - -.new-snippet-form ul#id_expire_options li input{ - display: inline; -} - -.new-snippet-form ul#id_expire_options li label { - float: left; - text-align: center; - margin-right: 10px; - padding-right: 15px; - width: auto; -} - -.new-snippet-form ul#id_expire_options li input[type="radio"] { - margin: 0px; +.new-snippet-form .form-group div input[type="radio"] { + margin-top: 0; }
.new-snippet-form .form-group input[type="text"],
Modified: pastebin/templates/pastebin/widgets/radio.html 5 lines changed, 5 insertions(+), 0 deletions(-) =================================================================== @@ -0,0 +1,5 @@ +{% with id=widget.attrs.id %}<div{% if id %} id="{{ id }}"{% endif %}{% if widget.attrs.class %} {{ widget.attrs.class }}"{% endif %}>{% for group, options, index in widget.optgroups %}{% if group %} + <div><label>{{ group }}</label>{% endif %}{% for option in options %}<div class="radio-inline"> + {% include option.template_name with widget=option %}</div>{% endfor %}{% if group %} + </div>{% endif %}{% endfor %} +</div>{% endwith %}
Modified: pastebin/urls.py 23 lines changed, 11 insertions(+), 12 deletions(-) =================================================================== @@ -1,4 +1,3 @@ -# coding: utf-8 # LICENCE: This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -12,7 +11,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see http://www.gnu.org/licenses/.
-from django.conf.urls import url +from django.urls import path, re_path from django.views.decorators.cache import never_cache from django.views.generic.base import TemplateView
@@ -27,28 +26,28 @@
urlpatterns = ( # pylint: disable=invalid-name - url( - r'^help/$', + path( + 'help/', TemplateView.as_view(template_name='pastebin/help.html'), name='snippet_help'), - url( - r'^help/api/$', + path( + 'help/api/', TemplateView.as_view(template_name='pastebin/api.html'), name='snippet_help_api'),
- url(r'^api/$', never_cache(SnippetAPIView.as_view()), name='snippet_api'), + path('api/', never_cache(SnippetAPIView.as_view()), name='snippet_api'),
- url(r'^$', never_cache(SnippetNewView.as_view()), name='snippet_new'), - url(r'^latest/$', never_cache(LatestSnippetsView.as_view()), name='snippet_list'), - url( + path('', never_cache(SnippetNewView.as_view()), name='snippet_new'), + path('latest/', never_cache(LatestSnippetsView.as_view()), name='snippet_list'), + re_path( r'^(?P<snippet_id>[a-zA-Z0-9]+)/$', SnippetDetailView.as_view(), name='snippet_details'), - url( + re_path( r'^(?P<snippet_id>[a-zA-Z0-9]+)/delete/$', SnippetDeleteView.as_view(), name='snippet_delete'), - url( + re_path( r'^(?P<snippet_id>[a-zA-Z0-9]+)/raw/$', SnippetDetailRawView.as_view(), name='snippet_details_raw'),
Modified: pastebin/views.py 3 lines changed, 1 insertions(+), 2 deletions(-) =================================================================== @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # LICENCE: This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -21,7 +20,7 @@ from django.template.response import TemplateResponse from django.urls import reverse from django.utils.decorators import method_decorator -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import gettext_lazy as _ from django.views.decorators.csrf import csrf_exempt from django.views.generic.base import TemplateView, View from honeypot.decorators import check_honeypot
Modified: requirements.txt 13 lines changed, 2 insertions(+), 11 deletions(-) =================================================================== @@ -1,4 +1,4 @@ -Django<3.0,>=2.2 +Mezzanine==5.* babel mysqlclient django-clearcache @@ -7,6 +7,7 @@ django-extensions django-honeypot django-link-shortener django-log-request-id +mezzanine-pagedown mezzanine-sync-pages packaging pygments @@ -19,13 +20,3 @@ uwsgi
# for development django-debug-toolbar - -# Mezzanine from GIT -# https://github.com/stephenmcd/mezzanine/pull/1956 -git+https://github.com/fermorltd/filebrowser-safe.git@2.2-compat#egg=filebrowser... -git+https://github.com/fermorltd/grappelli-safe.git@2.2-compat#egg=grappelli-saf... -git+https://github.com/fermorltd/mezzanine.git@2.2-compat#egg=mezzanine - -# mezzanine-pagedown from GIT with Django >= 2.1 fix -# https://github.com/akhayyat/mezzanine-pagedown/pull/1 -git+https://github.com/eht16/mezzanine-pagedown.git@django-2.1#egg=mezzanine-pag...
Modified: static_docs/urls.py 17 lines changed, 8 insertions(+), 9 deletions(-) =================================================================== @@ -1,4 +1,3 @@ -# coding: utf-8 # LICENCE: This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or @@ -12,24 +11,24 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see http://www.gnu.org/licenses/.
-from django.conf.urls import url +from django.urls import path
from static_docs.views import I18NStatisticsView, ReleaseNotesView, ThemesView, ToDoView
urlpatterns = ( # pylint: disable=invalid-name - url(r'^download/themes/$', ThemesView.as_view(), name='themes'), + path('download/themes/', ThemesView.as_view(), name='themes'),
- url(r'^documentation/todo/$', ToDoView.as_view(), name='todo'), + path('documentation/todo/', ToDoView.as_view(), name='todo'),
- url(r'^documentation/releasenotes/$', ReleaseNotesView.as_view(), name='releasenotes'), - url( - r'^documentation/releasenotes/(?P<version>.*)$', + path('documentation/releasenotes/', ReleaseNotesView.as_view(), name='releasenotes'), + path( + 'documentation/releasenotes/<version>/', ReleaseNotesView.as_view(), name='releasenotes_for_release'),
- url( - r'^contribute/translation/statistics/$', + path( + 'contribute/translation/statistics/', I18NStatisticsView.as_view(), name='translation_statistics'), )
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).