-# -*- coding: utf-8 -*-
-
from hashlib import md5
from django.conf import settings
def subscriber_hash(email):
- return md5(email).hexdigest()
+ return md5(email.encode('utf-8')).hexdigest()
def remove_from_groups(email, client):
-# -*- coding: utf-8 -*-
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
+from functools import reduce
import pickle
from pickle import PickleError
from datetime import datetime
obj = cls.objects.get(content_type=object_type, object_id=sth.id)
if not obj.pickle:
raise cls.DoesNotExist
- f = open(obj.pickle.path)
+ f = open(obj.pickle.path, 'rb')
keys, conts = pickle.load(f)
f.close()
if set(keys) != should_keys:
-# -*- coding: utf-8 -*-
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
+from functools import reduce
import os.path
from urllib.parse import urljoin
url = self.analysis_url
kwargs = dict(
method="POST",
- body=qs,
+ data=qs,
headers={"Content-Type": "application/x-www-form-urlencoded"},
)
else:
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
-from functools import total_ordering
+from functools import reduce, total_ordering
from itertools import chain
import logging
import operator
break
def theme_by_name(n):
- th = filter(lambda t: t.name == n, themes)
+ th = list(filter(lambda t: t.name == n, themes))
if th:
return th[0]
else:
return None
- themes_hit = filter(lambda a: a is not None, map(theme_by_name, themes_hit))
+ themes_hit = list(filter(lambda a: a is not None, map(theme_by_name, themes_hit)))
m = {'score': f[self.SCORE],
'fragment': frag,
-# -*- coding: utf-8 -*-
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from datetime import datetime
import logging
from functools import update_wrapper
-import urllib
+from urllib.parse import urlencode
from random import random
from inspect import isclass
def piwik_url(request):
- return urllib.urlencode(dict(
+ return urlencode(dict(
idsite=getattr(settings, 'PIWIK_SITE_ID', '0'),
rec=1,
url=force_bytes('http://%s%s' % (request.META['HTTP_HOST'], request.path)),
<a href="/">
<img src="{% static 'img/logo-neon.png' %}">
</a>
- <form action="{% url 'search' %}" method="get" accept-charset="utf-8" id="wl-form">
+ <form action="{% url 'wlsearch' %}" method="get" accept-charset="utf-8" id="wl-form">
<div id="wl-search">
<input data-source="{% url 'search_hint' %}?max=3" id="id_qq" name="q" title="tytuł, autor, motyw/temat, epoka, rodzaj, gatunek, cytat" placeholder="tytuł, autor, motyw/temat, epoka, rodzaj, gatunek, cytat" type="text" value=""/>
</div>