From aca00353865d7f929dbb42f1a015e7338c4b8b9e Mon Sep 17 00:00:00 2001 From: Stefan Wehrmeyer Date: Wed, 27 Feb 2013 00:25:08 +0100 Subject: [PATCH] Upgrade dependencies to latest versions --- froide/custom_settings.py.example | 4 ++ froide/foirequest/search_indexes.py | 6 +-- froide/foirequest/signals.py | 11 +++-- froide/publicbody/search_indexes.py | 6 +-- froide/settings.py | 2 + requirements-test.txt | 9 ++-- requirements.txt | 66 ++++++----------------------- 7 files changed, 34 insertions(+), 70 deletions(-) diff --git a/froide/custom_settings.py.example b/froide/custom_settings.py.example index 69428fe94..b0daad862 100644 --- a/froide/custom_settings.py.example +++ b/froide/custom_settings.py.example @@ -289,6 +289,10 @@ from .settings import * # noqa # } # } +# HAYSTACK_SIGNAL_PROCESSOR = 'celery_haystack.signals.CelerySignalProcessor' + +# CELERY_HAYSTACK_MODELS = ('foirequest.FoiRequest', 'publicbody.PublicBody') + ########## Froide settings ######## diff --git a/froide/foirequest/search_indexes.py b/froide/foirequest/search_indexes.py index 553710b42..7c612bccc 100644 --- a/froide/foirequest/search_indexes.py +++ b/froide/foirequest/search_indexes.py @@ -1,11 +1,9 @@ from haystack import indexes -from celery_haystack.indexes import CelerySearchIndex - from .models import FoiRequest -class FoiRequestIndex(CelerySearchIndex, indexes.Indexable): +class FoiRequestIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.EdgeNgramField(document=True, use_template=True) title = indexes.CharField(model_attr='title') description = indexes.CharField(model_attr='description') @@ -20,7 +18,7 @@ class FoiRequestIndex(CelerySearchIndex, indexes.Indexable): def get_model(self): return FoiRequest - def index_queryset(self): + def index_queryset(self, **kwargs): """Used when the entire index for model is updated.""" return self.get_model().published.get_for_search_index() diff --git a/froide/foirequest/signals.py b/froide/foirequest/signals.py index cbafc2f09..edb9f73d5 100644 --- a/froide/foirequest/signals.py +++ b/froide/foirequest/signals.py @@ -5,17 +5,16 @@ from django.conf import settings from django.utils.translation import ugettext_lazy as _ -from haystack import connections +from haystack.utils import get_identifier + +from celery_haystack.utils import get_update_task from .models import FoiRequest, FoiMessage, FoiAttachment, FoiEvent def trigger_index_update(klass, instance_pk): - fake_instance = klass() - fake_instance.pk = instance_pk - uni = connections['default'].get_unified_index() - index = uni.get_index(klass) - index.enqueue_save(fake_instance) + task = get_update_task() + task.delay('update', get_identifier(klass(id=instance_pk))) @receiver(FoiRequest.became_overdue, diff --git a/froide/publicbody/search_indexes.py b/froide/publicbody/search_indexes.py index 78b18946f..7e5ae17b9 100644 --- a/froide/publicbody/search_indexes.py +++ b/froide/publicbody/search_indexes.py @@ -2,14 +2,12 @@ from haystack import indexes -from celery_haystack.indexes import CelerySearchIndex - from .models import PublicBody PUBLIC_BODY_BOOSTS = getattr(settings, "FROIDE_PUBLIC_BODY_BOOSTS", {}) -class PublicBodyIndex(CelerySearchIndex, indexes.Indexable): +class PublicBodyIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.EdgeNgramField(document=True, use_template=True) name = indexes.CharField(model_attr='name', boost=1.5) jurisdiction = indexes.CharField(model_attr='jurisdiction__name', default='') @@ -21,7 +19,7 @@ class PublicBodyIndex(CelerySearchIndex, indexes.Indexable): def get_model(self): return PublicBody - def index_queryset(self): + def index_queryset(self, **kwargs): """Used when the entire index for model is updated.""" return self.get_model().objects.get_for_search_index() diff --git a/froide/settings.py b/froide/settings.py index 3cdce4907..a87ef385e 100644 --- a/froide/settings.py +++ b/froide/settings.py @@ -365,7 +365,9 @@ 'ENGINE': 'haystack.backends.simple_backend.SimpleEngine', } } +HAYSTACK_SIGNAL_PROCESSOR = 'celery_haystack.signals.CelerySignalProcessor' +CELERY_HAYSTACK_MODELS = ('foirequest.FoiRequest', 'publicbody.PublicBody') ########## Froide settings ######## diff --git a/requirements-test.txt b/requirements-test.txt index 7ec26949c..f08e1fda6 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,4 +1,7 @@ -r requirements.txt -django-discover-runner==0.2.2 -pyelasticsearch==0.2 -selenium==2.29.0 \ No newline at end of file +django-discover-runner==0.3 +pyelasticsearch==0.3 +selenium==2.30.0 +pep8==1.4.4 +factory-boy==1.1.4 +coverage==3.6 diff --git a/requirements.txt b/requirements.txt index 9be49c839..3548588a7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,67 +1,27 @@ -BeautifulSoup==3.2.1 Django==1.5 -Fabric==1.2.0 Jinja2==2.6 -Markdown==2.2.0 -Pygments==1.4 +Markdown==2.2.1 +Pygments==1.6 South==0.7.6 -Sphinx==1.1 -amqplib==1.0.2 -anyjson==0.3.3 -billiard==2.7.3.12 -celery==3.0.8 --e git://github.com/stefanw/celery-haystack.git@3339ceec5ba14d37ef4247f60a454d935c4c7aa5#egg=celery_haystack-dev -coverage==3.5.2 -cssutils==0.9.10b1 -django-appconf==0.5 -django-celery==3.0.6 +Sphinx==1.1.3 +celery==3.0.15 +-e git://github.com/stefanw/celery-haystack.git@latest-deploy#egg=celery_haystack +django-celery==3.0.11 django-celery-email==1.0.3 -django-celery-transactions==0.1.2 -django-crispy-forms==1.1.4 django-debug-toolbar==0.9.4 --e git://github.com/stefanw/django-haystack.git@46eeb7c39b2dceac714c7007847bd7013fb2734e#egg=django_haystack-dev -django-indexer==0.3.0 -django-kombu==0.9.4 +-e git://github.com/stefanw/django-haystack.git@update-index-language#egg=django_haystack django-pagination==1.0.7 django-paging==0.2.4 -django-picklefield==0.2.1 django-secure==0.1.2 -django-sentry==1.13.5 -django-social-auth==0.7.5 django-taggit==0.9.3 -django-templatetag-sugar==0.1 -django-voting==0.1 -docutils==0.8.1 -eventlet==0.9.16 --e git://github.com/dnerdy/factory_boy.git@c3069876b43cc30b24df44ef1b5ada1a1dc0358b#egg=factory_boy-dev -feedparser==5.1.2 -greenlet==0.3.4 -gunicorn==0.14.6 -httpagentparser==1.1.3 -httplib2==0.7.5 -kombu==2.4.5 -lockfile==0.9.1 -logan==0.3.1 -lxml==2.3.4 -oauth2==1.5.211 -paramiko==1.7.7.1 -pep8==1.3.3 -psycopg2==2.4.5 -pycrypto==2.3 -pynliner==0.4.0 -pyparsing==1.5.6 +feedparser==5.1.3 +lxml==2.3.5 +psycopg2==2.4.6 pysolr==2.0.13 -python-daemon==1.6 -python-dateutil==1.5 -python-openid==2.2.5 -pytz==2012d -raven==2.0.5 -requests==0.13.9 -sentry==4.10.0 -simplejson==2.6.1 -wsgiref==0.1.2 +pytz==2012j +requests==1.1.0 django-gravatar2==1.0.6 -django-floppyforms==1.0 +django-floppyforms==1.1 django-overextends==0.2.2 unicodecsv==0.9.0 python-magic==0.4.3