trestle.common.trash
trestle.common.trash
¤
Trestle trash module.
Attributes¤
TRESTLE_TRASH_DIR = '.trestle/_trash/'
module-attribute
¤
TRESTLE_TRASH_DIR_EXT = '__bk'
module-attribute
¤
TRESTLE_TRASH_FILE_EXT = '.bk'
module-attribute
¤
Functions¤
get_trash_root(path)
¤
Find the trestle trash root path.
Source code in trestle/common/trash.py
62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
has_parent_path(sub_path, parent_path)
¤
Check if sub_path has the specified parent_dir path.
Source code in trestle/common/trash.py
219 220 221 222 223 224 225 226 227 228 |
|
recover(dest_content_path, delete_trash=False)
¤
Recover the specified file or directory from the trash directory.
dest_content_path: destination content path that needs to be recovered from trash It recovers the latest path content from trash if exists
Source code in trestle/common/trash.py
208 209 210 211 212 213 214 215 216 |
|
recover_dir(dest_dir_path, delete_trash=False)
¤
Move the specified dir from the trash directory.
dest_dir_path: destination path of the directory inside a trestle workspace
It recovers the latest directory and contents from trash if exists
Source code in trestle/common/trash.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
recover_file(file_path, delete_trash=False)
¤
Recover the specified file from the trash directory.
It recovers the latest file from trash if exists
Source code in trestle/common/trash.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
store(content_path, delete_content=False)
¤
Move the specified file or directory to the trash directory.
It overwrites the previous file or directory if exists
Source code in trestle/common/trash.py
159 160 161 162 163 164 165 166 167 |
|
store_dir(dir_path, delete_source=False)
¤
Move the specified dir to the trash directory.
It overwrites the previous directory and contents if exists
Source code in trestle/common/trash.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
store_file(file_path, delete_source=False)
¤
Move the specified file to the trash directory.
It overwrites the previous file if exists
Source code in trestle/common/trash.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
to_origin_dir_path(trash_dir_path)
¤
Convert trash content path to origin path.
Source code in trestle/common/trash.py
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 |
|
to_origin_file_path(trash_file_path)
¤
Convert trash file path to origin file path.
Source code in trestle/common/trash.py
105 106 107 108 109 110 111 112 113 114 |
|
to_origin_path(trash_content_path)
¤
Convert the trash path to origin path.
Source code in trestle/common/trash.py
117 118 119 120 121 |
|
to_trash_dir_path(dir_path)
¤
Construct the path to the trashed file.
Source code in trestle/common/trash.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
to_trash_file_path(file_path)
¤
Construct the path to the trashed file.
Source code in trestle/common/trash.py
47 48 49 50 51 52 |
|
to_trash_path(path)
¤
Convert the dir or file path to apporpriate trash file or dir path.
Source code in trestle/common/trash.py
55 56 57 58 59 |
|
handler: python