本文整理汇总了Python中oasis.lib.Courses.incr_version方法的典型用法代码示例。如果您正苦于以下问题:Python Courses.incr_version方法的具体用法?Python Courses.incr_version怎么用?Python Courses.incr_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oasis.lib.Courses
的用法示例。
在下文中一共展示了Courses.incr_version方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_topic_update
# 需要导入模块: from oasis.lib import Courses [as 别名]
# 或者: from oasis.lib.Courses import incr_version [as 别名]
def do_topic_update(course, request):
"""Read the submitted form and make relevant changes to Topic information
"""
categories = []
topics = []
form = request.form
if form:
for i in form.keys():
parts = i.split('_')
if len(parts) > 1:
catid = parts[0]
if catid not in categories:
categories = categories + [catid]
for c in categories:
topics = topics + [{'id': int(c),
'position': form['%s_position' % c],
'name': form['%s_name' % c],
'visibility': form['%s_visibility' % c]
}]
for i in topics:
if not i['id'] == 0:
Topics.set_pos(i['id'], i['position'])
Topics.set_name(int(i['id']), i['name'])
Topics.set_vis(i['id'], i['visibility'])
Courses.incr_version()
else:
if not i['name'] == "[Name of new topic]":
Topics.create(course['id'],
i['name'],
int(i['visibility']),
i['position'])
Courses.incr_version()
return True
return False