mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-13 02:30:11 +01:00
Make Archive Policy a standard fieldtype too
This commit is contained in:
parent
fb38eb6b8c
commit
fa3a591f15
@ -83,6 +83,11 @@ valuetypes = {
|
||||
[ "Bitcoin" ],
|
||||
[ ]),
|
||||
|
||||
'archive' : FieldType("Archive Policy",
|
||||
r'^[0-9]+ versions$', None,
|
||||
[ "Archive Policy" ],
|
||||
[ ]),
|
||||
|
||||
'bool' : FieldType("Boolean",
|
||||
['yes', 'no'], None,
|
||||
[ ],
|
||||
@ -101,8 +106,6 @@ valuetypes = {
|
||||
}
|
||||
|
||||
def check_metadata(info):
|
||||
|
||||
# Generic fields and attributes
|
||||
for k, t in valuetypes.iteritems():
|
||||
for field in [f for f in t.fields if f in info]:
|
||||
t.check(info[field], info['id'])
|
||||
@ -114,16 +117,6 @@ def check_metadata(info):
|
||||
if k == 'bool':
|
||||
info[field] = info[field] == "yes"
|
||||
|
||||
# Special fields
|
||||
if info['Archive Policy']:
|
||||
if not re.match(r'^[0-9]+ versions$', info['Archive Policy']):
|
||||
raise MetaDataException("Invalid archive policy '%s' in %s"
|
||||
% (info['Archive Policy'], info["id"]))
|
||||
versions = int(info['Archive Policy'][:-9])
|
||||
if versions < 1 or versions > 20:
|
||||
raise MetaDataException("Silly number of versions '%s' for archive policy in %s"
|
||||
% (versions, info["id"]))
|
||||
|
||||
# Formatter for descriptions. Create an instance, and call parseline() with
|
||||
# each line of the description source from the metadata. At the end, call
|
||||
# end() and then text_plain, text_wiki and text_html will contain the result.
|
||||
|
Loading…
Reference in New Issue
Block a user