diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst
index 737de3371..64d8f146b 100644
--- a/CONTRIBUTORS.rst
+++ b/CONTRIBUTORS.rst
@@ -1,4 +1,3 @@
-
Original Authors
================
@@ -13,3 +12,5 @@ Contributors
* Balazs Endresz balazs.endresz@torchbox.com
* Neal Todd neal.todd@torchbox.com
* Paul Hallett (twilio) hello@phalt.co
+* Tom Dyson
+* Serafeim Papastefanos
diff --git a/setup.py b/setup.py
index 91b70dbcd..e5cd3d5f5 100644
--- a/setup.py
+++ b/setup.py
@@ -42,7 +42,6 @@ setup(
"Django>=1.6.1",
"South>=0.8.4",
"django-compressor>=1.3",
- "django-celery>=3.1.1",
"django-modelcluster>=0.1",
"elasticutils>=0.8.2",
"pyelasticsearch>=0.6.1",
diff --git a/wagtail/wagtailadmin/static/wagtailadmin/js/hallo-plugins/hallo-wagtaillink.coffee b/wagtail/wagtailadmin/static/wagtailadmin/js/hallo-plugins/hallo-wagtaillink.coffee
index 7f5705065..fbc405f8a 100644
--- a/wagtail/wagtailadmin/static/wagtailadmin/js/hallo-plugins/hallo-wagtaillink.coffee
+++ b/wagtail/wagtailadmin/static/wagtailadmin/js/hallo-plugins/hallo-wagtaillink.coffee
@@ -41,9 +41,9 @@
if lastSelection.collapsed
# TODO: don't hard-code this, as it may be changed in urls.py
- url = '/admin/choose-page/?allow_external_link=true&allow_email_link=true&prompt_for_link_text=true'
+ url = window.chooserUrls.pageChooser + '?allow_external_link=true&allow_email_link=true&prompt_for_link_text=true'
else
- url = '/admin/choose-page/?allow_external_link=true&allow_email_link=true'
+ url = window.chooserUrls.pageChooser + '?allow_external_link=true&allow_email_link=true'
ModalWorkflow
url: url
diff --git a/wagtail/wagtailadmin/static/wagtailadmin/js/page-chooser.js b/wagtail/wagtailadmin/static/wagtailadmin/js/page-chooser.js
index 337fc30be..b4f95c133 100644
--- a/wagtail/wagtailadmin/static/wagtailadmin/js/page-chooser.js
+++ b/wagtail/wagtailadmin/static/wagtailadmin/js/page-chooser.js
@@ -4,8 +4,7 @@ function createPageChooser(id, pageType, openAtParentId) {
var input = $('#' + id);
$('.action-choose', chooserElement).click(function() {
- var initialUrl = '/admin/choose-page/';
- /* TODO: don't hard-code this URL, as it may be changed in urls.py */
+ var initialUrl = window.chooserUrls.pageChooser;
if (openAtParentId) {
initialUrl += openAtParentId + '/';
}
diff --git a/wagtail/wagtailadmin/static/wagtailadmin/js/page-editor.js b/wagtail/wagtailadmin/static/wagtailadmin/js/page-editor.js
index 3dbc31803..efceb8577 100644
--- a/wagtail/wagtailadmin/static/wagtailadmin/js/page-editor.js
+++ b/wagtail/wagtailadmin/static/wagtailadmin/js/page-editor.js
@@ -257,10 +257,12 @@ $(function() {
/* Set up behaviour of preview button */
$('#action-preview').click(function() {
var previewWindow = window.open($(this).data('placeholder'), $(this).data('windowname'));
- $.post(
- $(this).data('action'),
- $('#page-edit-form').serialize(),
- function(data, textStatus, request) {
+
+ $.ajax({
+ type: "POST",
+ url: $(this).data('action'),
+ data: $('#page-edit-form').serialize(),
+ success: function(data, textStatus, request) {
if (request.getResponseHeader('X-Wagtail-Preview') == 'ok') {
previewWindow.document.open();
previewWindow.document.write(data);
@@ -271,7 +273,17 @@ $(function() {
document.write(data);
document.close();
}
+ },
+ error: function(xhr, textStatus, errorThrown) {
+ /* If an error occurs, display it in the preview window so that
+ we aren't just showing the spinner forever. We preserve the original
+ error output rather than giving a 'friendly' error message so that
+ developers can debug template errors. (On a production site, we'd
+ typically be serving a friendly custom 500 page anyhow.) */
+ previewWindow.document.open();
+ previewWindow.document.write(xhr.responseText);
+ previewWindow.document.close();
}
- );
+ });
});
});
diff --git a/wagtail/wagtailadmin/taggable.py b/wagtail/wagtailadmin/taggable.py
index 3e67821be..39213e956 100644
--- a/wagtail/wagtailadmin/taggable.py
+++ b/wagtail/wagtailadmin/taggable.py
@@ -4,7 +4,7 @@ from django.contrib.contenttypes.models import ContentType
from django.db.models import Count
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
-from wagtail.wagtailsearch import Indexed, Search
+from wagtail.wagtailsearch import Indexed, get_search_backend
class TagSearchable(Indexed):
@@ -33,10 +33,11 @@ class TagSearchable(Indexed):
@classmethod
def search(cls, q, results_per_page=None, page=1, prefetch_tags=False, filters={}):
# Run search query
+ search_backend = get_search_backend()
if prefetch_tags:
- results = Search().search(q, cls, prefetch_related=['tagged_items__tag'], filters=filters)
+ results = search_backend.search(q, cls, prefetch_related=['tagged_items__tag'], filters=filters)
else:
- results = Search().search(q, cls, filters=filters)
+ results = search_backend.search(q, cls, filters=filters)
# If results_per_page is set, return a paginator
if results_per_page is not None:
diff --git a/wagtail/wagtailadmin/tasks.py b/wagtail/wagtailadmin/tasks.py
index 701bd328b..503ff1eed 100644
--- a/wagtail/wagtailadmin/tasks.py
+++ b/wagtail/wagtailadmin/tasks.py
@@ -1,5 +1,3 @@
-from celery.decorators import task
-
from django.template.loader import render_to_string
from django.core.mail import send_mail
from django.conf import settings
@@ -8,6 +6,27 @@ from django.db.models import Q
from wagtail.wagtailcore.models import PageRevision, GroupPagePermission
+# The following will check to see if we can import task from celery -
+# if not then we definitely haven't installed it
+try:
+ from celery.decorators import task
+ NO_CELERY = False
+except:
+ NO_CELERY = True
+
+
+# However, we could have installed celery for other projects. So we will also
+# check if we have defined the BROKER_URL setting. If not then definitely we
+# haven't configured it.
+if NO_CELERY or not hasattr(settings, 'BROKER_URL'):
+ # So if we enter here we will define a different "task" decorator that
+ # just returns the original function and sets its delay attribute to
+ # point to the original function: This way, the send_notification
+ # function will be actually called instead of the the
+ # send_notification.delay()
+ def task(f):
+ f.delay=f
+ return f
def users_with_page_permission(page, permission_type, include_superusers=True):
# Get user model
@@ -25,11 +44,11 @@ def users_with_page_permission(page, permission_type, include_superusers=True):
return User.objects.filter(q).distinct()
-@task()
+@task
def send_notification(page_revision_id, notification, excluded_user_id):
# Get revision
revision = PageRevision.objects.get(id=page_revision_id)
-
+
# Get list of recipients
if notification == 'submitted':
# Get list of publishers
diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/pages/_editor_js.html b/wagtail/wagtailadmin/templates/wagtailadmin/pages/_editor_js.html
index 1a61a5a2e..a88f6143d 100644
--- a/wagtail/wagtailadmin/templates/wagtailadmin/pages/_editor_js.html
+++ b/wagtail/wagtailadmin/templates/wagtailadmin/pages/_editor_js.html
@@ -31,6 +31,16 @@
{% endcompress %}
+
+