mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 06:50:29 +03:00
Make Archive Policy a standard fieldtype too
This commit is contained in:
parent
fb38eb6b8c
commit
fa3a591f15
1 changed files with 5 additions and 12 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue