本文整理汇总了Python中data.storage.Storage.addProfessorOwnCourse方法的典型用法代码示例。如果您正苦于以下问题:Python Storage.addProfessorOwnCourse方法的具体用法?Python Storage.addProfessorOwnCourse怎么用?Python Storage.addProfessorOwnCourse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data.storage.Storage
的用法示例。
在下文中一共展示了Storage.addProfessorOwnCourse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Professors
# 需要导入模块: from data.storage import Storage [as 别名]
# 或者: from data.storage.Storage import addProfessorOwnCourse [as 别名]
class Professors(object):
def __init__(self):
print 'Professor created\n'
# create storag
self.__store = Storage()
def addProfessor(self, data):
print 'In Professor.add method'
try:
self.__store.add('professor', data)
return 'success'
except:
return 'failed'
def getProfessor(self, value):
print 'In Professor.get method'
try:
return self.__store.get('professor', 'username', value)
except:
return 'failed'
def getAll(self):
print 'In Professors.getAll method'
try:
return self.__store.getAll('Professor')
except:
return 'failed'
def updateProfessor(self, value, data):
print 'In Professor.update method'
try:
return self.__store.update('Professor', 'email', value, data)
except:
return 'failed'
def updateProfessorOwnCourse(self, email, courseid):
print 'In Course.updateProfessorOwnCourse method'
try:
return self.__store.addProfessorOwnCourse(email, courseid)
except:
traceback.print_exc()
return 'failed'
def removeProfessor(self, value):
print 'In Professor.remove method'
try:
return self.__store.remove('Professor', 'email', value)
except:
return 'failed'