本文整理汇总了Python中database.DataBase.get方法的典型用法代码示例。如果您正苦于以下问题:Python DataBase.get方法的具体用法?Python DataBase.get怎么用?Python DataBase.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类database.DataBase
的用法示例。
在下文中一共展示了DataBase.get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _day_selected_cb
# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import get [as 别名]
def _day_selected_cb(self, widget, data=None):
'''Select new day'''
date_formated = date_format(self.calendar.get_date())
db = DataBase(self.path)
data = db.get(date_formated)
db.close()
tasks_model = TasksModel(data)
self.tasks_list.set_model(tasks_model.get_model())
示例2: get_tasks
# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import get [as 别名]
def get_tasks(self):
'''Get the rows'''
date_formated = date_format(self.calendar.get_date())
db = DataBase(self.path)
data = db.get(date_formated)
reminder = db.get_reminder()
db.close()
tasks_model = TasksModel(data)
reminder_model = TasksModel(reminder)
self.tasks_list.set_model(tasks_model.get_model())
self.reminder_list.set_model(reminder_model.get_model())
示例3: DataBase
# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import get [as 别名]
db = DataBase(dbData['host'], dbData['user'], dbData['pass'], dbData['name'])
# Connect to AWS
amazon = Amazon(awsData['key_name'], awsData['secret_key'])
if hasattr(config, 'domains') and config.domains == ['all']:
config.domains = []
domains_list = db.get_all(db.cursor, 'domains')
if domains_list == []:
sys.exit('No domains records on database.')
for d in domains_list:
config.domains.append(d['name'])
if config.action == 'check':
for domain_name in config.domains:
domain = db.get(db.cursor, 'domains', 'name', domain_name)
if not domain:
print "[ERROR] The domain doesn't exist"
sys.exit(0)
current_dns = amazon.get_current_dns(domain['aws_zone_id'], domain_name)
# Get server by IP address
server = db.get(db.cursor, 'servers', 'ip', current_dns[domain_name]['destination'])
print domain_name + ' -> ' + server['name'] + ' (' + current_dns[domain_name]['destination'] + ')'
if config.action == 'modify':
# Get destination server info
server_info = db.get(db.cursor, 'servers', 'name', config.server)