<s> import sys <EOL> import os <EOL> import getopt <EOL> import config <EOL> from cabinet import DatetimeCabinet <EOL> def usage ( ) : <EOL> print "<STR_LIT>" % sys . argv [ <NUM_LIT:0> ] <EOL> sys . exit ( - <NUM_LIT:1> ) <EOL> def add_kite_user ( username , password ) : <EOL> usersdb = DatetimeCabinet ( "<STR_LIT>" ) <EOL> usersdb [ username ] = { "<STR_LIT:password>" : password } <EOL> usersdb . sync ( ) <EOL> def add_postfix_user ( username ) : <EOL> with open ( '<STR_LIT>' , '<STR_LIT:r>' ) as fd : <EOL> if username in fd . read ( ) : <EOL> print "<STR_LIT>" <EOL> return <EOL> with open ( '<STR_LIT>' , '<STR_LIT:a>' ) as fd : <EOL> fd . write ( "<STR_LIT>" % ( username , config . SERVER_NAME , username ) ) <EOL> os . system ( "<STR_LIT>" ) <EOL> os . system ( "<STR_LIT>" ) <EOL> try : <EOL> opts , args = getopt . getopt ( sys . argv [ <NUM_LIT:1> : ] , '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> except getopt . GetoptError : <EOL> usage ( ) <EOL> username = None <EOL> password = None <EOL> for opt , arg in opts : <EOL> if opt in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> username = arg <EOL> elif opt in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> password = arg <EOL> if username == None or password == None : <EOL> usage ( ) <EOL> add_postfix_user ( username ) <EOL> add_kite_user ( username , password ) </s>
