Example #1
0
    def resync_change_list(self, filenames):
        c = ResourceSyncPublisherClient(checksum=True)
        args = [self.config.cfg_urlprefix(), self.config.cfg_resource_dir()]
        c.set_mappings(args)
        cl_path = os.path.join(self.config.cfg_resync_dir(), CHANGELIST_XML)
        cl = c.calculate_changelist(
            paths=self.data,
            resource_sitemap=self.get_existing_resync_file(RESOURCELIST_XML),
            changelist_sitemap=self.get_existing_resync_file(CHANGELIST_XML),
            outfile=cl_path)
        # the calculating should be done in resync_a, not in the GUI
        file_count = len(filenames)
        created_count = 0
        updated_count = 0

        for resource in cl.resources:
            if resource.change == "created":
                created_count += 1
            elif resource.change == "updated":
                updated_count += 1

        # this is not the correct computation..
        unchanged_count = file_count - created_count - updated_count

        overview_data = [(_("total"), str(file_count), str(created_count),
                          str(updated_count), str(unchanged_count))]
        self.overview_model.setNewData(overview_data)
Example #2
0
    def resync_change_list(self, filenames):
        c = ResourceSyncPublisherClient(checksum=True)
        args = [self.config.cfg_urlprefix(), self.config.cfg_resource_dir()]
        c.set_mappings(args)
        cl_path = os.path.join(self.config.cfg_resync_dir(), CHANGELIST_XML)
        cl = c.calculate_changelist(
            paths=self.data,
            resource_sitemap=self.get_existing_resync_file(RESOURCELIST_XML),
            changelist_sitemap=self.get_existing_resync_file(CHANGELIST_XML),
            outfile=cl_path,
        )
        # the calculating should be done in resync_a, not in the GUI
        file_count = len(filenames)
        created_count = 0
        updated_count = 0

        for resource in cl.resources:
            if resource.change == "created":
                created_count += 1
            elif resource.change == "updated":
                updated_count += 1

        # this is not the correct computation..
        unchanged_count = file_count - created_count - updated_count

        overview_data = [(_("total"), str(file_count), str(created_count), str(updated_count), str(unchanged_count))]
        self.overview_model.setNewData(overview_data)
Example #3
0
 def resync_resource_list(self):
     c = ResourceSyncPublisherClient(checksum=True)
     args = [self.config.cfg_urlprefix(), self.config.cfg_resource_dir()]
     c.set_mappings(args)
     rl = c.build_resource_list(paths=self.data)
     overview_data = [(_("total"), str(len(rl)), str(len(rl)), str(0), str(0))]
     self.overview_model.setNewData(overview_data)
     rl_path = os.path.join(self.config.cfg_resync_dir(), RESOURCELIST_XML)
     rl.write(rl_path)
Example #4
0
 def resync_resource_list(self):
     c = ResourceSyncPublisherClient(checksum=True)
     args = [self.config.cfg_urlprefix(), self.config.cfg_resource_dir()]
     c.set_mappings(args)
     rl = c.build_resource_list(paths=self.data)
     overview_data = [(_("total"), str(len(rl)), str(len(rl)), str(0),
                       str(0))]
     self.overview_model.setNewData(overview_data)
     rl_path = os.path.join(self.config.cfg_resync_dir(), RESOURCELIST_XML)
     rl.write(rl_path)