コード例 #1
0
def inifile(site_path, junk_ini, my_plugin_id,
            pagination_enabled, month_index_enabled):
    # Make a temporary copy of our .ini file
    config_name = '%s.ini' % my_plugin_id
    orig_ini = site_path / 'configs' / config_name
    inifile = IniFile(str(orig_ini))
    inifile.filename = str(junk_ini)

    def yesno(val):
        return 'yes' if val else 'no'

    inifile['pagination.enabled'] = yesno(pagination_enabled)
    if not month_index_enabled:
        del inifile['year-index.subindex']

    if not isinstance(pagination_enabled, bool):
        inifile['pagination.per_page'] = pagination_enabled
    return inifile
コード例 #2
0
 def inifile(self, test_ini):
     inifile = IniFile(str(test_ini))
     inifile.filename = '/dev/null'
     return inifile