コード例 #1
0
ファイル: extension.py プロジェクト: amiles347/weewx
    def _reorder(self, cfg):
        """Reorder the resultant config_dict"""
        # Patch up the location of any reports so they appear before FTP/RSYNC

        # First, find the FTP or RSYNC reports. This has to be done on the
        # basis of the skin type, rather than the report name, in case there
        # are multiple FTP or RSYNC reports to be run.
        try:
            for report in self.config_dict['StdReport'].sections:
                if self.config_dict['StdReport'][report]['skin'] in [
                        'Ftp', 'Rsync'
                ]:
                    target_name = report
                    break
            else:
                # No FTP or RSYNC. Nothing to do.
                return
        except KeyError:
            return

        # Now shuffle things so any reports that appear in the extension appear
        # just before FTP (or RSYNC) and in the same order they appear in the
        # extension manifest.
        try:
            for report in cfg['StdReport']:
                weecfg.reorder_sections(self.config_dict['StdReport'], report,
                                        target_name)
        except KeyError:
            pass
コード例 #2
0
ファイル: extension.py プロジェクト: amiles347/weewx
    def _reorder(self, cfg):
        """Reorder the resultant config_dict"""
        # Patch up the location of any reports so they appear before FTP/RSYNC

        # First, find the FTP or RSYNC reports. This has to be done on the
        # basis of the skin type, rather than the report name, in case there
        # are multiple FTP or RSYNC reports to be run.
        try:
            for report in self.config_dict["StdReport"].sections:
                if self.config_dict["StdReport"][report]["skin"] in ["Ftp", "Rsync"]:
                    target_name = report
                    break
            else:
                # No FTP or RSYNC. Nothing to do.
                return
        except KeyError:
            return

        # Now shuffle things so any reports that appear in the extension appear
        # just before FTP (or RSYNC) and in the same order they appear in the
        # extension manifest.
        try:
            for report in cfg["StdReport"]:
                weecfg.reorder_sections(self.config_dict["StdReport"], report, target_name)
        except KeyError:
            pass