コード例 #1
0
ファイル: synchronizer.py プロジェクト: nuxeo/nuxeo-otg
    def pull(self, path, is_new):
        qualifier = 'new ' if is_new else ''
        notify("", "Pulling %sfile from server" % qualifier, path)

        info = self.remote_client.get_state(path)
        if info is None:
            # operation was triggered on deprecated info
            local_info = self.local_client.get_state(path)
            if local_info is None:
                # deleted on both sides, cleanup the metadata record
                self.storage.delete_state(self.binding, path)
            else:
                # content has been deleted: perform a delete instead
                self.delete_local(path)
        else:
            # transfer the content
            if info.type == 'folder':
                self.local_client.mkdir(path)
            else:
                content = self.remote_client.get_content(path)
                if is_new:
                    self.local_client.mkfile(path, content)
                else:
                    self.local_client.update(path, content)

            # update the metadata
            state = self.storage.get_state(self.binding, path)
            state.set_state('local', 'synchronized')
            state.set_state('remote', 'synchronized')
            new_info = self.local_client.get_state(path)
            state.set_info('local', new_info)
            self.storage.set_state(self.binding, state)
コード例 #2
0
ファイル: test_notify.py プロジェクト: nuxeo/nuxeo-otg
 def test(self):
     notification.notify("Test", "Title", "Message")
コード例 #3
0
ファイル: synchronizer.py プロジェクト: nuxeo/nuxeo-otg
 def delete_local(self, path):
     notify("", "Deleting local file", path)
     self.local_client.delete(path)
     self.storage.delete_state(self.binding, path)
コード例 #4
0
ファイル: synchronizer.py プロジェクト: nuxeo/nuxeo-otg
 def delete_remote(self, path):
     notify("", "Deleting remote file", path)
     self.remote_client.delete(path)
     self.storage.delete_state(self.binding, path)