Browse Source

add getKeys in switchrule.py

dev
breakwa11 10 years ago
parent
commit
298e8a06c9
  1. 6
      db_transfer.py
  2. 3
      switchrule.py

6
db_transfer.py

@ -76,7 +76,11 @@ class DbTransfer(object):
@staticmethod @staticmethod
def pull_db_all_user(): def pull_db_all_user():
#数据库所有用户信息 #数据库所有用户信息
keys = ['port', 'u', 'd', 'transfer_enable', 'passwd', 'enable' ] try:
import switchrule
keys = switchrule.getKeys()
except Exception, e:
keys = ['port', 'u', 'd', 'transfer_enable', 'passwd', 'enable' ]
conn = cymysql.connect(host=Config.MYSQL_HOST, port=Config.MYSQL_PORT, user=Config.MYSQL_USER, conn = cymysql.connect(host=Config.MYSQL_HOST, port=Config.MYSQL_PORT, user=Config.MYSQL_USER,
passwd=Config.MYSQL_PASS, db=Config.MYSQL_DB, charset='utf8') passwd=Config.MYSQL_PASS, db=Config.MYSQL_DB, charset='utf8')
cur = conn.cursor() cur = conn.cursor()

3
switchrule.py

@ -1,3 +1,6 @@
def getKeys():
return ['port', 'u', 'd', 'transfer_enable', 'passwd', 'enable' ]
def isTurnOn(row): def isTurnOn(row):
return True return True

Loading…
Cancel
Save