當前位置: 首頁>>代碼示例>>Python>>正文


Python Bank.account_add方法代碼示例

本文整理匯總了Python中bank.Bank.account_add方法的典型用法代碼示例。如果您正苦於以下問題:Python Bank.account_add方法的具體用法?Python Bank.account_add怎麽用?Python Bank.account_add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bank.Bank的用法示例。


在下文中一共展示了Bank.account_add方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run

# 需要導入模塊: from bank import Bank [as 別名]
# 或者: from bank.Bank import account_add [as 別名]
def run():
    show_logo() 
    _Runner = True
    global config
    config = ConfigParser.ConfigParser()
    config.read('bitbank.cfg')

    connected = False
    while not connected:
        try:
            db = MySQLdb.connect(host=config.get('Database', 'hostname'),
                user=config.get('Database', 'username'),
                passwd=config.get('Database', 'password'),
                db=config.get('Database', 'database'))
            connected =  True
        except Exception:
            print "Database connection failed, retrying.."
            sleep(5)
 
    bank = Bank(db)

    if config.get('Bitwifi','enable') == "True":
        wifi = Wifi(config)

    defaultusername = bank.username
    while _Runner == True:
        if bank.username != defaultusername:
            barcode=raw_input('%s%s%s please scan [product barcode]: ' % (str(Color('yellow')),bank.username,str(Color('reset'))))
        else:
            barcode=raw_input('Please scan [usercard,product barcode]: ')

        line = filter (lambda a: a != "", barcode.split(" "))
        if len(line) > 1 and bank.login(line[-1]) == True:
            bank = process_line(bank,barcode)
            continue

        if barcode == "clear" or barcode == "abort" or barcode == "reset" or barcode.startswith('ABORT'):
            bank.reset()

        elif barcode == "pay" or barcode == "kas" or barcode.startswith('KAS'):
            print "\x1b[H\x1b[J"
            show_logo()
            bank.pay()
            open_la()

        elif barcode == "logout" or barcode.startswith('LOGOUT'):
            print "\x1b[H\x1b[J"
            show_logo() 
            bank.logout()

        elif barcode == "bank" or barcode.startswith('BANK'):
            print "\x1b[H\x1b[J"
            show_logo()
            bank.account()

        elif barcode == "shame":
            bank.shame()

        elif barcode.startswith('deposit'):
            temp = barcode.split(' ')
            amount = temp[1]
            bank.deposit(amount)
            open_la()

        elif barcode.startswith('withdraw'):
            temp = barcode.split(' ')
            amount = temp[1]
            bank.withdraw(amount)
            open_la()

        elif barcode.startswith('plastic'):
            temp = barcode.split(' ')
            amount = temp[1]
            bank.plastic_add(amount)

        elif barcode.startswith('adduser'):
            temp = barcode.split(' ')
            bank.account_add(temp[1])
        elif barcode.startswith('list'):
            bank.list() 

        elif barcode.startswith('mac') and config.get('Bitwifi','enable') == "True":
            wifi.unregister_list()

        elif barcode.startswith('register') and config.get('Bitwifi','enable') == "True":
            temp = barcode.split(' ')
            if bank.member==0:
                print "403: Access denied"
                continue
            wifi.registration(bank.username,temp[1],temp[2])

        elif barcode == "help":
            print help()

        elif barcode == "hug":
            print free_hug()

        elif barcode == "exit":
            _Runner = False
        elif barcode == "":
#.........這裏部分代碼省略.........
開發者ID:bitlair,項目名稱:bitbank,代碼行數:103,代碼來源:bitbank.py


注:本文中的bank.Bank.account_add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。