Merge branch 'range-example' into 'master'

Set datatype and range for settings fields

See merge request sjehuda/slixfeed!6
This commit is contained in:
Schimon Jehudah 2024-02-14 16:15:52 +00:00
commit 5c2ee8d51c
2 changed files with 5 additions and 0 deletions

View file

@ -127,6 +127,7 @@ class JabberClient:
def __init__(self, jid, password, hostname=None, port=None, alias=None):
xmpp = Slixfeed(jid, password, hostname, port, alias)
xmpp.register_plugin('xep_0004') # Data Forms
xmpp.register_plugin('xep_0122') # Data Forms Validation
xmpp.register_plugin('xep_0030') # Service Discovery
xmpp.register_plugin('xep_0045') # Multi-User Chat
xmpp.register_plugin('xep_0048') # Bookmarks

View file

@ -1018,6 +1018,8 @@ class Slixfeed(slixmpp.ClientXMPP):
label='Archive',
desc='Number of news items to archive.',
value=value)
options['validate']['datatype'] = 'xs:integer'
options['validate']['range'] = { 'minimum': 0, 'maximum': 500 }
i = 0
while i <= 500:
x = str(i)
@ -1031,6 +1033,8 @@ class Slixfeed(slixmpp.ClientXMPP):
label='Amount',
desc='Set amount of items per update.',
value=value)
options['validate']['datatype'] = 'xs:integer'
options['validate']['range'] = { 'minimum': 1, 'maximum': 5 }
i = 1
while i <= 5:
x = str(i)