0.11.0 - Added Object.full_url, removed Object.shorl_url

This commit is contained in:
Mardix
2015-08-10 20:23:09 -04:00
parent a93f5ae631
commit 529ebc4214
5 changed files with 42 additions and 19 deletions
+4
View File
@@ -1,3 +1,7 @@
0.11.0
- Removed flask_cloudy.Object.short_url now use flask_cloudy.Object.url
- Added flask_cloudy.Object.full_url to have the domain for local storage
0.10.0
- Removed LOCAL_PATH configuration. Use CONTAINER as the LOCAL_PATH
- Change config prefix to STORAGE_*
+13 -4
View File
@@ -8,6 +8,9 @@ AWS S3, Google Storage, Microsoft Azure, Rackspace Cloudfiles, and even Local fi
For local file storage, it also provides a flask endpoint to access the files.
Version: 0.11.*
---
##TLDR; Quick Example
@@ -406,12 +409,17 @@ The extension of the object
##### Object.url
Get the full url of the object
Return the url of the object
On LOCAL, it will return the url without the domain name ( ie: /files/my-file.jpg )
##### Object.short_url
For cloud providers it will return the full url
Specially for LOCAL provider, it will return the url without the domain.
##### Object.full_url
Returns the full url of the object
Specially for LOCAL provider, it will return the url with the domain.
For cloud providers, it will return the full url just like **Object.url**
@@ -420,6 +428,7 @@ For cloud providers, it will return the full url just like **Object.url**
Return a secured url, with **https://**
##### Object.path
The path of the object relative to the container
@@ -461,7 +470,7 @@ To save the object to a local path
##### Object.download_url(timeout=60, name=None)
Return a URL that triggers the browser download of the file.
Return a URL that triggers the browser download of the file. On cloud providers it will return a signed url.
- timeout: int - The time in seconds to give access to the url
+24 -12
View File
@@ -448,24 +448,24 @@ class Object(object):
def url(self):
"""
Returns the url of the object.
For local it will return it with the domain name
:return:
"""
return self.get_url(longurl=True)
@property
def short_url(self):
"""
Returns the url of the object
For local it will return it WITHOUT the domain name
:return:
For Local it will return it without the domain name
:return: str
"""
return self.get_url()
@property
def full_url(self):
"""
Returns the full url with the domain, specially for Local storage
:return: str
"""
return self.get_url(longurl=True)
@property
def secure_url(self):
"""
Return a url with https
Return the full url with https
:return:
"""
return self.get_url(secure=True, longurl=True)
@@ -564,3 +564,15 @@ class Object(object):
raise NotImplemented("This provider '%s' doesn't support or "
"doesn't have a signed url "
"implemented yet" % self.provider_name)
@property
def short_url(self):
"""
DEPRECATED
Returns the url of the object
For local it will return it WITHOUT the domain name
:return:
"""
warnings.warn("DEPRECATED: flask_cloudy.Object.short_url has been deprecated, use flask_cloudy.Object.url or flask_cloudy.Object.full_url")
return self.get_url()
+1 -1
View File
@@ -19,7 +19,7 @@ Supported storage:
from setuptools import setup, find_packages
__NAME__ = "Flask-Cloudy"
__version__ = "0.10.0"
__version__ = "0.11.0"
__author__ = "Mardix"
__license__ = "MIT"
__copyright__ = "2015"
-2
View File
@@ -165,5 +165,3 @@ def test_save_to():
assert os.path.isfile(file)
assert file2 == CWD + "/data/my_new_file.txt"
from flask_cloudy import Storage