set "accepted formats" for metadata in config.py

For a bit repo like f-droid.org, it makes sense to standardize on a single
format for metadata files.  This adds support for enforcing a single data
format, or a reduced set of data formats.  So f-droid.org would run like
this if it changed to YAML:

  accepted_formats = ['txt', 'yaml']

Then once everything was converted to YAML, it could look like this:

  accepted_formats = ['yaml']
This commit is contained in:
Hans-Christoph Steiner 2015-08-27 11:43:17 +02:00
parent 19ac44c189
commit 325db90918
4 changed files with 37 additions and 19 deletions

View file

@ -29,11 +29,12 @@ class MetadataTest(unittest.TestCase):
self.maxDiff = None
# these only need to be set to prevent code running on None. The
# values are not used in metadata.py
# these need to be set to prevent code running on None, only
# 'accepted_formats' is actually used in metadata.py
config = dict()
config['sdk_path'] = '/opt/android-sdk'
config['ndk_paths'] = dict()
config['accepted_formats'] = ['json', 'txt', 'xml', 'yaml']
fdroidserver.common.config = config
apps = fdroidserver.metadata.read_metadata(xref=True)