def get_by_key_name(cls, key_names, parent=None, **kwargs): try: if not parent: parent = cls.db_parent parent = db._coerce_to_key(parent) except db.BadKeyError, e: raise db.BadArgumentError(str(e))
def get_by_key_name(cls, key_names, parent=None, **kwargs): """Get instance of Model class by its key's name. Keeps the same comportement of db.Model.get_by_key_name() TODO(sahid): Needs doc. """ try: parent = db._coerce_to_key(parent) except db.BadKeyError, e: raise db.BadArgumentError(str(e))
def get_by_id(cls, ids, parent=None,**kwds): """Get instance of Model class by id from the given storage layers. Args: See pdb.get Inherited: ids: A single id or a list of ids. parent: Parent of instances to get. Can be a model or key. """ try: parent = db._coerce_to_key(parent) except db.BadKeyError, e: raise db.BadArgumentError(str(e))
def get_by_id(cls, ids, parent=None, **kwds): """Get instance of Model class by id from the given storage layers. Args: See pdb.get Inherited: ids: A single id or a list of ids. parent: Parent of instances to get. Can be a model or key. """ try: parent = db._coerce_to_key(parent) except db.BadKeyError, e: raise db.BadArgumentError(str(e))
def _key_str(param): '''Utility function that extracts a string key from a model or key instance''' try: return str(db._coerce_to_key(param)) except db.BadArgumentError: raise KeyParameterError(param)
def get_by_key_name (cls, key_names, parent=None, **kwargs): logging.info ('get_by_key_name: %s' % key_names) try: parent = db._coerce_to_key (parent) except db.BadKeyError, e: raise db.BadArgumentError (str (e))