-
Notifications
You must be signed in to change notification settings - Fork 279
Add FileStorage abstraction for handling remote file storage #193
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
Open
coordt
wants to merge
7
commits into
stephenmcd:master
Choose a base branch
from
natgeosociety:file-storage
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8929483
Add FileStorage abstraction for handling remote file storage and loca…
coordt 890c335
Some storage services do not allow updating, and the r+ mode opens th…
coordt fd2de73
[0.14b3] Add tox support
coordt 787509d
[0.14b3] Update the README to inform why we forked it
coordt eb45685
[0.14b3] Update setup.py to remove unneeded dependencies and add shor…
coordt acbe04a
[0.14b3] Version bump
coordt fb3993e
[0.14b4] Move example_project and update setup.py packaging
coordt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or 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 |
---|---|---|
@@ -1 +1,3 @@ | ||
__version__ = "0.13.0" | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
__version__ = "0.14.0b4" |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -5,77 +5,51 @@ | |
from setuptools import setup, find_packages | ||
|
||
|
||
exclude = ["forms_builder/example_project/dev.db", | ||
"forms_builder/example_project/local_settings.py"] | ||
exclude = dict([(e, None) for e in exclude]) | ||
for e in exclude: | ||
if e.endswith(".py"): | ||
try: | ||
os.remove("%sc" % e) | ||
except: | ||
pass | ||
try: | ||
with open(e, "r") as f: | ||
exclude[e] = (f.read(), os.stat(e)) | ||
os.remove(e) | ||
except Exception: | ||
pass | ||
version = __import__('forms_builder').__version__ | ||
|
||
if sys.argv[:2] == ["setup.py", "bdist_wheel"]: | ||
# Remove previous build dir when creating a wheel build, | ||
# since if files have been removed from the project, | ||
# they'll still be cached in the build dir and end up | ||
# as part of the build, which is unexpected. | ||
try: | ||
if sys.argv[-1] == 'publish': | ||
if os.path.exists("build"): | ||
rmtree("build") | ||
except: | ||
pass | ||
os.system('python setup.py bdist_wheel upload -r natgeo') | ||
print("You probably want to also tag the version now:") | ||
print(" python setup.py tag") | ||
sys.exit() | ||
elif sys.argv[-1] == 'tag': | ||
cmd = "git tag -a %s -m 'version %s';git push --tags" % (version, version) | ||
os.system(cmd) | ||
sys.exit() | ||
|
||
try: | ||
setup( | ||
name = "django-forms-builder", | ||
version = __import__("forms_builder").__version__, | ||
author = "Stephen McDonald", | ||
author_email = "[email protected]", | ||
description = ("A Django reusable app providing the ability for " | ||
"admin users to create their own forms and report " | ||
"on their collected data."), | ||
long_description = open("README.rst").read(), | ||
license = "BSD", | ||
url = "http://github.com/stephenmcd/django-forms-builder", | ||
zip_safe = False, | ||
include_package_data = True, | ||
packages = find_packages(), | ||
install_requires = [ | ||
"sphinx-me >= 0.1.2", | ||
"unidecode", | ||
"django-email-extras >= 0.2", | ||
"django >= 1.8, < 1.11", | ||
"future <= 0.15.0", | ||
], | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Environment :: Web Environment", | ||
"Intended Audience :: Developers", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 2.7", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.4", | ||
"Programming Language :: Python :: 3.5", | ||
"Framework :: Django", | ||
"Topic :: Internet :: WWW/HTTP :: Dynamic Content", | ||
"Topic :: Internet :: WWW/HTTP :: Site Management", | ||
] | ||
) | ||
finally: | ||
for e in exclude: | ||
if exclude[e] is not None: | ||
data, stat = exclude[e] | ||
try: | ||
with open(e, "w") as f: | ||
f.write(data) | ||
os.chown(e, stat.st_uid, stat.st_gid) | ||
os.chmod(e, stat.st_mode) | ||
except: | ||
pass | ||
setup( | ||
name="django-forms-builder", | ||
version=__import__("forms_builder").__version__, | ||
author="Stephen McDonald", | ||
author_email="[email protected]", | ||
description=("A Django reusable app providing the ability for " | ||
"admin users to create their own forms and report " | ||
"on their collected data."), | ||
long_description=open("README.rst").read(), | ||
license="BSD", | ||
url="http://github.com/stephenmcd/django-forms-builder", | ||
zip_safe=False, | ||
include_package_data=True, | ||
packages=find_packages(exclude=['*example*', ]), | ||
install_requires=[ | ||
"unidecode", | ||
"django-email-extras >= 0.2", | ||
"future >= 0.16.0", | ||
], | ||
classifiers=[ | ||
"Development Status :: 5 - Production/Stable", | ||
"Environment :: Web Environment", | ||
"Intended Audience :: Developers", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 2.7", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.5", | ||
"Programming Language :: Python :: 3.6", | ||
"Framework :: Django", | ||
"Topic :: Internet :: WWW/HTTP :: Dynamic Content", | ||
"Topic :: Internet :: WWW/HTTP :: Site Management", | ||
] | ||
) |
This file contains hidden or 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 @@ | ||
[tox] | ||
envlist = py{27,36}-django{19,110,111} | ||
|
||
[testenv] | ||
commands = pytest --cov=forms_builder \ | ||
--cov-report term-missing \ | ||
--cov-report xml \ | ||
--junitxml=junit-{envname}.xml \ | ||
--ds=example_project.settings {posargs} | ||
setenv = | ||
PYTHONPATH={toxinidir}:{toxinidir}/example_project | ||
deps = | ||
pytest | ||
pytest-cov | ||
pytest-django | ||
django19: Django<1.10 | ||
django110: Django<1.11 | ||
django111: Django<2.0 | ||
|
||
[pytest] | ||
python_files = tests.py **/tests.py **/tests/*.py **/tests.py |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Following on from our discussion - perhaps this could default to a storage class that exists in this app, that merely uses UPLOAD_ROOT inside its init, and raises an error there if the setting isn't defined. That way all the access to the storage class can happen directly via FORMS_BUILDER_FILE_STORAGE.