Created
April 25, 2018 21:57
-
-
Save sky-code/d0f6ed877770d30b9fd325fba2e59437 to your computer and use it in GitHub Desktop.
Revisions
-
sky-code created this gist
Apr 25, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ from bson.objectid import ObjectId class ObjectIDConverter: regex = '[0-9A-Fa-f]{24}' def to_python(self, value): if ObjectId.is_valid(value): return value raise ValueError() def to_url(self, value): return value