chiark / gitweb /
Fix tests by not checking private attributes
authorDaniel Martí <mvdan@mvdan.cc>
Thu, 3 Dec 2015 18:31:20 +0000 (19:31 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Thu, 3 Dec 2015 18:31:20 +0000 (19:31 +0100)
All attrs starting with '_' (e.g. _foo or __bar) are used internally, so
not very relevant for the metadata test anyway.

fdroidserver/metadata.py

index bcc410968a38efe510a94ddfca62a9582f828ba3..e31cf364f26323c4e4cfbda228953b71f1ca420e 100644 (file)
@@ -162,10 +162,11 @@ class App():
             if k == 'builds':
                 d['builds'] = []
                 for build in v:
-                    d['builds'].append(build.__dict__)
-            else:
-                k = App.attr_to_field(k)
-                d[k] = v
+                    b = {k: v for k, v in build.__dict__.iteritems() if not k.startswith('_')}
+                    d['builds'].append(b)
+            elif not k.startswith('_'):
+                f = App.attr_to_field(k)
+                d[f] = v
         return d
 
     # Gets the value associated to a field name, e.g. 'Auto Name'