.ONESHELL:
test:
cd src
- coverage run --branch --source='.' ./manage.py test; true
+ python -Wall -m coverage run --branch --source='.' ./manage.py test; true
coverage html -d ../htmlcov.new
rm -rf ../htmlcov
mv ../htmlcov.new ../htmlcov
jsmin==3.0.1
fnp-django-pagination==2.2.5
-django-modeltranslation==0.18.2
+django-modeltranslation==0.18.4
django-allauth==0.51
-django-extensions==3.1.5
+django-extensions==3.2.1
djangorestframework==3.13.1
djangorestframework-xml==2.0.0
django-admin-ordering==0.14.0
-django-machina==1.1.6
django-countries==7.3.2
# A version compatible with Django 2.2+, with long help text and editable max_length.
django-honeypot==1.0.2
-python-memcached==1.59
python-fb==0.2
Feedparser==6.0.10
celery[redis]==5.2.7
# OAI-PMH
-pyoai==2.5.0
+#pyoai==2.5.1
+-e git+https://github.com/infrae/pyoai@5ff2f15e869869e70d8139e4c37b7832854d7049#egg=pyoai
scorched==0.13
httplib2
class PictureTests(ApiTest):
def test_publish(self):
slug = "kandinsky-composition-viii"
- xml = SimpleUploadedFile(
- 'composition8.xml',
- open(path.join(
+ with open(path.join(
picture.tests.__path__[0], "files", slug + ".xml"
- ), 'rb').read())
- img = SimpleUploadedFile(
- 'kompozycja-8.png',
- open(path.join(
+ ), 'rb') as f:
+ xml = SimpleUploadedFile(
+ 'composition8.xml',
+ f.read())
+ with open(path.join(
picture.tests.__path__[0], "files", slug + ".png"
- ), 'rb').read())
+ ), 'rb') as f:
+ img = SimpleUploadedFile(
+ 'kompozycja-8.png',
+ f.read())
import_form = PictureImportForm({}, {
'picture_xml_file': xml,
out = self.transform(
book.wldocument2() if self.librarian2_api else book.wldocument(),
)
- fieldfile.save(None, File(open(out.get_filename(), 'rb')), save=False)
+ with open(out.get_filename(), 'rb') as f:
+ fieldfile.save(None, File(f), save=False)
self.set_file_permissions(fieldfile)
if book.pk is not None:
book.save(update_fields=[self.attname])
morefloats=settings.LIBRARIAN_PDF_MOREFLOATS,
base_url=absolute_url(gallery_url(wldoc.book_info.url.slug)),
**kwargs)
- DefaultStorage().save(file_name, File(open(pdf.get_filename(), 'rb')))
+ with open(pdf.get_filename(), 'rb') as f:
+ DefaultStorage().save(file_name, File(f))
finally:
if waiter_id is not None:
WaitedFile.objects.filter(pk=waiter_id).delete()
from django.core.files.storage import DefaultStorage
from django.core.files.uploadedfile import UploadedFile
from django.http import HttpResponse
-from django.utils.encoding import force_text
+from django.utils.encoding import force_str
from reporting.utils import read_chunks
This is just a version of django.utils.text.truncate_html_words with no space before the end_text.
"""
- s = force_text(s)
+ s = force_str(s)
length = int(num)
if length <= 0:
return ''
from .apps import *
from .basic import *
from .auth import *
-from .cache import *
from .celery import *
from .contrib import *
from .custom import *
'allauth.socialaccount.providers.facebook',
'allauth.socialaccount.providers.google',
# 'allauth.socialaccount.providers.twitter',
-
- # Machina dependencies:
- 'mptt',
- 'haystack',
- 'widget_tweaks',
-
- # Machina apps:
- 'machina',
- 'machina.apps.forum',
- 'machina.apps.forum_conversation',
- 'machina.apps.forum_conversation.forum_attachments',
- 'machina.apps.forum_conversation.forum_polls',
- 'machina.apps.forum_feeds',
- 'machina.apps.forum_moderation',
- 'machina.apps.forum_search',
- 'machina.apps.forum_tracking',
- 'machina.apps.forum_member',
- 'machina.apps.forum_permission',
]
INSTALLED_APPS = INSTALLED_APPS_OUR + INSTALLED_APPS_CONTRIB
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from os import path
-from machina import MACHINA_MAIN_TEMPLATE_DIR
from .paths import PROJECT_DIR
DEBUG = True
CONTACT_EMAIL = 'fundacja@nowoczesnapolska.org.pl'
+CACHE_MIDDLEWARE_SECONDS = 24 * 60 * 60
+
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # 'postgresql_psycopg2'
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
- 'DIRS': (
- path.join(PROJECT_DIR, 'templates'), # Duplicate, because of Machina<1 weird configuration.
- MACHINA_MAIN_TEMPLATE_DIR,
- ),
'OPTIONS': {
'context_processors': (
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.request',
'wolnelektury.context_processors.extra_settings',
'search.context_processors.search_form',
- 'machina.core.context_processors.metadata',
),
},
}]
'django.contrib.messages.middleware.MessageMiddleware',
'fnpdjango.middleware.SetRemoteAddrFromXRealIP',
'django.middleware.cache.FetchFromCacheMiddleware',
- 'machina.apps.forum_permission.middleware.ForumPermissionMiddleware',
'experiments.middleware.experiments_middleware',
]
+++ /dev/null
-# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
-# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
-#
-CACHES = {
- 'default': {
- 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
- 'LOCATION': [
- '127.0.0.1:11211',
- ]
- },
- 'template_fragments': {
- 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
- 'TIMEOUT': 86400,
- 'LOCATION': [
- '127.0.0.1:11211',
- ],
- },
- 'machina_attachments': {
- 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
- 'LOCATION': '/tmp',
- },
-}
-
-CACHE_MIDDLEWARE_SECONDS = 24 * 60 * 60
'pipeline.finders.CachedFileFinder',
'pipeline.finders.PipelineFinder',
]
-
-
-from machina import MACHINA_MAIN_STATIC_DIR
-STATICFILES_DIRS = (
- MACHINA_MAIN_STATIC_DIR,
-)
{% csrf_token %}
<input type="hidden" name="language" value="{{ lang.0 }}"/>
<button type="submit" lang="{{ lang.0 }}"
- class="{% ifequal lang.0 LANGUAGE_CODE %}active{% endifequal %}">{{ lang.1 }}</button>
+ class="{% if lang.0 == LANGUAGE_CODE %}active{% endif %}">{{ lang.1 }}</button>
</form>
{% endfor %}
</div>
{% csrf_token %}
<input type="hidden" name="language" value="{{ lang.0 }}"/>
<button type="submit" lang="{{ lang.0 }}" tabindex="121"
- class="{% ifequal lang.0 LANGUAGE_CODE %}active{% endifequal %}">{{ lang.1 }}</button>
+ class="{% if lang.0 == LANGUAGE_CODE %}active{% endif %}">{{ lang.1 }}</button>
</form>
{% endfor %}
</div>
+++ /dev/null
-{% extends 'board_base.html' %}
-{% load i18n %}
-{% load static %}
-{% load stylesheet from pipeline %}
-
-{% block css %}
- {{ block.super }}
- {% stylesheet 'forum' %}
-{% endblock css %}
-
-
-
-{% block header %}
-<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
- <a class="navbar-brand" href="{% url 'forum:index' %}">
- {% block brand %}
- <img src="{% static 'img/logo-neon-transp.png' %}" alt="Wolne Lektury">
- {% endblock %}
- </a>
-
- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
- <span class="navbar-toggler-icon"></span>
- </button>
- <div class="collapse navbar-collapse" id="navbarSupportedContent">
- {% block header_collapse %}
- <form class="form-inline my-2 ml-3 my-lg-0" role="search" action="{% url 'forum_search:search' %}">
- <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search" name="q">
- <button class="btn btn-outline-light my-2 my-sm-0" type="submit">{% trans "Search" %}</button>
- </form>
- <div class="navbar-nav mr-auto">
- <a class="nav-item nav-link" href="{% url 'forum_search:search' %}">{% trans "Advanced search" %}</a>
- </div>
- <div class="navbar-nav mr-auto">
- {% if request.user.is_authenticated %}
- <div class="nav-item">
- <a class="nav-link disabled">
- {{ request.user.username }}
- </a>
- </div>
- {% if request.user.is_staff %}
- <div class="nav-item">
- <a class="nav-link" href="{% url 'admin:index' %}">
- {% trans "Administration" %}
- </a>
- </div>
- {% endif %}
- <div class="nav-item">
- <a class="nav-link" href="{% url 'logout' %}">{% trans "Logout" %}</a>
- </div>
- {% endif %}
- </div>
- {% endblock header_collapse %}
- </div>
-</nav>
-{% endblock header %}
{% endif %}
{% for page in pages %}
{% if page %}
- {% ifequal page page_obj.number %}
+ {% if page == page_obj.number %}
<span class="current page"> {{ page }} </span>
{% else %}
<a href="?page={{ page }}{{ getvars }}" class="page"> {{ page }} </a>
- {% endifequal %}
+ {% endif %}
{% else %}
…
{% endif %}
path('szukaj/', include('search.urls')),
path('i18n/', include('django.conf.urls.i18n')),
- path('forum/', include('machina.urls')),
]
urlpatterns += [