2012-06-30 2 views
0

불행히도 데이터 저장소에 내 BLOB 키를 저장하는 실수를 했으므로 직접 마이그레이션해야합니다.BlobMigrationRecord 오류?

내가 HRD 마이그레이션 문서에 마스터 - 슬레이브을 사용하고 있습니다 :

from google.appengine.ext import blobstore 

def GetNewBlobKey(old_key) 
    return blobstore.BlobMigrationRecord.get_new_blob_key(old_key) 

내가 정확하게 수행

https://developers.google.com/appengine/docs/adminconsole/migration

를 결국, 그들은 새로운 키를 얻기 위해 아래에 언급 위 오류는 다음과 같이 표시됩니다.

'module' object has no attribute 'BlobMigrationRecord' 
Traceback (most recent call last): 
    File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1511, in __call__ 
    rv = self.handle_exception(request, response, e) 
    File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, in __call__ 
    rv = self.router.dispatch(request, response) 
    File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1253, in default_dispatcher 
    return route.handler_adapter(request, response) 
    File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1077, in __call__ 
    return handler.dispatch() 
    File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 547, in dispatch 
    return self.handle_exception(e, self.app.debug) 
    File "/base/python27_runtime/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 545, in dispatch 
    return method(*args, **kwargs) 
    File "/base/data/home/apps/1.359990895908922231/main.py", line 1302, in post 
    userEntity.imageUrlBlobKey = blobstore.BlobMigrationRecord.get_new_blob_key(userEntity.imageUrlBlobKey) 
AttributeError: 'module' object has no attribute 'BlobMigrationRecord' 

reciated

+0

사용중인 SDK 버전은 무엇입니까? –

+0

가장 최근의 1.7.0 사용 –

답변

0

실수로 1.7.0 릴리스에서 제외되었습니다. 이것은 1.7.1 릴리스에 포함됩니다 것과 약간 다릅니다

class BlobMigrationRecord(db.Model): 
    """A model that records the result of a blob migration.""" 

    new_blob_key = BlobReferenceProperty(indexed=False) 

    @classmethod 
    def kind(cls): 
    return blobstore.BLOB_MIGRATION_KIND 

    @classmethod 
    def get_by_blob_key(cls, old_blob_key): 
    """Fetches the BlobMigrationRecord for the given blob key. 

    Args: 
     old_blob_key: The blob key used in the previous app. 

    Returns: 
     A instance of blobstore.BlobMigrationRecord or None 
    """ 
    return cls.get_by_key_name(str(old_blob_key)) 

    @classmethod 
    def get_new_blob_key(cls, old_blob_key): 
    """Looks up the new key for a blob. 

    Args: 
     old_blob_key: The original blob key. 

    Returns: 
     The blobstore.BlobKey of the migrated blob. 
    """ 
    record = cls.get_by_blob_key(old_blob_key) 
    if record: 
     return record.new_blob_key.key() 

하는 것으로 : 다음 응용 프로그램에서이 코드를 사용할 수 있습니다 때까지는 1.7.1 릴리스 될 것입니다. 특히 "new_blob_key"속성의 이름은 "new_blob_ref"입니다 (1.7.1에서는 BlobReferenceProperty의 속성 이름을 재정의하는 버그도 수정 함).