Skip to content

Commit af99f8a

Browse files
committed
fix commands with django 1.7
1 parent 2c94f2e commit af99f8a

File tree

5 files changed

+13
-16
lines changed

5 files changed

+13
-16
lines changed

ChangeLog

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
CHANGELOG
22

3-
2015-06-23
4-
* Remove algolia_buildindex command. Use algolia_reindex instead.
5-
* Change settings format. Last format is still supported.
6-
* Add unit test.
7-
* Add tag capacity
8-
* Add Conditional indexing
3+
2015-07-XX X.X.X
4+
* [REMOVE] algolia_buildindex command. Use algolia_reindex instead.
5+
* [CHANGE] Settings format. Last format is still supported.
6+
* [ADD] Unit test.
7+
* [ADD] Tag capacity
8+
* [ADD] Conditional indexing
9+
* [ADD] Search capacity on backend
10+
* [FIX] Invalid custom_objectID attribute
11+
* [FIX] Exception throw by the command when using Django 1.7

src/management/commands/algolia_applysettings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def handle(self, *args, **options):
1313
self.stdout.write('Apply settings to index:')
1414
for model in algoliasearch.get_registered_model():
1515
adapter = algoliasearch.get_adapter(model)
16-
if options['model'] and not (model.__name__ in options['model']):
16+
if options.get('model', None) and not (model.__name__ in options['model']):
1717
continue
1818

1919
adapter.set_settings()

src/management/commands/algolia_clearindex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def handle(self, *args, **options):
1313
self.stdout.write('Clear index:')
1414
for model in algoliasearch.get_registered_model():
1515
adapter = algoliasearch.get_adapter(model)
16-
if options['model'] and not (model.__name__ in options['model']):
16+
if options.get('model', None) and not (model.__name__ in options['model']):
1717
continue
1818

1919
adapter.clear_index()

src/management/commands/algolia_reindex.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ def handle(self, *args, **options):
1414
self.stdout.write('The following models were reindexed:')
1515
for model in algoliasearch.get_registered_model():
1616
adapter = algoliasearch.get_adapter(model)
17-
if options['model'] and not (model.__name__ in options['model']):
17+
if options.get('model', None) and not (model.__name__ in options['model']):
1818
continue
1919

20-
counts = adapter.reindex_all(batch_size=options['batchsize'])
20+
counts = adapter.reindex_all(batch_size=options.get('batchsize', None))
2121
self.stdout.write('\t* {} --> {}'.format(model.__name__, counts))

tests/test_engine.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ class EngineTestCase(TestCase):
1111
def setUp(self):
1212
self.engine = AlgoliaEngine()
1313

14-
def tearDown(self):
15-
try:
16-
self.engine.unregister(Example)
17-
except RegistrationError:
18-
pass
19-
2014
def test_is_register(self):
2115
self.assertFalse(self.engine.is_registered(Example))
2216
self.engine.register(Example)

0 commit comments

Comments
 (0)