Commits

Jason R. Coombs committed 68c9ba3

Use objectid from bson module to support later versions of pymongo

Comments (0)

Files changed (1)

pmxbot/logging.py

 		# get rid of 'the last !strike' too!
 		limit = count+1
 		# don't delete anything beyond the past 18 hours
-		date_limit = storage.pymongo.objectid.ObjectId.from_datetime(
+		date_limit = storage.bson.objectid.ObjectId.from_datetime(
 			datetime.datetime.utcnow() - datetime.timedelta(hours=18)
 		)
 		query = dict(channel=channel, nick=nick, _id={'$gt': date_limit})
 	def import_(self, message):
 		# construct a unique objectid with the correct datetime.
 		dt = message['datetime']
-		oid_time = storage.pymongo.objectid.ObjectId.from_datetime(dt)
+		oid_time = storage.bson.objectid.ObjectId.from_datetime(dt)
 		# store the original sqlite object ID in the
 		orig_id = message.pop('id')
 		orig_id_packed = struct.pack('>Q', orig_id)
 		oid_new = oid_time.binary[:4] + orig_id_packed
-		oid = storage.pymongo.objectid.ObjectId(oid_new)
+		oid = storage.bson.objectid.ObjectId(oid_new)
 		if not hasattr(Logger, 'log_id_map'): Logger.log_id_map = dict()
 		Logger.log_id_map[orig_id] = oid
 		message['_id'] = oid
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.