================
* django-chunks
- in `apps/chunks`
+ in `src/chunks`
based on [django-chunks](http://code.google.com/p/django-chunks/)
by Clint Ecker <clintecker@gmail.com>,
[New BSD License](http://www.opensource.org/licenses/bsd-license.php)
* [django-newtagging](http://www.bitbucket.org/zuber/django-newtagging/)
- in `apps/newtagging`
+ in `src/newtagging`
by Marek Stępniowski <marek@stepniowski.com>,
[MIT License](http://www.opensource.org/licenses/mit-license.php),
based on [django-tagging](http://code.google.com/p/django-tagging/), also under [MIT License](http://www.opensource.org/licenses/mit-license.php)
* [jPlayer](http://jplayer.org/)
- in `apps/catalogue/static/jplayer`
+ in `src/catalogue/static/jplayer`
by Happyworm,
[MIT License](http://opensource.org/licenses/MIT)
* [Switch template tag](http://djangosnippets.org/snippets/967/)
- in `apps/wolnelektury_core/templatetags/switch_tag.py`
+ in `src/wolnelektury/templatetags/switch_tag.py`
by adurdin
-* [Cropping engine for sorl-thumbnail](http://timmyomahony.com/blog/custom-cropping-engine-sorl-thumbnail/)
- in `apps/picture/engine.py`
- by Timmy O'Mahony
-* Javascript in `apps/wolnelektury_core/static/js/contrib`
+* Javascript in `src/wolnelektury/static/js/contrib`
with relevant attribution and licensing
librarian==1.7.4
# celery tasks
-celery>=3.1.12,<3.2
-kombu>=3.0.23,<3.1
+celery[redis]==4.3.0
# spell checking
pyenchant
"html": "Fragment",
"title": "Parent, Child"
},
- "txt": "http://testserver/katalog/pobierz/grandchild.txt",
+ "txt": "http://testserver/media/txt/grandchild.txt",
"children": [],
- "xml": "http://testserver/katalog/pobierz/grandchild.xml",
+ "xml": "http://testserver/media/xml/grandchild.xml",
"genres": [
{
"url": "http://testserver/katalog/gatunek/sonet/",
],
"title": "Grandchild",
"media": [],
- "html": "http://testserver/katalog/pobierz/grandchild.html",
- "preview": true,
- "fb2": "http://testserver/katalog/pobierz/grandchild.fb2",
+ "html": "http://testserver/media/html/grandchild.html",
+ "preview": false,
+ "fb2": "http://testserver/media/fb2/grandchild.fb2",
"kinds": [],
"parent": {
"kind": "",
"simple_cover": "",
"authors": [],
"audio_length": "",
- "epub": "http://testserver/katalog/pobierz/grandchild.epub",
+ "epub": "http://testserver/media/epub/grandchild.epub",
"cover_thumb": "",
- "mobi": "http://testserver/katalog/pobierz/grandchild.mobi",
+ "mobi": "http://testserver/media/mobi/grandchild.mobi",
"url": "http://testserver/katalog/lektura/grandchild/",
"cover": "",
- "pdf": "http://testserver/katalog/pobierz/grandchild.pdf",
+ "pdf": "http://testserver/media/pdf/grandchild.pdf",
"simple_thumb": ""
}
"epub": ""
},
{
- "fb2": "http://testserver/katalog/pobierz/grandchild.fb2",
- "mobi": "http://testserver/katalog/pobierz/grandchild.mobi",
+ "fb2": "http://testserver/media/fb2/grandchild.fb2",
+ "mobi": "http://testserver/media/mobi/grandchild.mobi",
"title": "Grandchild",
"author": "",
"cover": "",
"href": "http://testserver/api/books/grandchild/",
- "pdf": "http://testserver/katalog/pobierz/grandchild.pdf",
- "txt": "http://testserver/katalog/pobierz/grandchild.txt",
+ "pdf": "http://testserver/media/pdf/grandchild.pdf",
+ "txt": "http://testserver/media/txt/grandchild.txt",
"slug": "grandchild",
- "epub": "http://testserver/katalog/pobierz/grandchild.epub"
+ "epub": "http://testserver/media/epub/grandchild.epub"
},
{
"fb2": "",
'/api/filter-books/?lektura=true',
[])
- self.assert_slugs(
- '/api/filter-books/?preview=true',
- ['grandchild'])
+ Book.objects.filter(slug='grandchild').update(preview=True)
+ # Skipping: we don't allow previewed books in filtered list.
+ #self.assert_slugs(
+ # '/api/filter-books/?preview=true',
+ # ['grandchild'])
self.assert_slugs(
'/api/filter-books/?preview=false',
['child', 'parent'])
+ Book.objects.filter(slug='grandchild').update(preview=False)
self.assert_slugs(
'/api/filter-books/?audiobook=true',
self.assertEqual(self.load_json('/api/blog'), [])
-class PreviewTests(ApiTest):
- def unauth(self):
- self.assert_json_response('/api/preview/', 'preview.json')
-
-
class OAuth1Tests(ApiTest):
@classmethod
def setUpClass(cls):
['parent'])
def test_subscription(self):
+ Book.objects.filter(slug='grandchild').update(preview=True)
+
self.assert_slugs('/api/preview/', ['grandchild'])
self.assertEqual(
self.signed_json('/api/username/'),
self.signed('/api/epub/grandchild/').content,
b"<epub>")
+ Book.objects.filter(slug='grandchild').update(preview=False)
+
def test_publish(self):
response = self.signed('/api/books/',
method='POST',
fields:
slug: grandchild
title: Grandchild
- preview: true
sort_key: grandchild
parent: 2
- xml_file: secret/grandchild.xml
- txt_file: secret/grandchild.txt
- html_file: secret/grandchild.html
- epub_file: secret/grandchild.epub
- mobi_file: secret/grandchild.mobi
- pdf_file: secret/grandchild.pdf
- fb2_file: secret/grandchild.fb2
+ xml_file: xml/grandchild.xml
+ txt_file: txt/grandchild.txt
+ html_file: html/grandchild.html
+ epub_file: epub/grandchild.epub
+ mobi_file: mobi/grandchild.mobi
+ pdf_file: pdf/grandchild.pdf
+ fb2_file: fb2/grandchild.fb2
created_at: "1970-01-01 0:0Z"
changed_at: "1970-01-01 0:0Z"
tag.save()
book.tags = set(meta_tags + book_shelves)
+ book.save() # update sort_key_author
cover_changed = old_cover != book.cover_info()
obsolete_children = set(b for b in book.children.all()
for child in notify_cover_changed:
child.parent_cover_changed()
- book.save() # update sort_key_author
book.update_popularity()
cls.published.send(sender=cls, instance=book)
return book
MEDIA_ROOT=tempfile.mkdtemp(prefix='djangotest_'),
CATALOGUE_DONT_BUILD={'pdf', 'mobi', 'epub', 'txt', 'fb2', 'cover'},
NO_SEARCH_INDEX=True,
- CELERY_ALWAYS_EAGER=True,
+ CELERY_TASK_ALWAYS_EAGER=True,
CACHES={
'default': {'BACKEND': 'django.core.cache.backends.dummy.DummyCache'},
},
def test_empty_book(self):
book_text = "<utwor />"
book = models.Book.from_text_and_meta(ContentFile(book_text), self.book_info)
+ book.refresh_from_db()
self.assertEqual(book.title, "Default Book")
self.assertEqual(book.slug, "default-book")
"""
book = models.Book.from_text_and_meta(ContentFile(book_text), self.book_info)
+ book.refresh_from_db()
self.assertTrue(book.has_html_file())
def test_book_with_fragment(self):
"""
book = models.Book.from_text_and_meta(ContentFile(book_text), self.book_info)
+ book.refresh_from_db()
self.assertTrue(book.has_html_file())
self.assertEqual(book.fragments.count(), 1)
app = Celery('wolnelektury')
-app.config_from_object('django.conf:settings')
+app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
'pipeline',
'piwik',
'sorl.thumbnail',
- 'kombu.transport.django',
'honeypot',
'fnpdjango',
'getpaid',
-# -*- 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.
#
-BROKER_URL = 'django://'
+CELERY_BROKER_URL = 'redis://'
CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
CELERY_SEND_TASK_ERROR_EMAILS = True
CELERY_ACCEPT_CONTENT = ['pickle']
+CELERY_TASK_SERIALIZER = 'pickle'