Package amplee :: Package storage :: Module stores3 :: Class S3Storage
[hide private]
[frames] | no frames]

Class S3Storage

source code

object --+    
         |    
   Storage --+
             |
            S3Storage

Instance Methods [hide private]
  __init__(self, aws_access_key_id, aws_secret_access_key, unique_prefix)
Amazon S3 storage for amplee.
  shutdown(self)
Does nothing effectively.
  __bn(self, value)
...
  create_container(self, collection_name)
...
  path(self, *args, **kwargs)
Returns a KeyWrapper instance.
  get_content(self, path)
...
  get_meta_data(self, path)
...
  put_content(self, path, content, media_type=None, *args, **kwargs)
...
  put_meta_data(self, path, content, media_type=None, *args, **kwargs)
...
  remove_content(self, path)
...
  remove_meta_data(self, path)
...
  persist(self, path_list, msg=None)
...
  exists(self, path)
...
  ls(self, collection_name, ext)
...

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

__init__(self, aws_access_key_id, aws_secret_access_key, unique_prefix)
(Constructor)

source code 

Amazon S3 storage for amplee.
http://www.amazon.com/gp/browse.html?node=16427261

If the buck does not exist this storage will create it transparently.

Keyword arguments
aws_access_key_id -- Amazon S3 publick key
aws_secret_access_key -- Amazon S3 private key
unique_prefix -- Unique prefix used for the creation of buckets

Set it to something really unique and not None!

Overrides: object.__init__

shutdown(self)

source code 

Does nothing effectively.

Overrides: Storage.shutdown

__bn(self, value)

source code 

Constructs the bucket name 

create_container(self, collection_name)

source code 

Creates and returns a boto bucket instance for that collection name
prefixed by self.unique_prefix

Overrides: Storage.create_container

path(self, *args, **kwargs)

source code 

Returns a KeyWrapper instance.

You must provided at least two non keyword arguments:
the collection name and the resource name

Overrides: Storage.path

get_content(self, path)

source code 

Returns the content of the resource at 'path' as a string

Keyword argument:
path -- a Key or KeyWrapper instance

Overrides: Storage.get_content

get_meta_data(self, path)

source code 

Returns the content of the resource at 'path' as a string

Keyword argument:
path -- a Key or KeyWrapper instance

Overrides: Storage.get_meta_data

put_content(self, path, content, media_type=None, *args, **kwargs)

source code 

Updates the content of the resource at 'path'

Keyword argument:
path -- a KeyWrapper instance
content -- content as a string to be persisted into the bucket
media_type -- mime type of the resource (default:None)

Overrides: Storage.put_content

put_meta_data(self, path, content, media_type=None, *args, **kwargs)

source code 

Updates the content of the resource at 'path'

Keyword argument:
path -- a KeyWrapper instance
content -- content as a string to be persisted into the bucket
media_type -- mime type of the resource (default:None)

Overrides: Storage.put_meta_data

remove_content(self, path)

source code 

Removes the resource at 'path'

Keyword argument:
path -- a Key or KeyWrapper instance

Overrides: Storage.remove_content

remove_meta_data(self, path)

source code 

Removes the resource at 'path'

Keyword argument:
path -- a Key or KeyWrapper instance

Overrides: Storage.remove_meta_data

persist(self, path_list, msg=None)

source code 

Does nothing

Overrides: Storage.persist

exists(self, path)

source code 

Returns True if the resource 'path' exists in the bucket

Overrides: Storage.exists

ls(self, collection_name, ext)

source code 

Returns a dictionary of the form {resource_name: {'path': KeyWrapper}}

Keyword argument:
collection_name -- the name of the collection to browse
ext -- extension to filter through

Overrides: Storage.ls