当前位置: 首页>>代码示例>>Python>>正文


Python Storage.getCourse方法代码示例

本文整理汇总了Python中data.storage.Storage.getCourse方法的典型用法代码示例。如果您正苦于以下问题:Python Storage.getCourse方法的具体用法?Python Storage.getCourse怎么用?Python Storage.getCourse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在data.storage.Storage的用法示例。


在下文中一共展示了Storage.getCourse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Room

# 需要导入模块: from data.storage import Storage [as 别名]
# 或者: from data.storage.Storage import getCourse [as 别名]
class Room(object):
    # very limited content negotiation support - our format choices
    # for output. This also shows _a way_ of representing enums in python
    json, xml, html, text = range(1, 5)

    #
    # setup the configuration for our service
    #
    def __init__(self, base, conf_fn):
        self.host = socket.gethostname()
        self.base = base
        self.conf = {}

        # should emit a failure (file not found) message
        if os.path.exists(conf_fn):
            with open(conf_fn) as cf:
                for line in cf:
                    name, var = line.partition("=")[::2]
                    self.conf[name.strip()] = var.strip()
        else:
            raise Exception("configuration file not found.")

        # create storage
        self.__store = Storage()

    ##user Collection
    def createUser(self, jsondata):
        return self.__store.createUser(jsondata)

    def getUser(self, emailid):
        return self.__store.getUser(emailid)

    def updateUser(self, emailid):
        return self.__store.updateUser(emailid)

    def deleteUser(self, emailid):
        return self.__store.deleteUser(emailid)

    def enrollCourse(self, courseid, emailid):
        return self.__store.enrollCourse(courseid, emailid)

    def dropCourse(self, courseid, emailid):
        return self.__store.dropCourse(courseid, emailid)

    ##Category Collection
    def insertCategory(self, category):
        return self.__store.insertCategory(category)

    def getCategory(self, category):
        return self.__store.getCategory(category)

    def listCategory(self):
        return self.__store.listCategory()

    ##Course Collection
    def addCourse(self, jsondata):
        return self.__store.addCourse(jsondata)

    def getCourse(self, courseid):
        return self.__store.getCourse(courseid)

    def updateCourse(self, courseid, jsondata):
        return self.__store.updateCourse(courseid, jsondata)

    def deleteCourse(self, courseid):
        return self.__store.deleteCourse(courseid)

    def listCourse(self):
        return self.__store.listCourse()

    ##Quiz collections
    def addQuiz(self, jsondata):
        return self.__store.addQuiz(jsondata)

    def getQuiz(self, quizid):
        return self.__store.getQuiz(quizid)

    def updateQuiz(self, quizid, jsondata):
        return self.__store.updateQuiz(quizid, jsondata)

    def deleteQuiz(self, quizid):
        return self.__store.deleteQuiz(quizid)

    def listQuiz(self):
        return self.__store.listQuiz()

    ##Announcement collections
    def addAnnounce(self, jsondata):
        return self.__store.addAnnounce(jsondata)

    def getAnnounce(self, announceid):
        return self.__store.getAnnounce(announceid)

    def updateAnnounce(self, announceid, jsondata):
        return self.__store.updateAnnounce(announceid, jsondata)

    def deleteAnnounce(self, announceid):
        return self.__store.deleteAnnounce(announceid)

    def listAnnounce(self):
#.........这里部分代码省略.........
开发者ID:pawasthi,项目名称:moocrest,代码行数:103,代码来源:classroom.py

示例2: Room

# 需要导入模块: from data.storage import Storage [as 别名]
# 或者: from data.storage.Storage import getCourse [as 别名]

#.........这里部分代码省略.........
     try:        
        return(self.__store.getann(cid))
       
     except:
        return 'failed'
 
 
   def getUser(self,email):
      try:
	 print("Inclassromm :::::::::::::");
         
         self.__store.names();
	 return(self.__store.getUser(email))
        
      except:
         return 'failed'

   def courseAdd(self,courseJson):
      try:
	 return(self.__store.createCourse(courseJson))        
      except:
         return 'failed'

   def courselist(self):
      try:
	 print("Inclassromm :::::::::::::");
         
         self.__store.names();
	 return(self.__store.courselist())
         
      except:
         return 'failed'

   def getCourse(self,cid):
      try:         
	 return(self.__store.getCourse(cid))
        
      except:
         return 'failed'

   def listCategory(self):
      try:
	 print("Inclassromm :::::::::::::");
         
         self.__store.names();
	 return(self.__store.listCategory())
         
      except:
         return 'failed'

   def getCategory(self,cid):
      try:
	 print("Inclassromm :::::::::::::");
         
         self.__store.names();
	 return(self.__store.getCategory(cid))
        
      except:
         return 'failed'
   
   def createCatagory(self,userJson):
      try:
	 print("Inclassromm :::::::::::::");
         
         self.__store.names();
	 return(self.__store.createCatagory(userJson))
开发者ID:SudharshanR,项目名称:MooC,代码行数:70,代码来源:classroom.py

示例3: Room

# 需要导入模块: from data.storage import Storage [as 别名]
# 或者: from data.storage.Storage import getCourse [as 别名]
class Room(object):
   # very limited content negotiation support - our format choices 
   # for output. This also shows _a way_ of representing enums in python
   json, xml, html, text = range(1, 5)
   
   #
   # setup the configuration for our service
   #
   def __init__(self, base, conf_fn):
      self.host = socket.gethostname()
      self.base = base
      self.conf = {}
      
      # should emit a failure (file not found) message
      if os.path.exists(conf_fn):
         with open(conf_fn) as cf:
            for line in cf:
               name, var = line.partition("=")[::2]
               self.conf[name.strip()] = var.strip()
      else:
         raise Exception("configuration file not found.")

      # create storage
      self.__store = Storage()
   
   
   #
   # example: get course
   #
   def getCourse(self, id):
      return self.__store.getCourse(id)
  
  
   #
   # example: add data
   #
   def add(self,name,value):
      try:
         self.__store.insert(name,value)
         self.__store.names();
         return 'success'
      except:
         e = sys.exc_info()[0]
         traceback.print_exc(file=sys.stdout)
         return "Error: %s" % e

      # TODO success|failure
      
             # update Annoucement

   def updateDiscussion(self, id, body):
       return self.__store.updateDiscussion(id, body)
      
          # update Annoucement

   def updateAnnoucement(self, id, body):
       return self.__store.updateAnnoucement(id, body)
       
            #
    # Discussion list delete
   #
   def deleteDiscussion(self, id):
          return self.__store.deleteDiscussion(id)
         
       
       #
    # Announcement list delete
   #
   def deleteAnnouncement(self, id):
          return self.__store.deleteAnnouncement(id)
          
      
      # update course

   def updateCourse(self, id, body):
       return self.__store.updateCourse(id, body)
   
   # enroll course
   def enrollCourse(self, email, courseid):
       
       return self.__store.enrollCourse(email, courseid)
       
    #
    # course list delete
   #
   def deleteCourse(self, id):
          return self.__store.deleteCourse(id)
         
     
       #
   # course list find 
   #
   def listCourse(self):
       return self.__store.listCourse()


     
   def auth(self, email, pwd):
       return self.__store.auth(email,pwd)
   
#.........这里部分代码省略.........
开发者ID:SwetaPatel,项目名称:MS_SJSU_Projects,代码行数:103,代码来源:classroom.py


注:本文中的data.storage.Storage.getCourse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。