Commits

Jason R. Coombs committed 99d10be

Allow a schema to be passed

  • Participants
  • Parent commits 1ddf4c1

Comments (0)

Files changed (1)

File thwump/index.py

 class Index(whoosh.index.Index):
 	database_name = 'thwump'
 	collection_name = 'index'
-	def __init__(self, *args, **kwargs):
-		self.connection = pymongo.Connection(*args, **kwargs)
-		self.collection = self.connection[self.database_name][self.collection_name]
+	def __init__(self, schema=None, connection_factory=pymongo.Connection):
+		self.schema = schema
+		self.connection = connection_factory()
+		self.collection = self.connection[self.database_name][
+			self.collection_name]
 
 	def is_empty(self):
 		return not self.doc_count()