~time-drive-devel/time-drive/time-drive.sync

« back to all changes in this revision

Viewing changes to timedrive/realtime.py

  • Committer: Rob Oakes
  • Date: 2012-11-20 20:51:18 UTC
  • Revision ID: rob.oakes@oak-tree.us-20121120205118-vsnczzuitwyp0ma3
Added code to check that background threads are finished before processing their results. Deleting the threads too early was resulting in application crashes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
 
67
67
# Real-Time Sync Operations
68
68
 
 
69
def remoteFolderChanges(sync_collection, sync_backend, db_engine, db_session):
 
70
        '''Check a remote collection for changes'''
 
71
        
 
72
        rd_ = posixpath.join(sync_backend.server_url, sync_collection['Remote-Path'])
 
73
        
 
74
        try: 
 
75
                remote_changes = sync_backend.remoteFolderChanges(sync_collection,
 
76
                        rd_, sync_collection['Local-Path'], db_session)
 
77
                return (sync_collection['Collection-Name'], sync.RT_SUCCESS, rd_), remote_changes
 
78
        
 
79
        except: return (sync_collection['Collection-Name'], sync.RT_FAIL, rd_), []
 
80
 
69
81
def deleteRemoteFile(file_localpath, db_engine, db_session,
70
82
                sync_collection, sync_backend):
71
83
        '''Delete a file from the remote collection'''
98
110
        else: return sync_collection['Collection-Name'], \
99
111
                sync.RT_NOTNEEDED, file_localpath
100
112
 
 
113
 
101
114
def uploadFile(file_localpath, db_engine, db_session, 
102
115
                sync_collection, sync_backend, new_localfile = True):
103
116
        '''Upload a new or updated file to the server'''
167
180
                        sync.RT_SUCCESS, file_localpath
168
181
 
169
182
        # Unable to complete transfer
170
 
        return sync_collection['Collection-Name'], sync.RT_FAIL, file_localpath
171
 
 
172
 
def remoteFolderChanges(rd_, sync_collection, sync_backend):
173
 
        '''Determine which files have changed on the remote server'''
174
 
        pass
 
 
b'\\ No newline at end of file'
 
183
        return sync_collection['Collection-Name'], sync.RT_FAIL, file_localpath
 
 
b'\\ No newline at end of file'