Manifest
Representation of the “manifest.xml” part.
Classes:
| Name | Description |
|---|---|
Manifest |
Representation of the “manifest.xml” part. |
Manifest
Bases: XmlPart
Representation of the “manifest.xml” part.
Methods:
| Name | Description |
|---|---|
add_full_path |
Add a new file entry to the manifest, or update an existing one. |
del_full_path |
Delete a file entry from the manifest. |
get_media_type |
Get the media type associated with a specific full path in the manifest. |
get_path_medias |
Get a list of all (full_path, media_type) pairs declared in the manifest. |
get_paths |
Get a list of all full paths ( |
make_file_entry |
Create a new |
set_media_type |
Set the media type for an existing file entry in the manifest. |
Source code in odfdo/manifest.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
_file_entry
_file_entry(full_path: str) -> Element
Internal helper to find a specific manifest:file-entry element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
full_path
|
str
|
The full path of the file entry to find. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Element |
Element
|
The |
Raises:
| Type | Description |
|---|---|
KeyError
|
If the specified |
Source code in odfdo/manifest.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
add_full_path
add_full_path(full_path: str, media_type: str = '') -> None
Add a new file entry to the manifest, or update an existing one.
If a file entry with the given full_path already exists, its media
type is updated. Otherwise, a new manifest:file-entry element is
created and added.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
full_path
|
str
|
The full path of the file to add or update. |
required |
media_type
|
str
|
The media type of the file. |
''
|
Source code in odfdo/manifest.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
del_full_path
del_full_path(full_path: str) -> None
Delete a file entry from the manifest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
full_path
|
str
|
The full path of the file entry to delete. |
required |
Raises:
| Type | Description |
|---|---|
KeyError
|
If the specified |
Source code in odfdo/manifest.py
147 148 149 150 151 152 153 154 155 156 157 | |
get_media_type
get_media_type(full_path: str) -> str | None
Get the media type associated with a specific full path in the manifest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
full_path
|
str
|
The full path of the file entry. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
str | None: The media type string, or |
Source code in odfdo/manifest.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
get_path_medias
get_path_medias() -> list[tuple[str | None, str | None]]
Get a list of all (full_path, media_type) pairs declared in the manifest.
Returns:
| Type | Description |
|---|---|
list[tuple[str | None, str | None]]
|
list[tuple[str | None, str | None]]: A list of tuples, where each
tuple contains the full path and its corresponding media type.
Attribute values can be |
Source code in odfdo/manifest.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
get_paths
get_paths() -> list[str]
Get a list of all full paths (manifest:full-path) declared in the manifest.
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: A list of strings, where each string is a full path. |
Source code in odfdo/manifest.py
33 34 35 36 37 38 39 40 | |
make_file_entry
staticmethod
make_file_entry(full_path: str, media_type: str) -> Element
Create a new manifest:file-entry element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
full_path
|
str
|
The full path for the file entry. |
required |
media_type
|
str
|
The media type for the file entry. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Element |
Element
|
A new |
Source code in odfdo/manifest.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
set_media_type
set_media_type(full_path: str, media_type: str) -> None
Set the media type for an existing file entry in the manifest.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
full_path
|
str
|
The full path of the file entry. |
required |
media_type
|
str
|
The new media type to set. |
required |
Source code in odfdo/manifest.py
101 102 103 104 105 106 107 108 109 | |