chiark / gitweb /
Add inline python docs
authorDaniel Martí <mvdan@mvdan.cc>
Tue, 19 Nov 2013 15:04:35 +0000 (16:04 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Tue, 19 Nov 2013 15:04:35 +0000 (16:04 +0100)
fdroidserver/metadata.py

index 904dd134f153f4dbda59b60e236788e1c02a88bf..90ab900339040a667b35f2d48fb2ff02f3ec80b5 100644 (file)
@@ -27,6 +27,14 @@ class MetaDataException(Exception):
     def __str__(self):
         return repr(self.value)
 
+# Designates a metadata field type and checks that it matches 
+#
+# 'name'     - The long name of the field type
+# 'matching' - List of possible values or regex expression
+# 'sep'      - Separator to use if value may be a list
+# 'fields'   - Metadata fields (Field:Value) of this type
+# 'attrs'    - Build attributes (attr=value) of this type
+#
 class FieldType():
     def __init__(self, name, matching, sep, fields, attrs):
         self.name = name
@@ -63,6 +71,7 @@ class FieldType():
             self._assert_regex(values, appid)
 
 
+# Generic value types
 valuetypes = {
     'int' : FieldType("Integer",
         r'^[0-9]+$', None,
@@ -102,9 +111,10 @@ valuetypes = {
     'antifeatures' : FieldType("Anti-Feature",
         [ "Ads", "Tracking", "NonFreeNet", "NonFreeDep", "NonFreeAdd" ], ',',
         [ "AntiFeatures" ],
-        [ ]),
+        [ ])
 }
 
+# Check an app's metadata information for integrity errors
 def check_metadata(info):
     for k, t in valuetypes.iteritems():
         for field in t.fields: