chiark / gitweb /
metadata: store comments in lists since lists are used everywhere else
authorHans-Christoph Steiner <hans@eds.org>
Wed, 22 Jul 2015 18:10:52 +0000 (11:10 -0700)
committerHans-Christoph Steiner <hans@eds.org>
Tue, 1 Sep 2015 09:39:51 +0000 (11:39 +0200)
The only data produced by parsing metadata that was stored as a tuple was
the comments' key/values.  Everywhere else, lists are used.  This changes
the comments to also only use lists to keep the data consistent internally.
That makes it vastly easier to produce the exact same metadata dict when
parsing .txt, JSON, XML, etc.

fdroidserver/metadata.py

index 58b774a3dc65e475a99d7b6a15d5e05127276018..3684b917d7307dfae48296e2ae4b27cd6dab85dd 100644 (file)
@@ -604,7 +604,7 @@ def post_metadata_parse(thisinfo):
 #  'builds'           - a list of dictionaries containing build information
 #                       for each defined build
 #  'comments'         - a list of comments from the metadata file. Each is
-#                       a tuple of the form (field, comment) where field is
+#                       a list of the form [field, comment] where field is
 #                       the name of the field it preceded in the metadata
 #                       file. Where field is None, the comment goes at the
 #                       end of the file. Alternatively, 'build:version' is
@@ -769,7 +769,7 @@ def parse_txt_metadata(metafile):
         if not curcomments:
             return
         for comment in curcomments:
-            thisinfo['comments'].append((key, comment))
+            thisinfo['comments'].append([key, comment])
         del curcomments[:]
 
     thisinfo = get_default_app_info_list()