Closed jmcclelland closed 11 years ago
I have a functional fix here:
However, I don't think it's the right fix. It might be better to fix ui.py so when merging, the etag and status are properly set when the update function is called? However, I'm not sure how to get the etag from ui.py.
thanks for letting me know, sadly I won't have time to look at this until next week
I went ahead and let VCard know its etag so it can be set during update. the bug should be fixed no, if the bug persists, please reopen this bug
Thanks for changes!
Unfortunately,I'm still having problems. :(.
I see that you are using INSERT OR REPLACE INTO when updating account records, however, there is no primary key defined in the account table, so those always insert a new record with an empty etag. Then, updating with the server sees the empty etag and inserts a duplicate on every sync.
Unfortunately it appears as though you cannot add a primary key to an existing sqlite table so I just dumped my database, added the primary key in the dump and then re-create my sqlite database from the dump.
I've patched the code to add the primary key on new table creation.
In addition, we now have the etag on update, but the status is still hard-coded to NEW. I've fixed that as well by shoving a new attribute into the EditorPane class. Maybe there is a more elegant way? In any event, it seems to work.
Here's the patch: https://git.mayfirst.org/?p=jamie/pycarddav.git;a=commitdiff;h=9fd5504a518b07a130f773bd4531b63c69e7f9bd
looks like I was in a bit of a rush to close this bug…
thanks for the patch, please add yourself to the CONTRIBUTORS.txt file
merged. Thanks again!
When you merge a vcard with an existing vcard, the etag is set to empty (as if it was a new vcard). As a result, when sync'ing with the server, it is overwritten by the version on the server.