-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #145 from roman-captural/abstract-filesystems
Rewrite of storage backend using fs
- Loading branch information
Showing
10 changed files
with
196 additions
and
153 deletions.
There are no files selected for viewing
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import fs | ||
import fs.base | ||
from django.conf import settings | ||
|
||
|
||
def root() -> fs.base.FS: | ||
"""Get the root filesystem object or create one by opening `settings.FS_URL`.""" | ||
if root._instance is None: | ||
root._instance = fs.open_fs(settings.FS_URL) | ||
return root._instance | ||
|
||
root._instance = None | ||
|
||
|
||
def tmp() -> fs.base.FS: | ||
"""Get the tmp filesystem object or create one by opening `settings.TMP_FS_URL`.""" | ||
if tmp._instance is None: | ||
tmp._instance = fs.open_fs(settings.TMP_FS_URL) | ||
return tmp._instance | ||
|
||
tmp._instance = None |
This file contains 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 characters
This file contains 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 characters
Oops, something went wrong.