app/soc/logic/models/base.py
changeset 396 6af084bd290c
parent 390 d12c95ade374
child 399 b82852e6963e
equal deleted inserted replaced
395:c2cbf8ebe100 396:6af084bd290c
    96       # an entity exist for this link_name, so return that entity
    96       # an entity exist for this link_name, so return that entity
    97       return entity
    97       return entity
    98 
    98 
    99     fields = []
    99     fields = []
   100 
   100 
   101     for key, value in kwargs.iteritems():
   101     msg = 'There is no %s where ' % self._name
   102       fields.extend('"%s" is "%s" ' % (key, value))
   102 
       
   103     for index, pair in enumerate(kwargs.iteritems()):
       
   104       if index != 0:
       
   105         msg += ' and '
       
   106 
       
   107       msg += '"%s" is "%s"' % pair
       
   108 
       
   109     msg += '.'
   103 
   110 
   104     # else: fields were supplied, but there is no Entity that has it
   111     # else: fields were supplied, but there is no Entity that has it
   105     raise out_of_band.ErrorResponse(
   112     raise out_of_band.ErrorResponse(msg, status=404)
   106         'There is no %s with %s.' % (self._name, ''.join(fields)), status=404)
       
   107 
   113 
   108   def getKeyNameForFields(self, **kwargs):
   114   def getKeyNameForFields(self, **kwargs):
   109     """Return a Datastore key_name for a Entity from the specified fields.
   115     """Return a Datastore key_name for a Entity from the specified fields.
   110 
   116 
   111     Args:
   117     Args: