Commit c69707106041f3d84cf1472977e40022454bc33a

Authored by Sergio Oliveira
2 parents a2e34e57 27b453ea

Merge branch 'remove-deps' into 'master'

Remove deps (Revised dependencies, Sqlite3, Whoosh)

Remove colab dependencies. Change postgres to Sqlite3 and search engine to Whoosh for development.
Whoosh didn't seem to support haystack input AltParse so if the engine is whoosh, colab will use AutoQuery instead.

See merge request !70
colab/management/initconfig.py
... ... @@ -34,20 +34,14 @@ ALLOWED_HOSTS = [
34 34 ## Database settings
35 35 DATABASES = {{
36 36 'default': {{
37   - 'ENGINE': 'django.db.backends.postgresql_psycopg2',
38   - 'HOST': 'localhost',
39   - 'NAME': 'colab',
40   - 'USER': 'colab',
41   - 'PASSWORD': 'colab',
  37 + 'ENGINE': 'django.db.backends.sqlite3',
  38 + 'NAME': 'colab.sqlite3',
42 39 }}
43 40 }}
44 41  
45 42 ## Disable indexing
46 43 ROBOTS_NOINDEX = False
47 44  
48   -### Log errors to Sentry instance
49   -# RAVEN_DSN = 'http://public:secret@example.com/1'
50   -
51 45 LOGGING = {{
52 46 'version': 1,
53 47  
... ...
colab/search/forms.py
... ... @@ -7,6 +7,7 @@ from django.conf import settings
7 7 from django.utils.translation import ugettext_lazy as _
8 8 from haystack.forms import SearchForm
9 9 from haystack.inputs import AltParser
  10 +from haystack.inputs import AutoQuery
10 11  
11 12 from colab.super_archives.models import MailingList
12 13  
... ... @@ -107,7 +108,11 @@ class ColabSearchForm(SearchForm):
107 108 'bf': 'recip(ms(NOW/HOUR,modified),3.16e-11,1,1)^10',
108 109 }
109 110  
110   - sqs = sqs.filter(content=AltParser('edismax', q, **dismax_opts))
  111 + if settings.HAYSTACK_CONNECTIONS['default']['ENGINE'] != \
  112 + 'haystack.backends.whoosh_backend.WhooshEngine':
  113 + sqs = sqs.filter(content=AltParser('edismax', q, **dismax_opts))
  114 + else:
  115 + sqs = sqs.filter(content=AutoQuery(q))
111 116  
112 117 if self.cleaned_data['type']:
113 118 sqs = sqs.filter(type=self.cleaned_data['type'])
... ...
colab/search/tests.py
... ... @@ -9,7 +9,7 @@ class SearchViewTest(TestCase):
9 9 fixtures = ['test_data.json']
10 10  
11 11 def setUp(self):
12   - call_command('update_index', interactive=False, verbosity=0)
  12 + call_command('rebuild_index', interactive=False, verbosity=0)
13 13 self.client = Client()
14 14  
15 15 def tearDown(self):
... ... @@ -21,12 +21,12 @@ class SearchViewTest(TestCase):
21 21  
22 22 self.assertEqual(3, len(thread_list))
23 23  
24   - self.assertIn('This is a repply to Thread 1 on list A',
25   - thread_list[0].description)
26   - self.assertIn('This is a repply to Thread 1 on list C',
27   - thread_list[1].description)
28   - self.assertIn('This is a repply to Thread 1 on list B',
29   - thread_list[2].description)
  24 + condition = any('This is a repply to Thread 1 on list A' in t.description for t in thread_list)
  25 + self.assertTrue(condition)
  26 + condition = any('This is a repply to Thread 1 on list B' in t.description for t in thread_list)
  27 + self.assertTrue(condition)
  28 + condition = any('This is a repply to Thread 1 on list C' in t.description for t in thread_list)
  29 + self.assertTrue(condition)
30 30  
31 31 def test_search_account_by_firstName(self):
32 32 request = self.client.get('/search/?q=Chuck')
... ...
colab/settings.py
... ... @@ -42,7 +42,6 @@ INSTALLED_APPS = (
42 42 'colab.accounts',
43 43  
44 44 # Not standard apps
45   - 'cliauth',
46 45 'django_mobile',
47 46 'haystack',
48 47 'hitcounter',
... ... @@ -166,15 +165,8 @@ HAYSTACK_CUSTOM_HIGHLIGHTER = 'colab.utils.highlighting.ColabHighlighter'
166 165  
167 166 HAYSTACK_CONNECTIONS = {
168 167 'default': {
169   - 'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
170   - 'URL': 'http://localhost:8983/solr/',
171   - }
172   -}
173   -
174   -CACHES = {
175   - 'default': {
176   - 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
177   - 'LOCATION': '127.0.0.1:11211',
  168 + 'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
  169 + 'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'),
178 170 }
179 171 }
180 172  
... ... @@ -252,12 +244,7 @@ TASTYPIE_DEFAULT_FORMATS = ['json', ]
252 244  
253 245 from .utils.conf import load_colab_apps, load_py_settings
254 246  
255   -if locals().get('RAVEN_DSN', False):
256   - RAVEN_CONFIG = {
257   - 'dsn': RAVEN_DSN + '?timeout=30', # noqa
258   - }
259   - INSTALLED_APPS += ('raven.contrib.django.raven_compat',)
260   -
  247 +BROWSERID_ENABLED = locals().get('BROWSERID_ENABLED') or False
261 248 SOCIAL_NETWORK_ENABLED = locals().get('SOCIAL_NETWORK_ENABLED') or False
262 249  
263 250 locals().update(load_colab_apps())
... ...
colab/super_archives/search_indexes.py
... ... @@ -28,7 +28,7 @@ class ThreadIndex(BaseIndex, indexes.Indexable):
28 28 latest_message_pk = indexes.IntegerField(
29 29 model_attr='latest_message__pk', indexed=False
30 30 )
31   - score = indexes.IntegerField(model_attr='score')
  31 + rating = indexes.IntegerField(model_attr='score')
32 32  
33 33 def get_model(self):
34 34 return Thread
... ...
setup.py
... ... @@ -3,46 +3,45 @@ from setuptools import setup, find_packages
3 3  
4 4  
5 5 REQUIREMENTS = [
6   - 'Django==1.7.7',
7   - 'psycopg2==2.5.1',
8   - 'django-piston==0.2.3',
9   - 'pytz==2011n',
10   - 'chardet==1.0.1',
11   - 'python-dateutil==1.5',
12   - 'django-cliauth==0.9.1',
13   - 'django-mobile==0.3.0',
14   - 'django-haystack==2.2',
15   - 'pysolr==2.1',
16   - 'poster==0.8.1',
17   - 'etiquetando==0.1',
18   - 'html2text==3.200.3',
19   - 'django-taggit==0.12.1',
20   - 'python-memcached==1.53',
21   - 'django-hitcounter==0.1.1',
22   - 'Pillow==2.5.1',
23   - 'django-i18n-model==0.0.7',
24   - 'django-tastypie==0.11.0',
25   - 'gunicorn==19.1.0',
26   - 'eventlet==0.15.2',
  6 + 'Django>=1.7.8,<1.8',
  7 + 'pytz>=2011n',
  8 + 'django-hitcounter>=0.1.1',
  9 + 'django-tastypie>=0.12.1',
  10 + 'django-revproxy>=0.9.0',
  11 + 'django-haystack>=2.2',
  12 + 'Whoosh>=2.7.0',
  13 +
  14 + # Diazo
  15 + 'diazo>=1.0.5',
27 16  
28   - # Deps for sentry client (raven)
29   - 'raven==3.5.2',
30   - 'tornado==3.1.1',
  17 + # Deps for Single SignOn (SSO)
  18 + 'django-browserid>=0.11',
31 19  
32   - 'django-revproxy==0.9.3',
  20 + ### Move out of colab (as plugins):
33 21  
34   - # Diazo
35   - 'diazo==1.0.5',
  22 + # Deps for badger
  23 + 'Pillow==2.8.1',
  24 + 'django-i18n-model>=0.0.7',
  25 +
  26 + # Deps for super_archives
  27 + 'etiquetando==0.1',
  28 + 'django-taggit>=0.12.1',
  29 + 'html2text>=3.200.3',
  30 + 'chardet>=1.0.1',
  31 +
  32 + # Deps for gitlab plugin
  33 + 'python-dateutil>=1.5',
36 34  
37   - # Mailman 2 REST API
38   - 'mailman-api==0.2.9',
  35 + # Converse.js (XMPP client)
  36 + 'django-conversejs>=0.3.4',
  37 + 'django-mobile>=0.3.0',
39 38 ]
40 39  
41 40 TEST_REQUIREMENTS = [
42   - 'coverage==3.7.1',
43   - 'coveralls==0.5',
44   - 'flake8==2.3.0',
45   - 'mock==1.0.1',
  41 + 'coverage>=3.7.1',
  42 + 'coveralls>=0.5',
  43 + 'flake8>=2.3.0',
  44 + 'mock>=1.0.1',
46 45 ]
47 46  
48 47  
... ...
tests/settings.py
... ... @@ -32,8 +32,8 @@ LOGGING = {
32 32 import os
33 33 HAYSTACK_CONNECTIONS = {
34 34 'default': {
35   - 'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
36   - 'URL': 'http://127.0.0.1:8983/solr',
  35 + 'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
  36 + 'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'),
37 37 },
38 38 }
39 39  
... ... @@ -41,10 +41,7 @@ SECRET_KEY = &#39;not-a-secret&#39;
41 41  
42 42 DATABASES = {
43 43 'default': {
44   - 'ENGINE': 'django.db.backends.postgresql_psycopg2',
45   - 'HOST': 'localhost',
46   - 'NAME': 'colab',
47   - 'USER': 'colab',
48   - 'PASSWORD': 'colab',
  44 + 'ENGINE': 'django.db.backends.sqlite3',
  45 + 'NAME': 'colab.sqlite',
49 46 }
50 47 }
... ...