Ejemplo n.º 1
0
 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))
Ejemplo n.º 2
0
 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))
Ejemplo n.º 3
0
    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))
Ejemplo n.º 4
0
 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))
Ejemplo n.º 5
0
 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))
Ejemplo n.º 6
0
   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))
Ejemplo n.º 7
0
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)
Ejemplo n.º 8
0
 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))
Ejemplo n.º 9
0
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)