<div id="last-edited-list">
<h2>{% trans "Your last edited documents" %}</h2>
<ol>
- {% for slugs, item in last_books %}
- <li><a href="{% url 'wiki_editor' slugs.0 slugs.1 %}"
+ {% for edit_url, item in last_books %}
+ <li><a
+ {% if edit_url|length == 2 %}
+ {# Temporary support for old-style last_books. #}
+ href="{% url 'wiki_editor' edit_url.0 edit_url.1 %}"
+ {% else %}
+ href="{{ edit_url }}"
+ {% endif %}
target="_blank">{{ item.title }}</a><br/><span class="date">({{ item.time|date:"H:i:s, d/m/Y" }})</span></li>
{% endfor %}
</ol>
@active_tab('my')
@never_cache
def my(request):
+ last_books = sorted(request.session.get("wiki_last_books", {}).items(),
+ key=lambda x: x[1]['time'], reverse=True)
+ for k, v in last_books:
+ v['time'] = datetime.fromtimestamp(v['time'])
return render(request, 'catalogue/my_page.html', {
- 'last_books': sorted(request.session.get("wiki_last_books", {}).items(),
- key=lambda x: x[1]['time'], reverse=True),
-
+ 'last_books': last_books,
"logout_to": '/',
})
from datetime import datetime
import os
import logging
+from time import mktime
import urllib
from django.conf import settings
access_time = datetime.now()
last_books = request.session.get("wiki_last_books", {})
- last_books[slug, chunk.slug] = {
- 'time': access_time,
+ last_books[reverse(editor, args=[chunk.book.slug, chunk.slug])] = {
+ 'time': mktime(access_time.timetuple()),
'title': chunk.pretty_name(),
}
access_time = datetime.now()
last_books = request.session.get("wiki_last_books", {})
last_books[slug, chunk.slug] = {
- 'time': access_time,
+ 'time': mktime(access_time.timetuple()),
'title': chunk.book.title,
}
+++ /dev/null
-<VirtualHost *:80>
- ServerName $DOMAIN
- ServerAdmin $ADMIN_EMAIL
-
- WSGIDaemonProcess $PROJECT_NAME user=$WSGI_USER group=$WSGI_USER processes=$WSGI_PROCESSES threads=$WSGI_THREADS display-name=%{GROUP}
- WSGIProcessGroup $PROJECT_NAME
-
- WSGIScriptAlias / $WSGI_FILE
- <Directory $WSGI_DIR>
- Order allow,deny
- allow from all
- </Directory>
-
- Alias /media $MEDIA_DIR
- <Directory $MEDIA_DIR>
- Order allow,deny
- Allow from all
- </Directory>
-
- LogLevel warn
- ErrorLog /var/log/apache2/$PROJECT_NAME/error.log
- CustomLog /var/log/apache2/$PROJECT_NAME/access.log combined
-</VirtualHost>
+++ /dev/null
-#!$PYTHON_BIN
-import site
-site.addsitedir('$PYTHON_SITE')
-
-import os
-from os.path import abspath, dirname, join
-import sys
-
-# Redirect sys.stdout to sys.stderr for bad libraries like geopy that use
-# print statements for optional import exceptions.
-sys.stdout = sys.stderr
-
-# Add apps and lib directories to PYTHONPATH
-sys.path = [
- '$APP_DIR',
- '$APP_DIR/lib',
- '$APP_DIR/lib/librarian',
- '$APP_DIR/apps',
-] + sys.path
-
-# Run Django
-os.environ["CELERY_LOADER"] = "django"
-os.environ['DJANGO_SETTINGS_MODULE'] = '$PROJECT_NAME.settings'
-
-from django.core.handlers.wsgi import WSGIHandler
-application = WSGIHandler()
+from __future__ import absolute_import
+
+# This will make sure the app is always imported when
+# Django starts so that shared_task will use this app.
+from .celery import app as celery_app
--- /dev/null
+from __future__ import absolute_import
+
+import os
+import sys
+
+ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+sys.path = [
+ os.path.join(ROOT, 'apps'),
+ os.path.join(ROOT, 'lib'),
+ os.path.join(ROOT, 'lib/librarian'),
+] + sys.path
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'redakcja.localsettings')
+
+from celery import Celery
+from django.conf import settings
+
+app = Celery('redakcja')
+
+# Using a string here means the worker will not have to
+# pickle the object when using Windows.
+app.config_from_object('django.conf:settings')
+app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
'sorl.thumbnail',
'pagination',
'django_gravatar',
- 'djcelery',
- 'djkombu',
'fileupload',
+ 'kombu.transport.django',
'pipeline',
'fnpdjango',
IMAGE_DIR = 'images/'
-import djcelery
-djcelery.setup_loader()
-
-BROKER_BACKEND = "djkombu.transport.DatabaseTransport"
-BROKER_HOST = "localhost"
-BROKER_PORT = 5672
-BROKER_USER = "guest"
-BROKER_PASSWORD = "guest"
-BROKER_VHOST = "/"
+BROKER_URL = 'django://'
+CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
+CELERY_SEND_TASK_ERROR_EMAILS = True
+CELERY_ACCEPT_CONTENT = ['pickle'] # Remove when all tasks jsonable.
SHOW_APP_VERSION = False
--i http://pypi.nowoczesnapolska.org.pl/simple
+-i http://py.mdrn.pl:8443/simple
## Python libraries
lxml>=2.2.2
-Mercurial>=2.6,<2.7
+Mercurial>=3.3,<3.4
PyYAML>=3.0
Pillow
oauth2
django-maintenancemode>=0.9
django-pagination
django-gravatar2
-django-celery
-django-kombu
+
+celery>=3.1.12,<3.2
+kombu>=3.0,<3.1
# migrations
-south>=0.6
+South>=1.0.2