2015-12-19 14:52:17 +01:00
|
|
|
title: lookup
|
|
|
|
---
|
|
|
|
type: method
|
|
|
|
---
|
|
|
|
signature: key
|
|
|
|
---
|
|
|
|
summary: Looks up data from databags.
|
|
|
|
---
|
|
|
|
body:
|
|
|
|
|
|
|
|
This is the most common way to look up values from databags from regular
|
|
|
|
Python code. Within templates you can also use the [bag
|
|
|
|
:ref](../../templates/globals/bag/) function which is easier to call.
|
|
|
|
|
|
|
|
The key is in dotted notation. For more information about this refer
|
|
|
|
to the main [databags :ref](../) documentation.
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
```python
|
|
|
|
def translate(pad, alt, key):
|
2022-02-24 16:20:01 +01:00
|
|
|
return pad.databags.lookup('i18n.%s.%s' % (alt, key), key)
|
2015-12-19 14:52:17 +01:00
|
|
|
```
|