def loadInstanceFromDatastore(klass, key, codec=None):
 if (not issubclass(klass, (db.Model, db.Expando))):
  raise TypeError(('expected db.Model/db.Expando class, got %s' % (klass,)))
 if (not isinstance(key, basestring)):
  raise TypeError('string expected for key, got %s', (repr(key),))
 key = str(key)
 if (codec is None):
  return klass.get(key)
 gae_objects = getGAEObjects(codec.context)
 try:
  return gae_objects.getClassKey(klass, key)
 except KeyError:
  pass
 obj = klass.get(key)
 gae_objects.addClassKey(klass, key, obj)
 return obj

def loadInstanceFromDatastore ( klass , key , codec = None ) : if ( not issubclass ( klass , ( db . Model , db . Expando ) ) ) : raise TypeError ( ( 'expected db.Model/db.Expando class, got %s' % ( klass , ) ) ) if ( not isinstance ( key , basestring ) ) : raise TypeError ( 'string expected for key, got %s' , ( repr ( key ) , ) ) key = str ( key ) if ( codec is None ) : return klass . get ( key ) gae_objects = getGAEObjects ( codec . context ) try : return gae_objects . getClassKey ( klass , key ) except KeyError : pass obj = klass . get ( key ) gae_objects . addClassKey ( klass , key , obj ) return obj
attempt to load an instance from the datastore .