stephenmcd / filebrowser-safe

File manager for Mezzanine
Other
42 stars 104 forks source link

GoogleStorageMixin fails to catch GoogleCloudStorage #128

Open jesteria opened 5 years ago

jesteria commented 5 years ago

In attempting to use filebrowser-safe v0.5.0 (Mezzanine v4.3.1) with GoogleCloudStorage (django-storages v1.7.1), I get the error:

AttributeError: 'GoogleCloudStorage' object has no attribute 'isdir'

Having poked around a bit, it looks as though the issue is that my DEFAULT_FILE_STORAGEstorages.backends.gcloud.GoogleCloudStorage – is meant to be monkey-mixed with filebrowser_safe.storage.GoogleStorageMixin; but, it's not.

And, though I might be missing something enormous, I don't see how it would be.

The logic in filebrowser_safe.views

storage_class_name = django_settings.DEFAULT_FILE_STORAGE.split(".")[-1]
mixin_class_name = "filebrowser_safe.storage.%sMixin" % storage_class_name

– can only result in a mixin_class_name of filebrowser_safe.storage.GoogleCloudStorageMixin, which doesn't exist. (The real one is missing the word "Cloud.")

jesteria commented 5 years ago

If the solution is as simple as renaming the mixin class – or adding special logic to catch GoogleCloudStorage – I'd be happy to prepare a PR, (if desired).

But I'm curious how this is or was working for others. For one, #126 suggests to me that the two libraries are getting along fine, and there's been no name shift; but, in that case, I'm missing something.

mikael19 commented 5 years ago

@jesteria Please is there any follow-up on this? I am currently facing issues in configuring mezzanine file uploads with google app engine. Does anyone have an idea on how to do this?

jesteria commented 5 years ago

For my own project, I just had to add a monkey patch, on the order of:

filebrowser_safe.storage.GoogleCloudStorageMixin = filebrowser_safe.storage.GoogleStorageMixin

That's not ideal, and I can't say what purpose is served by the name GoogleStorageMixin, (missing "Cloud") -- it just looks like a mistake. It seems as though filebrowser-safe should either feature this alias itself, or the Google Storage mix-in should be renamed to include the word "Cloud" -- such that, either way, it works without patching.

But, for the time being, monkey-patching this alias worked, for me.