Commit 35951a9
committed
refactor: move XML builders to BaseDAVClient, delete protocol/ package
All XML request-body builder functions are now static methods on
BaseDAVClient so both DAVClient (sync) and AsyncDAVClient (async)
inherit the same implementations:
_build_propfind_body, _build_proppatch_body,
_build_calendar_query_body, _build_calendar_multiget_body,
_build_sync_collection_body, _build_mkcalendar_body
The _prop_name_to_element helper is a module-level function in
base_client.py called by the builders.
Updated callers:
- async_davclient.py: dropped protocol.xml_builders import; uses
self._build_* throughout (propfind, calendar_query, calendar_multiget,
sync_collection)
- davclient.py: dropped late import in propfind(); uses
self._build_propfind_body
- collection.py: both sync and async synchronize() now call
self.client._build_sync_collection_body() instead of building the
sync-collection element tree inline
The caldav/protocol/ package is now empty and deleted entirely.
test_protocol.py imports the builders directly from BaseDAVClient.
prompt: move xml builders to the dav base client, and ensure sync and async code paths uses the same builder methods
AI Prompts:
claude-sonnet-4-6: For the xml building, do some more research: why is this needed for the async davclient, but not for the sync davclient? The async and sync davclient classes should be as similar as possible, and all non-IO-related logic should be consolidated. I don't think it needs a separate directory for xmlbuilding logic though. Would it make sense moving it to the davclient baseclass? Where else in the code do we build XML structures? Can things be consolidated further? If we are to have an xmlbuilder.py or something, then it xml building logic from everywhere should be moved/consolidated into that file.
claude-sonnet-4-6: move xml builders to the dav base client, and ensure sync and async code paths uses the same builder methods1 parent 648d3ca commit 35951a9
7 files changed
Lines changed: 200 additions & 405 deletions
File tree
- caldav
- protocol
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | 74 | | |
81 | 75 | | |
82 | 76 | | |
| |||
548 | 542 | | |
549 | 543 | | |
550 | 544 | | |
551 | | - | |
| 545 | + | |
552 | 546 | | |
553 | 547 | | |
554 | 548 | | |
| |||
750 | 744 | | |
751 | 745 | | |
752 | 746 | | |
753 | | - | |
| 747 | + | |
754 | 748 | | |
755 | 749 | | |
756 | 750 | | |
| |||
788 | 782 | | |
789 | 783 | | |
790 | 784 | | |
791 | | - | |
| 785 | + | |
792 | 786 | | |
793 | 787 | | |
794 | 788 | | |
| |||
821 | 815 | | |
822 | 816 | | |
823 | 817 | | |
824 | | - | |
| 818 | + | |
825 | 819 | | |
826 | 820 | | |
827 | 821 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
15 | 20 | | |
16 | 21 | | |
17 | 22 | | |
| |||
26 | 31 | | |
27 | 32 | | |
28 | 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 | + | |
29 | 70 | | |
30 | 71 | | |
31 | 72 | | |
| |||
196 | 237 | | |
197 | 238 | | |
198 | 239 | | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
204 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
205 | 382 | | |
206 | 383 | | |
207 | 384 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1800 | 1800 | | |
1801 | 1801 | | |
1802 | 1802 | | |
1803 | | - | |
1804 | | - | |
1805 | | - | |
1806 | | - | |
1807 | | - | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
1808 | 1806 | | |
1809 | 1807 | | |
1810 | 1808 | | |
| |||
1931 | 1929 | | |
1932 | 1930 | | |
1933 | 1931 | | |
1934 | | - | |
1935 | | - | |
1936 | | - | |
1937 | | - | |
1938 | | - | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
1939 | 1935 | | |
1940 | 1936 | | |
1941 | 1937 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
703 | 703 | | |
704 | 704 | | |
705 | 705 | | |
706 | | - | |
707 | | - | |
708 | 706 | | |
709 | 707 | | |
710 | 708 | | |
711 | 709 | | |
712 | | - | |
| 710 | + | |
713 | 711 | | |
714 | 712 | | |
715 | 713 | | |
| |||
This file was deleted.
0 commit comments