本文整理汇总了Python中course.Course.name方法的典型用法代码示例。如果您正苦于以下问题:Python Course.name方法的具体用法?Python Course.name怎么用?Python Course.name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类course.Course
的用法示例。
在下文中一共展示了Course.name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_course_class_list
# 需要导入模块: from course import Course [as 别名]
# 或者: from course.Course import name [as 别名]
def get_course_class_list(self):
from algorithm.models import School, Department, Class, Prerequisite, Building, Room, Period, Lecturer, ClassInstance, ClassLab, Person, Role, PersonRole
from course_class import CourseClass
# This section takes values from the database and stores them in course clas list
print "This will print out all of the course classes currently in the database"
self.classes_list = []
all_course_class = ClassInstance.objects.all()
for ClassInstance in all_course_class:
lecturer = ClassInstance.idLecturer
new_prof = Professor()
new_prof.name = lecturer.Name
new_prof.id = lecturer.idLecturer
Class = ClassInstance.idClass
new_course = Course()
new_course.id = Class.idClass
new_course.name = Class.Class
new_course_class = CourseClass()
new_course_class.professor = new_prof
new_course_class.course = new_course
new_course_class.duration = 1
new_course_class.lab = False
new_course_class.id = ClassInstance.idClassInstance
self.classes_list.append(new_course_class)
self.num_classes += 1
for course_class in self.classes_list:
print "(Professer: %s Course: %s Durration: %d Lab: %d)" % (course_class.professor, course_class.course, course_class.duration, course_class.lab)
示例2: parse_course_table
# 需要导入模块: from course import Course [as 别名]
# 或者: from course.Course import name [as 别名]
def parse_course_table (p, tree, table):
courses = []
course_type_path = tree.getpath (table) + "/descendant::a[contains(@class, 'title')]/text()"
course_type = tree.xpath(course_type_path)[0]
codes_path = tree.getpath (table) + "/descendant::td[contains(@class, 'code')]/a"
codes = tree.xpath (codes_path)
codes_title_path = tree.getpath (table) + "/descendant::td[contains(@class, 'title')]/a/text()"
codes_title = tree.xpath (codes_title_path)
if len(codes) != len(codes_title):
print ("Error: lengths don't match with codes and codes_title")
return []
for i in range (len (codes)):
c = Course(codes[i].text)
c.type = parse_course_type (course_type)
c.name = codes_title[i]
c.link = codes[i].get ("href")
for e in codes_title[i].getparent().itersiblings():
if e.tag == "span" and e.get ("class") == "comment":
for p in e.iterchildren():
if p.tag == "p":
c.comment = p.text
courses.append (c)
return courses
示例3: get
# 需要导入模块: from course import Course [as 别名]
# 或者: from course.Course import name [as 别名]
def get(self):
user = self.get_current_user()
if not user:
self.redirect("/")
return
key = db.Key(encoded=self.request.get("key"))
course = Course.get(key)
class_key = db.Key(encoded=self.request.get("class"))
goto = self.request.get("goto")
if goto == None or goto == "":
goto = "/"
# if class is different copy list to the new class
if class_key != course.parent_key():
aclass = Class.get(class_key)
newCourse = Course(parent=aclass)
newCourse.name = course.name
newCourse.chapters = course.chapters
newCourse.count_questions()
newCourse.put()
self.stop_edit_course()
self.redirect(goto)
示例4: get_course_list
# 需要导入模块: from course import Course [as 别名]
# 或者: from course.Course import name [as 别名]
def get_course_list(self):
from algorithm.models import School, Department, Class, Prerequisite, Building, Room, Period, Lecturer, ClassInstance, ClassLab, Person, Role, PersonRole
from course import Course
print "This will print out all the courses currently in the database"
self.course_list = []
all_courses = Class.objects.all()
for Class in all_courses:
new_course = Course()
new_course.id = Class.idClass
new_course.name = Class.Class
self.course_list.append(new_course)
self.num_courses += 1
for Course in self.course_list:
Course.print_course()