Example #1
0
 def _configure_serializer_doctype(self, serializer_class, index_name):
     doc_type_label = get_serializer_doctype_label(serializer_class)
     if doc_type_label:
         self._doctype_lookup[index_name].add(doc_type_label)
         # register doc_type_class with index
         doc_type_class = get_document_class(doc_type_label)
         doc_type_class._doc_type.index = index_name
     else:
         logger.error("DocType not found for '{}'".format(repr(serializer_class)))
Example #2
0
 def _configure_serializer_doctype(self, serializer_class, index_name):
     doc_type_label = get_serializer_doctype_label(serializer_class)
     if doc_type_label:
         self._doctype_lookup[index_name].add(doc_type_label)
         # register doc_type_class with index
         doc_type_class = get_document_class(doc_type_label)
         doc_type_class._doc_type.index = index_name
     else:
         logger.error("DocType not found for '{}'".format(
             repr(serializer_class)))
Example #3
0
 def test_get_document_class_corrects_incomplete_path(self):
     klass = get_document_class('search.ProjectDoc')
     self.assertIsNotNone(klass)
     self.assertEqual(klass, ProjectDoc)
Example #4
0
 def test_get_document_class_gets_class_from_full_path(self):
     klass = get_document_class('search.documents.ProjectDoc')
     self.assertIsNotNone(klass)
     self.assertEqual(klass, ProjectDoc)
Example #5
0
 def test_get_document_class_raises_error_on_bad_path(self):
     with self.assertRaises(ImportError):
         get_document_class('foo.Bar')
Example #6
0
 def test_get_document_class_raises_error_on_bad_path(self):
     with self.assertRaises(ImportError):
         get_document_class('foo.Bar')
Example #7
0
 def test_get_document_class_corrects_incomplete_path(self):
     klass = get_document_class('search.ProjectDoc')
     self.assertIsNotNone(klass)
     self.assertEqual(klass, ProjectDoc)
Example #8
0
 def test_get_document_class_gets_class_from_full_path(self):
     klass = get_document_class('search.documents.ProjectDoc')
     self.assertIsNotNone(klass)
     self.assertEqual(klass, ProjectDoc)