From: Radek Czajka Date: Mon, 11 Mar 2019 08:35:16 +0000 (+0100) Subject: Remove Mercurial dependency, replace django_cas with django-cas-ng. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/0d32008f4ab55669ec5eb13ed1af3c2741092ef5?hp=06e460b91c23f11e92bf5ae711a4ed2226d3a0c7 Remove Mercurial dependency, replace django_cas with django-cas-ng. --- diff --git a/requirements/requirements.txt b/requirements/requirements.txt index ea54455c..6bbdf22b 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,24 +1,24 @@ -i https://py.mdrn.pl/simple ## Python libraries -Mercurial>=3.3,<3.4 +merge3==0.0.2 PyYAML>=3.0 Pillow oauth2 httplib2 # oauth2 dependency +python-slugify -librarian +librarian==1.7.1 ## Django Django==1.11.20 fnpdjango==0.3 django-pipeline==1.6.14 -django_cas>=2.1,<2.2 +django-cas-ng==3.6.0 sorl-thumbnail>=12.2,<12.4 # ?? django-maintenancemode>=0.9 fnp-django-pagination==2.2.2 -django-gravatar2 -python-slugify -django-extensions==1.5.7 +django-gravatar2==1.4.2 +django-extensions==2.1.6 raven diff --git a/src/catalogue/templates/catalogue/book_detail.html b/src/catalogue/templates/catalogue/book_detail.html index e2735988..60e426dc 100755 --- a/src/catalogue/templates/catalogue/book_detail.html +++ b/src/catalogue/templates/catalogue/book_detail.html @@ -89,7 +89,7 @@ {% else %} - {% trans "Log in to publish." %} + {% trans "Log in to publish." %} {% endif %} {% else %}

{% trans "This book can't be published yet, because:" %}

diff --git a/src/catalogue/templates/catalogue/image_detail.html b/src/catalogue/templates/catalogue/image_detail.html index 8ad2a63f..6d154d06 100755 --- a/src/catalogue/templates/catalogue/image_detail.html +++ b/src/catalogue/templates/catalogue/image_detail.html @@ -58,7 +58,7 @@ {% else %} - {% trans "Log in to publish." %} + {% trans "Log in to publish." %} {% endif %} {% else %}

{% trans "This book can't be published yet, because:" %}

diff --git a/src/catalogue/views.py b/src/catalogue/views.py index f6208056..5551a5cf 100644 --- a/src/catalogue/views.py +++ b/src/catalogue/views.py @@ -22,7 +22,7 @@ from django.utils.encoding import iri_to_uri from django.utils.http import urlquote_plus from django.utils.translation import ugettext_lazy as _ from django.views.decorators.http import require_POST -from django_cas.decorators import user_passes_test +from django_cas_ng.decorators import user_passes_test from apiclient import NotAuthorizedError from catalogue import forms diff --git a/src/dvcs/models.py b/src/dvcs/models.py index 24bdeb3a..270f24eb 100644 --- a/src/dvcs/models.py +++ b/src/dvcs/models.py @@ -11,7 +11,7 @@ from django.core.files.base import ContentFile from django.db import models, transaction from django.db.models.base import ModelBase from django.utils.translation import string_concat, ugettext_lazy as _ -from mercurial import simplemerge +import merge3 from django.conf import settings from dvcs.signals import post_commit, post_publishable @@ -135,11 +135,11 @@ class Change(models.Model): # immediate child - fast forward return other - local = self.materialize().encode('utf-8') - base = other.parent.materialize().encode('utf-8') - remote = other.materialize().encode('utf-8') + local = self.materialize().splitlines(True) + base = other.parent.materialize().splitlines(True) + remote = other.materialize().splitlines(True) - merge = simplemerge.Merge3Text(base, local, remote) + merge = merge3.Merge3(base, local, remote) result = ''.join(merge.merge_lines()) merge_node = self.children.create( merge_parent=other, tree=self.tree, diff --git a/src/redakcja/localsettings.sample b/src/redakcja/localsettings.sample index c8ec8844..6d17799f 100644 --- a/src/redakcja/localsettings.sample +++ b/src/redakcja/localsettings.sample @@ -22,10 +22,10 @@ MEDIA_ROOT = '/srv/redakcja/media/' # Subdirectory of MEDIA_ROOT containing images IMAGE_DIR = 'images/' -CAS_SERVER_URL = 'http://logowanie.nowoczesnapolska.org.pl/cas/' -CAS_VERSION = '3' +CAS_SERVER_URL = 'https://logowanie.nowoczesnapolska.org.pl/cas/' +CAS_VERSION = '2' -REDMINE_URL = 'http://redmine.nowoczesnapolska.org.pl/' +REDMINE_URL = 'https://redmine.nowoczesnapolska.org.pl/' DEBUG = True MAINTENANCE_MODE = False COMPRESS = False diff --git a/src/redakcja/settings/__init__.py b/src/redakcja/settings/__init__.py index 5aca7f7d..99097547 100644 --- a/src/redakcja/settings/__init__.py +++ b/src/redakcja/settings/__init__.py @@ -38,7 +38,7 @@ MIDDLEWARE_CLASSES = ( 'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django_cas.middleware.CASMiddleware', + 'django_cas_ng.middleware.CASMiddleware', 'django.contrib.admindocs.middleware.XViewMiddleware', 'fnp_django_pagination.middleware.PaginationMiddleware', @@ -52,7 +52,7 @@ if DEBUG: AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', - 'fnpdjango.auth_backends.AttrCASBackend', + 'django_cas_ng.backends.CASBackend', ) ROOT_URLCONF = 'redakcja.urls' @@ -74,6 +74,7 @@ INSTALLED_APPS = ( 'fileupload', 'pipeline', 'fnpdjango', + 'django_cas_ng', 'catalogue', 'cover', diff --git a/src/redakcja/settings/defaults.py b/src/redakcja/settings/defaults.py index 63f9e932..c3dc9819 100644 --- a/src/redakcja/settings/defaults.py +++ b/src/redakcja/settings/defaults.py @@ -65,5 +65,6 @@ BROKER_URL = 'django://' SHOW_APP_VERSION = False -CAS_USER_ATTRS_MAP = { +CAS_APPLY_ATTRIBUTES_TO_USER = True +CAS_RENAME_ATTRIBUTES = { 'email': 'email', 'firstname': 'first_name', 'lastname': 'last_name'} diff --git a/src/redakcja/templates/registration/head_login.html b/src/redakcja/templates/registration/head_login.html index 2a8fd3bd..15ef5630 100644 --- a/src/redakcja/templates/registration/head_login.html +++ b/src/redakcja/templates/registration/head_login.html @@ -9,7 +9,7 @@ {% trans "Log Out" %} {% else %} -{% url "login" as login_url %} +{% url "cas_ng_login" as login_url %} {% ifnotequal login_url request.path %} {% trans "Log In" %} {% endifnotequal %} diff --git a/src/redakcja/templates/registration/login.html b/src/redakcja/templates/registration/login.html index adbef3cb..6ba9f759 100644 --- a/src/redakcja/templates/registration/login.html +++ b/src/redakcja/templates/registration/login.html @@ -6,7 +6,7 @@ {% block content %}
-
+ {% csrf_token %} {{ form.as_p }}

diff --git a/src/redakcja/urls.py b/src/redakcja/urls.py index 1fe11d88..54ed920d 100644 --- a/src/redakcja/urls.py +++ b/src/redakcja/urls.py @@ -6,17 +6,17 @@ from django.conf import settings from django.conf.urls.static import static from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.views.generic import RedirectView -import django_cas.views +import django_cas_ng.views admin.autodiscover() urlpatterns = [ # Auth - url(r'^accounts/login/$', django_cas.views.login, name='login'), - url(r'^accounts/logout/$', django_cas.views.logout, name='logout'), - url(r'^admin/login/$', django_cas.views.login, name='login'), - url(r'^admin/logout/$', django_cas.views.logout, name='logout'), + url(r'^accounts/login/$', django_cas_ng.views.LoginView.as_view(), name='cas_ng_login'), + url(r'^accounts/logout/$', django_cas_ng.views.LogoutView.as_view(), name='logout'), + #url(r'^admin/login/$', django_cas_ng.views.login, name='login'), + #url(r'^admin/logout/$', django_cas_ng.views.logout, name='logout'), # Admin panel url(r'^admin/doc/', include('django.contrib.admindocs.urls')),