mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 23:10:29 +03:00
Represent multiline fields as str, not list
Only keep lists in metadata files in the json format, since they don't support multiline strings that are readable. This makes the internal code easier, and a bit faster.
This commit is contained in:
parent
c8cc054c8b
commit
088929711c
6 changed files with 5952 additions and 6039 deletions
|
|
@ -107,15 +107,16 @@ def check_regexes(app):
|
|||
for f, checks in regex_checks.iteritems():
|
||||
for m, r in checks:
|
||||
v = app.get_field(f)
|
||||
if type(v) == str:
|
||||
t = metadata.metafieldtype(f)
|
||||
if t == 'multiline':
|
||||
for l in v.splitlines():
|
||||
if m.match(l):
|
||||
yield "%s at line '%s': %s" % (f, l, r)
|
||||
else:
|
||||
if v is None:
|
||||
continue
|
||||
if m.match(v):
|
||||
yield "%s '%s': %s" % (f, v, r)
|
||||
elif type(v) == list:
|
||||
for l in v:
|
||||
if m.match(l):
|
||||
yield "%s at line '%s': %s" % (f, l, r)
|
||||
|
||||
|
||||
def get_lastbuild(builds):
|
||||
|
|
@ -152,8 +153,7 @@ def check_char_limits(app):
|
|||
yield "Summary of length %s is over the %i char limit" % (
|
||||
summ_chars, limits['Summary'])
|
||||
|
||||
desc_charcount = sum(len(l) for l in app.Description)
|
||||
if desc_charcount > limits['Description']:
|
||||
if len(app.Description) > limits['Description']:
|
||||
yield "Description of length %s is over the %i char limit" % (
|
||||
desc_charcount, limits['Description'])
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ def check_duplicates(app):
|
|||
yield "Description '%s' is just the app's summary" % app.Summary
|
||||
|
||||
seenlines = set()
|
||||
for l in app.Description:
|
||||
for l in app.Description.splitlines():
|
||||
if len(l) < 1:
|
||||
continue
|
||||
if l in seenlines:
|
||||
|
|
@ -268,7 +268,7 @@ def check_bulleted_lists(app):
|
|||
validchars = ['*', '#']
|
||||
lchar = ''
|
||||
lcount = 0
|
||||
for l in app.Description:
|
||||
for l in app.Description.splitlines():
|
||||
if len(l) < 1:
|
||||
lcount = 0
|
||||
continue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue