studitemps_storage is a package with helper funtions for File IO. It only works in a Django Context. By now it includes three modules:
path
: Contains Basic File IO Functions for general usagestorage
: Django File Storage that make use of functions in path.pymiddleware
: Django Middleware related to the usage of the other packages
Install the package via PIP
git+http://phabricator.intranet.studitemps.de/diffusion/STOR/studitools_storages.git#TAG
DEFAULT_FILE_STORAGE = 'studitemps_storage.GuardedFileSystemStorage'
MIDDLEWARE_CLASSES = (
...
'studitemps_storage.CatchFileSystemNotAvailableMiddleware',
...
)
GUARDED_JOIN_TIMEOUT = 1 # default
GUARDED_JOIN_TEST = False # default
guarded_join raises FileSystemNotAvailable
and the CatchFileSystemNotAvailableMiddleware
catches this.
Make sure you have a template-file 504.html
.
Uses os.path.join to get path from given args. checks if path directory is available by using check_call method of backport from subprocess module from python 3.X (subprocess32) with given timeout and returns path.
from studitemps_storage import guarded_join
Uses from django.utils._os import safe_join https://github.com/django/django/blob/1.6/django/utils/_os.py#L54
Joins one or more path components to the base path component intelligently. Returns a normalized, absolute version of the final path.
The final path must be located inside of the base path component (otherwise a ValueError is raised).
from studitemps_storage import guarded_safe_join
like guarded_join() but never raises IOError. Creates dir instead.
from studitemps_storage import guarded_join_or_create
To run unittests-suites
python studitemps_storage/tests/runtests.py suites
If you make changes to this repo, please make sure:
- Update TestCases according to code-changes
- All- and your Tests are still running
- Update README.md
- Docs. with changes
- Changelog with Changes and the new version
- Update setup.py
version
at line 22 - Commit and create your new Tag
- Bumped v0.1.2
- Update Readme.md for github-format
- Bumped v0.1.1
- Update Usage-docs
- Bumped v0.1.0
- Update README.md
- Update docs
- Add unittest for
path
andstorage
- Fixed guarded_join_or_create AttributeError
- Project Init