-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
Motor's AgnosticGridFSBucket class claims to match PyMongo's GridFSBucket class but the init signatures are not the same. Here's AgnosticGridFSBucket:
class AgnosticGridFSBucket(object): __motor_class_name__ = 'MotorGridFSBucket' __delegate_class__ = gridfs.GridFSBucket def __init__(self, database, collection="fs", disable_md5=False):
And here's PyMongo's GridFSBucket:
class GridFSBucket(object): def __init__(self, db, bucket_name="fs", chunk_size_bytes=DEFAULT_CHUNK_SIZE, write_concern=None, read_preference=None, disable_md5=False):
AgnosticGridFSBucket's init actually implements PyMongo's legacy GridFS class:
class GridFS(object): """An instance of GridFS on top of a single Database. """ def __init__(self, database, collection="fs", disable_md5=False):
I think we can fix this in a backwards compatible way by changing AgnosticGridFSBucket to:
def __init__(self, db, bucket_name="fs", disable_md5=False chunk_size_bytes=DEFAULT_CHUNK_SIZE, write_concern=None, read_preference=None, collection=None): # Preserve backwards compatibility of "collection" parameter if collection is not None: warnings.warn('the "collection" parameter is deprecated, use' '"bucket_name" instead', DeprecationWarning) bucket_name = collection