Render¶
render
¶
Functions:
| Name | Description |
|---|---|
format_datetime |
Format a datetime as a string using the configured datetime format. |
human_readable |
Convert a value to a human-readable string. |
print_error |
Print a styled error message to the terminal in red. |
print_success |
Print a styled success message to the terminal in green. |
print_warning |
Print a styled warning message to the terminal in yellow. |
render_boolean |
Render a boolean as a check symbol or an empty string. |
render_maintainers |
Render maintainer GitHub avatars as inline HTML image links. |
render_markdown_table |
Render a plain Markdown table from a header row and data rows. |
render_table |
Render a list of rows as a GitHub-flavoured Markdown table. |
sanitize_cell |
Collapse internal whitespace in a table cell value. |
format_datetime
¶
human_readable
¶
Convert a value to a human-readable string.
Booleans become yes/no; collections are joined; strings are optionally
truncated to a maximum width.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Any
|
Value to render. |
required |
|
str
|
Separator used to join collection items. Defaults to ", ". |
', '
|
|
Optional[int]
|
If provided, truncate the result to this many characters. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
Human-readable string representation of raw. |
Source code in oops/utils/render.py
print_error
¶
print_success
¶
print_warning
¶
render_boolean
¶
render_maintainers
¶
Render maintainer GitHub avatars as inline HTML image links.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
dict
|
Odoo manifest dict containing an optional "maintainers" list of GitHub usernames. |
required |
Returns:
| Type | Description |
|---|---|
str
|
HTML string of circular avatar |
str
|
or an empty string if no maintainers are listed. |
Source code in oops/utils/render.py
render_markdown_table
¶
Render a plain Markdown table from a header row and data rows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
List[str]
|
List of column header strings. |
required |
|
List[List[str]]
|
List of rows, where each row is a list of cell strings. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Markdown table string with a separator row after the header. |
Source code in oops/utils/render.py
render_table
¶
render_table(rows: List[List[Any]], headers: Optional[List[str]] = None, index: bool = False) -> str
Render a list of rows as a GitHub-flavoured Markdown table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
List[List[Any]]
|
List of row data, where each row is a list of cell values. |
required |
|
Optional[List[str]]
|
Optional column header labels. |
None
|
|
bool
|
If True, prepend a numeric row index. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted Markdown table string. |