コード例 #1
0
        def scan_listing(listing_map):
            for encoded_relpath_u in listing_map.keys():
                relpath_u = magicpath.magic2path(encoded_relpath_u)
                self._log("found %r" % (relpath_u,))

                file_node, metadata = listing_map[encoded_relpath_u]
                local_dbentry = self._get_local_latest(relpath_u)

                # XXX FIXME this is *awefully* similar to
                # _should_download code in function etc -- can we
                # share?
                remote_version = metadata.get('version', None)
                remote_uri = file_node.get_readonly_uri()
                self._log("%r has local dbentry %r, remote version %r, remote uri %r"
                          % (relpath_u, local_dbentry, remote_version, remote_uri))

                if (local_dbentry is None or remote_version is None or
                    local_dbentry.version < remote_version or
                    (local_dbentry.version == remote_version and local_dbentry.last_downloaded_uri != remote_uri)):
                    self._log("%r added to download queue" % (relpath_u,))
                    if scan_batch.has_key(relpath_u):
                        scan_batch[relpath_u] += [(file_node, metadata)]
                    else:
                        scan_batch[relpath_u] = [(file_node, metadata)]
            self._status_reporter(
                True, 'Magic folder is working',
                'Last scan: %s' % self.nice_current_time(),
            )
コード例 #2
0
        def scan_listing(listing_map):
            for encoded_relpath_u in listing_map.keys():
                relpath_u = magicpath.magic2path(encoded_relpath_u)
                self._log("found %r" % (relpath_u,))

                file_node, metadata = listing_map[encoded_relpath_u]
                local_version = self._get_local_latest(relpath_u)
                remote_version = metadata.get('version', None)
                self._log("%r has local version %r, remote version %r" % (relpath_u, local_version, remote_version))

                if local_version is None or remote_version is None or local_version < remote_version:
                    self._log("%r added to download queue" % (relpath_u,))
                    if scan_batch.has_key(relpath_u):
                        scan_batch[relpath_u] += [(file_node, metadata)]
                    else:
                        scan_batch[relpath_u] = [(file_node, metadata)]
コード例 #3
0
        def scan_listing(listing_map):
            for encoded_relpath_u in listing_map.keys():
                relpath_u = magicpath.magic2path(encoded_relpath_u)
                self._log("found %r" % (relpath_u, ))

                file_node, metadata = listing_map[encoded_relpath_u]
                local_version = self._get_local_latest(relpath_u)
                remote_version = metadata.get('version', None)
                self._log("%r has local version %r, remote version %r" %
                          (relpath_u, local_version, remote_version))

                if local_version is None or remote_version is None or local_version < remote_version:
                    self._log("%r added to download queue" % (relpath_u, ))
                    if scan_batch.has_key(relpath_u):
                        scan_batch[relpath_u] += [(file_node, metadata)]
                    else:
                        scan_batch[relpath_u] = [(file_node, metadata)]
            self._status_reporter(
                True,
                'Magic folder is working',
                'Last scan: %s' % self.nice_current_time(),
            )
コード例 #4
0
 def test_magic2path(self):
     for expected, test in self.tests.items():
         self.failUnlessEqual(magicpath.magic2path(test), expected)
コード例 #5
0
 def test_magic2path(self):
     for expected, test in self.tests.items():
         self.failUnlessEqual(magicpath.magic2path(test), expected)