Changeset 24:dc78a59d357e in mailjam for mailjam/cli.py


Ignore:
Timestamp:
May 22, 2012, 7:57:47 PM (12 years ago)
Author:
Borja Lopez <borja@…>
Branch:
default
Phase:
public
Message:

Added a new XMLRPC method to the mailjam server, lists.info(), which returns
detailed information about a given mailing lists, provided an address.

Added support listing and getting detailed information of mailing lists to
the CLI client

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mailjam/cli.py

    r23 r24  
    8080        self.do_add_mailing_list(line)
    8181
     82    def do_list_mailing_lists(self, line):
     83        """
     84        list_mailing_lists [text]
     85        List the mailing lists available in the remote mailjam server.
     86        If text is provided, only mailing lists whose address contains such
     87        text will be shown. Otherwise all the available email addresses are
     88        listed.
     89
     90        Alias: lml
     91        """
     92        addresses = self.rpc.lists.addresses()       
     93        if not line:
     94            for address in addresses:
     95                print address           
     96        else:
     97            for address in addresses:
     98                if line in address:
     99                    print address
     100
     101    def do_lml(self, line):
     102        """
     103        lml [text]
     104        Alias for the list_mailing_lists command. To learn more type:
     105
     106        help list_mailing_lists
     107        """
     108        self.do_list_mailing_lists(line)
     109
     110    def do_show_mailing_list(self, line):
     111        """
     112        show_mailing_list address
     113        Show detailed information of the mailing list represented by address.
     114
     115        Alias: sml
     116        """
     117        if not line:
     118            print 'usage: show_mailing_list address'
     119        else:
     120            result = self.rpc.lists.info(line)
     121            if isinstance(result, dict):
     122                print 'Mailing list information:'
     123                print ' - name:', result['name']
     124                print ' - address:', result['address']
     125                print ' - members:', result['members']
     126            else:
     127                print result
     128
     129    def do_sml(self, line):
     130        """
     131        sml address
     132        Alias for the show_mailing_list command. To learn more type:
     133
     134        help show_mailing_list
     135        """
     136        self.do_show_mailing_list(line)
     137
    82138    def do_add_mailing_list_member(self, line):
    83139        """
Note: See TracChangeset for help on using the changeset viewer.