snose

Check-in [2f57297d12]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixes from 1fe8adea90

Blindly copy/pasted. Some were name not filename

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | master
Files: files | file ages | folders
SHA3-256: 2f57297d1229fe91c334edd21d44c6b5ce97cf3a4015fa6849149ed4fb1039c2
User & Date: simon 2018-10-13 12:03:06
Context
2018-10-13
12:26
Improve regex for filename matching and exit properly if none found check-in: cf115f6116 user: simon tags: trunk, master
12:03
Fixes from 1fe8adea90

Blindly copy/pasted. Some were name not filename check-in: 2f57297d12 user: simon tags: trunk, master

10:57
I give in - switch to spaces instead of tabs check-in: 5dee798315 user: simon tags: trunk, master
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to snose.py.

293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
...
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
                            #Get returned metadata
                            snose[name]['version'] = returned[0]['version']
                            snose[name]['modifydate'] = sysmodifydate #Use local value to avoid differences in accuracy (decimal places. etc) between local and remote timestamps
                            #Update local file if merged content
                            if 'content' in returned[0]:
                                try:
                                    if sys.version_info < (3, 0):
                                        with open(filename, 'w') as f:
                                            f.write(returned[0]['content'].encode("utf-8"))
                                    else:
                                        with open(filename, 'w', encoding="utf-8") as f:
                                            f.write(returned[0]['content'])
                                    print("Merged local content for %s" % name)
                                    #Override the returned value? As otherwise next sync will immediately update the remote version for no reason.
                                    snose[name]['modifydate'] = os.path.getmtime(name) 
                                except IOError as e:
                                    print("Failed to merge content locally for %s" % name)
                                    print("Therefore skipping updating the index for this note")#I think this is a good idea?
................................................................................
                if remote[0]['version'] > local['version']:
                    if not dry:
                        try: 
                            if sys.version_info < (3, 0):
                                with open(name, 'w') as f:
                                    f.write(remote[0]['content'].encode("utf-8"))
                            else:
                                with open(filename, 'w', encoding="utf-8") as f:
                                    f.write(remote[0]['content'])
                            print("Updated local version of %s" % name)
                        except IOError as e:
                            print("Failed to update local note %s with remote content" % name)
                            print("Will not updatet the .snose index file for this file")
                        else:
                            #Also update .snose index







|


|







 







|







293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
...
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
                            #Get returned metadata
                            snose[name]['version'] = returned[0]['version']
                            snose[name]['modifydate'] = sysmodifydate #Use local value to avoid differences in accuracy (decimal places. etc) between local and remote timestamps
                            #Update local file if merged content
                            if 'content' in returned[0]:
                                try:
                                    if sys.version_info < (3, 0):
                                        with open(name, 'w') as f:
                                            f.write(returned[0]['content'].encode("utf-8"))
                                    else:
                                        with open(name, 'w', encoding="utf-8") as f:
                                            f.write(returned[0]['content'])
                                    print("Merged local content for %s" % name)
                                    #Override the returned value? As otherwise next sync will immediately update the remote version for no reason.
                                    snose[name]['modifydate'] = os.path.getmtime(name) 
                                except IOError as e:
                                    print("Failed to merge content locally for %s" % name)
                                    print("Therefore skipping updating the index for this note")#I think this is a good idea?
................................................................................
                if remote[0]['version'] > local['version']:
                    if not dry:
                        try: 
                            if sys.version_info < (3, 0):
                                with open(name, 'w') as f:
                                    f.write(remote[0]['content'].encode("utf-8"))
                            else:
                                with open(name, 'w', encoding="utf-8") as f:
                                    f.write(remote[0]['content'])
                            print("Updated local version of %s" % name)
                        except IOError as e:
                            print("Failed to update local note %s with remote content" % name)
                            print("Will not updatet the .snose index file for this file")
                        else:
                            #Also update .snose index