comparison roundup/scripts/roundup_mailgw.py @ 2284:3be606e3f58e

print usage and exit if first non-option argument is not a directory ('roundup_mailgw help' produced traceback)
author Alexander Smishlajev <a1s@users.sourceforge.net>
date Wed, 12 May 2004 17:50:58 +0000
parents 0b198ed096af
children b54ad9ed394a
comparison
equal deleted inserted replaced
2283:6f5e0b7ba5b4 2284:3be606e3f58e
11 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 11 # BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
12 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 12 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 13 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
14 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 14 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
15 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 15 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
16 # 16 #
17 # $Id: roundup_mailgw.py,v 1.15 2004-05-06 01:12:24 richard Exp $ 17 # $Id: roundup_mailgw.py,v 1.16 2004-05-12 17:50:58 a1s Exp $
18 18
19 """Command-line script stub that calls the roundup.mailgw. 19 """Command-line script stub that calls the roundup.mailgw.
20 """ 20 """
21 __docformat__ = 'restructuredtext' 21 __docformat__ = 'restructuredtext'
22 22
42 The roundup mail gateway may be called in one of four ways: 42 The roundup mail gateway may be called in one of four ways:
43 . with an instance home as the only argument, 43 . with an instance home as the only argument,
44 . with both an instance home and a mail spool file, or 44 . with both an instance home and a mail spool file, or
45 . with both an instance home and a POP/APOP server account. 45 . with both an instance home and a POP/APOP server account.
46 . with both an instance home and a IMAP/IMAPS server account. 46 . with both an instance home and a IMAP/IMAPS server account.
47 47
48 It also supports optional -C and -S arguments that allows you to set a 48 It also supports optional -C and -S arguments that allows you to set a
49 fields for a class created by the roundup-mailgw. The default class if 49 fields for a class created by the roundup-mailgw. The default class if
50 not specified is msg, but the other classes: issue, file, user can 50 not specified is msg, but the other classes: issue, file, user can
51 also be used. The -S or --set options uses the same 51 also be used. The -S or --set options uses the same
52 property=value[;property=value] notation accepted by the command line 52 property=value[;property=value] notation accepted by the command line
86 POP mail. 86 POP mail.
87 imap username:password@server 87 imap username:password@server
88 It also allows you to specify a specific mailbox other than INBOX using 88 It also allows you to specify a specific mailbox other than INBOX using
89 this format: 89 this format:
90 imap username:password@server mailbox 90 imap username:password@server mailbox
91 91
92 IMAPS: 92 IMAPS:
93 Connect to an IMAP server over ssl. 93 Connect to an IMAP server over ssl.
94 This supports the same notation as IMAP. 94 This supports the same notation as IMAP.
95 imaps username:password@server [mailbox] 95 imaps username:password@server [mailbox]
96 96
97 ''') 97 ''')
98 return 1 98 return 1
99 99
100 def main(argv): 100 def main(argv):
101 '''Handle the arguments to the program and initialise environment. 101 '''Handle the arguments to the program and initialise environment.
118 # figure the instance home 118 # figure the instance home
119 if len(args) > 0: 119 if len(args) > 0:
120 instance_home = args[0] 120 instance_home = args[0]
121 else: 121 else:
122 instance_home = os.environ.get('ROUNDUP_INSTANCE', '') 122 instance_home = os.environ.get('ROUNDUP_INSTANCE', '')
123 if not instance_home: 123 if not (instance_home and os.path.isdir(instance_home)):
124 return usage(argv) 124 return usage(argv)
125 125
126 # get the instance 126 # get the instance
127 import roundup.instance 127 import roundup.instance
128 instance = roundup.instance.open(instance_home) 128 instance = roundup.instance.open(instance_home)

Roundup Issue Tracker: http://roundup-tracker.org/