69 if not all(key in key_field_names for key in kwargs.keys()): |
69 if not all(key in key_field_names for key in kwargs.keys()): |
70 raise Error("Some of the provided arguments are not key fields") |
70 raise Error("Some of the provided arguments are not key fields") |
71 |
71 |
72 # check if all key_field_names for this entity are present in kwargs |
72 # check if all key_field_names for this entity are present in kwargs |
73 if not all(field in kwargs.keys() for field in key_field_names): |
73 if not all(field in kwargs.keys() for field in key_field_names): |
74 raise Error("Not all the required key fields are present") |
74 raise Error("Not all the required key fields are present") |
75 |
75 |
76 # check if all kwargs.values() are non-false |
76 # check if all kwargs.values() are non-false |
77 if not all(kwargs.values()): |
77 if not all(kwargs.values()): |
78 raise Error("Not all KeyValues are non-false") |
78 raise Error("Not all KeyValues are non-false") |
79 |
79 |
80 # construct the KeyValues in the order given by getKeyFieldNames() |
80 # construct the KeyValues in the order given by getKeyFieldNames() |
81 keyvalues = [] |
81 keyvalues = [] |
82 for key_field_name in key_field_names: |
82 for key_field_name in key_field_names: |
83 keyvalues.append(kwargs[key_field_name]) |
83 keyvalues.append(kwargs[key_field_name]) |
84 |
84 |
85 # construct the KeyName in the appropriate format |
85 # construct the KeyName in the appropriate format |
86 return ":".join([self._name] + keyvalues) |
86 return ":".join([self._name] + keyvalues) |
87 |
87 |
88 def getKeyValues(self, entity): |
88 def getKeyValues(self, entity): |
249 query = self._model.gql(condition, **properties) |
249 query = self._model.gql(condition, **properties) |
250 |
250 |
251 if unique: |
251 if unique: |
252 return query.get() |
252 return query.get() |
253 |
253 |
254 result = query.fetch(limit, offset) |
254 return query.fetch(limit, offset) |
255 return result |
|
256 |
255 |
257 def updateModelProperties(self, model, model_properties): |
256 def updateModelProperties(self, model, model_properties): |
258 """Update existing model entity using supplied model properties. |
257 """Update existing model entity using supplied model properties. |
259 |
258 |
260 Args: |
259 Args: |