| 1 |
class StorageSettingsMixin: |
| 2 |
def _clear_cached_properties(self, setting, **kwargs): |
| 3 |
"""Reset setting based property values.""" |
| 4 |
if setting == "MEDIA_ROOT": |
| 5 |
self.__dict__.pop("base_location", None) |
| 6 |
self.__dict__.pop("location", None) |
| 7 |
elif setting == "MEDIA_URL": |
| 8 |
self.__dict__.pop("base_url", None) |
| 9 |
elif setting == "FILE_UPLOAD_PERMISSIONS": |
| 10 |
self.__dict__.pop("file_permissions_mode", None) |
| 11 |
elif setting == "FILE_UPLOAD_DIRECTORY_PERMISSIONS": |
| 12 |
self.__dict__.pop("directory_permissions_mode", None) |
| 13 |
|
| 14 |
def _value_or_setting(self, value, setting): |
| 15 |
return setting if value is None else value |