-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix: Remove deprecated get_storage_class
import from cms.utils
#8102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's Guide by SourceryThis PR resolves a Django version incompatibility issue by addressing the deprecation and subsequent removal of the Sequence diagram for updated storage class initializationsequenceDiagram
participant ConfiguredStorage
participant LazyObject
participant ImportString
participant Settings
ConfiguredStorage->>LazyObject: _setup()
LazyObject->>ImportString: import_string(STATICFILES_STORAGE)
ImportString->>Settings: getattr(settings, 'STATICFILES_STORAGE', default_storage)
Settings-->>ImportString: storage_class_path
ImportString-->>LazyObject: StorageClass
LazyObject->>LazyObject: instantiate StorageClass()
LazyObject-->>ConfiguredStorage: _wrapped = StorageInstance
Class diagram for ConfiguredStorage implementationclassDiagram
class LazyObject {
+_setup()
+_wrapped
}
class ConfiguredStorage {
+_setup()
}
ConfiguredStorage --|> LazyObject
note for ConfiguredStorage "Changed to use import_string
instead of get_storage_class"
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @fsbraun - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @fsbraun - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding a deprecation warning in ConfiguredStorage._setup() to indicate that configured_storage won't work with Django 5.1+
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Description
get_storage_class
has been deprecated since Django 4.2 and was removed in Django 5.1.cms.utils
since before Django CMS 2 contained a lazyconfigured_storage
object which is not used by Django CMS, but might be used by legacy installations.To fix the incompatibility issue, this PR moves the import into the lazy
configured_storage
object, removing the import fromcms.utils
but keeping theconfigured_storage
object available for backwards compatibility.The
configured_storage
object should not be used with Django 5.1, but will technically work and use Django'sdjango.utils.module_loading.import_string
. The utility function has already been removed already in django CMS 4.0fixes #8101
Related resources
get_storage_class
) #8101Checklist
develop-4
Summary by Sourcery
Resolve compatibility issue with Django 5.1 by addressing the removal of the deprecated
get_storage_class
import.Bug Fixes:
get_storage_class
. The import was moved into the lazyconfigured_storage
object to maintain backwards compatibility.Enhancements:
configured_storage
object.CI: