def get_document(request):
 from google.appengine.ext import db
 doc_class = request.get('python_document_class')
 if (not doc_class):
  return None
 entity = entity_pb.EntityProto()
 entity.ParseFromString(base64.urlsafe_b64decode(request.get('document').encode('utf-8')))
 doc_class = int(doc_class)
 if (doc_class is _doc_class.ENTITY):
  return datastore.Entity('temp-kind').FromPb(entity)
 elif (doc_class is _doc_class.MODEL):
  return db.model_from_protobuf(entity)
 else:
  raise DocumentTypeError()

def get_document ( request ) : from google . appengine . ext import db doc_class = request . get ( 'python_document_class' ) if ( not doc_class ) : return None entity = entity_pb . EntityProto ( ) entity . ParseFromString ( base64 . urlsafe_b64decode ( request . get ( 'document' ) . encode ( 'utf-8' ) ) ) doc_class = int ( doc_class ) if ( doc_class is _doc_class . ENTITY ) : return datastore . Entity ( 'temp-kind' ) . FromPb ( entity ) elif ( doc_class is _doc_class . MODEL ) : return db . model_from_protobuf ( entity ) else : raise DocumentTypeError ( )
given a slug and a request .