本文整理汇总了Python中DataModel.modifyAttributeValue方法的典型用法代码示例。如果您正苦于以下问题:Python DataModel.modifyAttributeValue方法的具体用法?Python DataModel.modifyAttributeValue怎么用?Python DataModel.modifyAttributeValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataModel
的用法示例。
在下文中一共展示了DataModel.modifyAttributeValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_form
# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import modifyAttributeValue [as 别名]
def process_form(global_config, form):
global_config['logger'].debug( 'Process Attribute Modify Form' )
season = form[attr_modify_season_label].value
comp = form[attr_modify_comp_label].value
team = form[attr_modify_team_number_label].value
attr_name = form[attr_modify_attribute_name_label].value
old_value = form[attr_modify_old_value_label].value
new_value = form[attr_modify_new_value_label].value
# Initialize the database session connection
db_name = global_config['db_name'] + global_config['this_season']
session = DbSession.open_db_session(db_name)
attrdef_filename = WebCommonUtils.get_attrdef_filename(short_comp=comp)
if attrdef_filename is not None:
attr_definitions = AttributeDefinitions.AttrDefinitions(global_config)
attr_definitions.parse(attrdef_filename)
attr_def = attr_definitions.get_definition(attr_name)
try:
DataModel.modifyAttributeValue(session, team, comp+season, attr_name, old_value, new_value, attr_def)
result = 'Attribute %s Modified From %s to %s For Team %s' % (attr_name,old_value,new_value,team)
session.commit()
except ValueError as reason:
result = 'Error Modifying Scouting Addribute %s For Team %s: %s' % (attr_name,team,reason)
session.remove()
return result
示例2: process_form
# 需要导入模块: import DataModel [as 别名]
# 或者: from DataModel import modifyAttributeValue [as 别名]
def process_form(global_config, form):
global_config['logger'].debug( 'Process Attribute Modify Form' )
comp = form[attr_modify_comp_label].value
team = form[attr_modify_team_number_label].value
attr_name = form[attr_modify_attribute_name_label].value
old_value = form[attr_modify_old_value_label].value
new_value = form[attr_modify_new_value_label].value
# Initialize the database session connection
db_name = global_config['db_name']
session = DbSession.open_db_session(db_name)
if global_config['attr_definitions'] != None:
attrdef_filename = './config/' + global_config['attr_definitions']
if os.path.exists(attrdef_filename):
attr_definitions = AttributeDefinitions.AttrDefinitions()
attr_definitions.parse(attrdef_filename)
attr_def = attr_definitions.get_definition(attr_name)
DataModel.modifyAttributeValue(session, team, comp, attr_name, old_value, new_value, attr_def)
session.commit()