Add -p/--protocol to allow only some protocols to be used. twisty
authorMark Hammond <>
Thu, 12 Mar 2009 22:34:30 +1100
changeset 87 14e5d7be81ff23c6ab69a7f7b44be8511c5a7818
parent 86 021e64e9ecb8fa95f7a15f1590192fa6f4ac96e6
child 88 d3e18d08271bb40fbbf46469b28f0b5c2b370cf0
push id1
push userroot
push dateWed, 08 Apr 2009 01:46:05 +0000
Add -p/--protocol to allow only some protocols to be used.
--- a/server/python/
+++ b/server/python/
@@ -3,16 +3,17 @@
 import sys
 import optparse
 import logging
 from twisted.internet import reactor, defer
 from junius import model
 from junius import bootstrap
+from junius.sync import get_conductor
 logger = logging.getLogger('raindrop')
 class HelpFormatter(optparse.IndentedHelpFormatter):
     def format_description(self, description):
         return description
 # a decorator for our global functions, so they can force other commands
@@ -39,17 +40,16 @@ def install_accounts(result, parser, opt
 def install_files(result, parser, options):
     """Install all local content files into the database"""
     return model.fab_db(update_views=True
 def sync_messages(result, parser, options):
     """Synchronize all messages from all accounts"""
-    from junius.sync import get_conductor
     conductor = get_conductor()
     return conductor.sync(None)
 def _setup_logging(options):
     init_errors = []
     for val in options.log_level: # a list of all --log-level options...
@@ -94,20 +94,27 @@ def main():
     parser.add_option("-l", "--log-level", action="append",
                       help="Specifies either an integer or a logging module "
                            "constant (such as INFO) to set all logs to the "
                            "specified level.  Optionally can be in the format "
                            "of '' to only set the level of the "
                            "specified log.",
+    parser.add_option("-p", "--protocol", action="append", dest='protocols',
+                      help="Specifies the protocols to enable.  If not "
+                           "specified, all protocols are enabled")
     options, args = parser.parse_args()
+    # do this very early just to set the options
+    get_conductor(options)
     # create an initial deferred to perform tasks which must occur before we
     # can start.  The final callback added will fire up the real servers.
     if args and args[0]=='help':
         if args[1:]:
             which = args[1:]
             which = all_args.keys()
         for this in which: