We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b66b6b8 commit 1121d0bCopy full SHA for 1121d0b
examples/example1/main.py
@@ -5,6 +5,20 @@
5
from backend_c import BackendC
6
7
8
+from dsync import Diff
9
+
10
11
+class MyDiff(Diff):
12
+ """Custom Diff class to control the order of the site objects"""
13
14
+ @classmethod
15
+ def order_children_site(cls, children):
16
+ """Return the site children ordered in alphabetical order."""
17
+ keys = sorted(children.keys(), reverse=False)
18
+ for key in keys:
19
+ yield children[key]
20
21
22
def main():
23
"""Demonstrate DSync behavior using the example backends provided."""
24
# pylint: disable=invalid-name
@@ -18,7 +32,7 @@ def main():
32
c = BackendC()
33
c.load()
34
- diff_a_b = a.diff_to(b)
35
+ diff_a_b = a.diff_to(b, diff_class=MyDiff)
36
diff_a_b.print_detailed()
37
38
a.sync_to(b)
0 commit comments