App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Public Member Functions | Static Public Attributes | List of all members
google.appengine.api.blobstore.blobstore_stub.BlobstoreServiceStub Class Reference
Inheritance diagram for google.appengine.api.blobstore.blobstore_stub.BlobstoreServiceStub:
google.appengine.api.apiproxy_stub.APIProxyStub

Public Member Functions

def __init__
 
def ToDatastoreBlobKey
 
def storage
 
def DeleteBlob
 
def CreateEncodedGoogleStorageKey
 
def CreateBlob
 
- Public Member Functions inherited from google.appengine.api.apiproxy_stub.APIProxyStub
def __init__
 
def CreateRPC
 
def MakeSyncCall
 
def SetError
 

Static Public Attributes

string GS_BLOBKEY_PREFIX = 'encoded_gs_file:'
 
- Static Public Attributes inherited from google.appengine.api.apiproxy_stub.APIProxyStub
 THREADSAFE = False
 

Additional Inherited Members

- Public Attributes inherited from google.appengine.api.apiproxy_stub.APIProxyStub
 request_data
 

Detailed Description

Datastore backed Blobstore service stub.

This stub stores manages upload sessions in the Datastore and must be
provided with a blob_storage object to know where the actual blob
records can be found after having been uploaded.

This stub does not handle the actual creation of blobs, neither the BlobInfo
in the Datastore nor creation of blob data in the blob_storage.  It does,
however, assume that another part of the system has created these and
uses these objects for deletion.

An upload session is created when the CreateUploadURL request is handled and
put in the Datastore under the __BlobUploadSession__ kind.  There is no
analog for this kind on a production server. Other than creation, this stub
not work with session objects.  The URLs created by this service stub are:

  http://<appserver-host>:<appserver-port>/<uploader-path>/<session-info>

This is very similar to what the URL is on a production server.  The session
info is the string encoded version of the session entity

Constructor & Destructor Documentation

def google.appengine.api.blobstore.blobstore_stub.BlobstoreServiceStub.__init__ (   self,
  blob_storage,
  time_function = time.time,
  service_name = 'blobstore',
  uploader_path = '_ah/upload/',
  request_data = None 
)
Constructor.

Args:
  blob_storage: BlobStorage class instance used for blob storage.
  time_function: Used for dependency injection in tests.
  service_name: Service name expected for all calls.
  uploader_path: Path to upload handler pointed to by URLs generated
by this service stub.
  request_data: A apiproxy_stub.RequestData instance used to look up state
associated with the request that generated an API call.

Member Function Documentation

def google.appengine.api.blobstore.blobstore_stub.BlobstoreServiceStub.CreateBlob (   self,
  blob_key,
  content 
)
Create new blob and put in storage and Datastore.

This is useful in testing where you have access to the stub.

Args:
  blob_key: String blob-key of new blob.
  content: Content of new blob as a string.

Returns:
  New Datastore entity without blob meta-data fields.
def google.appengine.api.blobstore.blobstore_stub.BlobstoreServiceStub.CreateEncodedGoogleStorageKey (   cls,
  filename 
)
Create an encoded blob key that represents a Google Storage file.

For now we'll just base64 encode the Google Storage filename, APIs that
accept encoded blob keys will need to be able to support Google Storage
files or blobstore files based on decoding this key.

Any stub that creates GS files should use this function to convert
a gs filename to a blobkey. The created blobkey should be used both
as its _GS_FILE_INFO entity's key name and as the storage key to
store its content in blobstore. This ensures the GS files created
can be operated by other APIs.

Note this encoding is easily reversible and is not encryption.

Args:
  filename: gs filename of form 'bucket/filename'

Returns:
  blobkey string of encoded filename.
def google.appengine.api.blobstore.blobstore_stub.BlobstoreServiceStub.DeleteBlob (   cls,
  blobkey,
  storage 
)
Delete a blob.

Args:
  blobkey: blobkey in str.
  storage: blobstore storage stub.
def google.appengine.api.blobstore.blobstore_stub.BlobstoreServiceStub.storage (   self)
Access BlobStorage used by service stub.

Returns:
  BlobStorage instance used by blobstore service stub.
def google.appengine.api.blobstore.blobstore_stub.BlobstoreServiceStub.ToDatastoreBlobKey (   cls,
  blobkey 
)
Given a string blobkey, return its db.Key.

The documentation for this class was generated from the following file: