Mercurial > libervia-backend
comparison frontends/src/jp/cmd_pubsub.py @ 2539:dcc77f23e370
jp (base): add --max option:
when MULTI_ITEMS is set, --max options is automatically added, except if NO_MAX flag is set.
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 29 Mar 2018 08:59:38 +0200 |
parents | 772447ec070f |
children | 1d754bc14381 |
comparison
equal
deleted
inserted
replaced
2538:0a22dc80d671 | 2539:dcc77f23e370 |
---|---|
526 self.need_loop=True | 526 self.need_loop=True |
527 | 527 |
528 def add_parser_options(self): | 528 def add_parser_options(self): |
529 self.parser.add_argument("-S", "--sub-id", type=base.unicode_decoder, default=u'', | 529 self.parser.add_argument("-S", "--sub-id", type=base.unicode_decoder, default=u'', |
530 help=_(u"subscription id")) | 530 help=_(u"subscription id")) |
531 self.parser.add_argument("-m", "--max", type=int, default=10, help=_(u"maximum number of items to get ({} to get all items)".format(C.NO_LIMIT))) | |
532 # TODO: a key(s) argument to select keys to display | 531 # TODO: a key(s) argument to select keys to display |
533 # TODO: add MAM filters | 532 # TODO: add MAM filters |
534 | 533 |
535 | 534 |
536 def psItemsGetCb(self, ps_result): | 535 def psItemsGetCb(self, ps_result): |
740 """this command to a search without using MAM, i.e. by checking every items if dound by itself, so it may be heavy in resources both for server and client""" | 739 """this command to a search without using MAM, i.e. by checking every items if dound by itself, so it may be heavy in resources both for server and client""" |
741 RE_FLAGS = re.MULTILINE | re.UNICODE | 740 RE_FLAGS = re.MULTILINE | re.UNICODE |
742 EXEC_ACTIONS = (u'exec', u'external') | 741 EXEC_ACTIONS = (u'exec', u'external') |
743 | 742 |
744 def __init__(self, host): | 743 def __init__(self, host): |
745 base.CommandBase.__init__(self, host, 'search', use_output=C.OUTPUT_XML, use_pubsub=True, pubsub_flags={C.MULTI_ITEMS}, | 744 base.CommandBase.__init__(self, host, 'search', use_output=C.OUTPUT_XML, use_pubsub=True, pubsub_flags={C.MULTI_ITEMS, C.NO_MAX}, |
746 use_verbose=True, help=_(u'search items corresponding to filters')) | 745 use_verbose=True, help=_(u'search items corresponding to filters')) |
747 self.need_loop=True | 746 self.need_loop=True |
748 | 747 |
749 @property | 748 @property |
750 def etree(self): | 749 def etree(self): |