(self, name)
| 242 | return self._get(name) |
| 243 | |
| 244 | def _get(self, name): |
| 245 | # get the value for this key and save in value_cache |
| 246 | if self._key_prefix: |
| 247 | key = "%s.%s" % (self._key_prefix, name) |
| 248 | else: |
| 249 | key = UserKeyReference(name=name, user=self._user).ref |
| 250 | |
| 251 | if self._prefix: |
| 252 | kvp_key = DATASTORE_KEY_SEPARATOR.join([self._prefix, key]) |
| 253 | else: |
| 254 | kvp_key = key |
| 255 | |
| 256 | value = self._get_kv(kvp_key) |
| 257 | self._value_cache[key] = value |
| 258 | # return a KeyValueLookup as response since the lookup may not be complete e.g. if |
| 259 | # the lookup is for 'key_base.key_value' it is likely that the calling code, e.g. Jinja, |
| 260 | # will expect to do a dictionary style lookup for key_base and key_value as subsequent |
| 261 | # calls. Saving the value in cache avoids extra DB calls. |
| 262 | return UserKeyValueLookup( |
| 263 | prefix=self._prefix, |
| 264 | user=self._user, |
| 265 | key_prefix=key, |
| 266 | cache=self._value_cache, |
| 267 | scope=self._scope, |
| 268 | ) |
| 269 | |
| 270 | def _get_kv(self, key): |
| 271 | scope = self._scope |
no test coverage detected