Пример #1
0
 def __init__(self):
     print "formData: %s" % formData
     self.__oid = formData.get("oid")
     result = None
     try:
         # get the package manifest
         self.__manifest = self.__readManifest(self.__oid)
         # check if we need to do processing
         func = formData.get("func")
         if func == "get-rvt-manifest":
             result = self.__getRvtManifest(self.getManifest())
     except Exception, e:
         log.error("Failed to load manifest", e);
         result = '{ status: "error", message: "%s" }' % str(e)
Пример #2
0
 def __init__(self, outputFile=None):
     self.__portal = Services.getPortalManager().get(portalId)
     self.__portalManifest = self.__portal.getJsonMap("manifest")
     print formData
     url = formData.get("url")
     if outputFile is None and url is None:
         self.__createPackage()
     elif url is not None and outputFile is not None:
         self.__createPackage(outputFile)
Пример #3
0
 def __init__(self, outputFile=None):
     oid = formData.get("oid")
     print "Creating IMS content package for: %s" % oid
     try:
         # get the package manifest
         object = Services.getStorage().getObject(oid)
         sourceId = object.getSourceId()
         payload = object.getPayload(sourceId)
         self.__manifest = JsonConfigHelper(payload.open())
         payload.close()
         object.close()
         # create the package
         url = formData.get("url")
         if outputFile is None and url is None:
             self.__createPackage()
         elif url is not None and outputFile is not None:
             self.__createPackage(outputFile)
     except Exception, e:
         log.error("Failed to create IMS content package: %s" % str(e))
Пример #4
0
    def check_login(self):
        action = formData.get("verb")

        # User is logging in
        if (action == "login"):
            username = formData.get("username")
            if username is not None:
                password = formData.get("password")
                self.login(username, password)

        # Normal page render, or logout
        else:
            username = sessionState.get("username")
            source   = sessionState.get("source")
            if username is not None:
                self.current_user = self.get_user(username, source)

        # User is logging out, make sure we ran get_user() first
        if (action == "logout"):
            self.logout()
Пример #5
0
 def __init__(self):
     print "formData: %s" % formData
     self.__oid = formData.get("oid")
     result = None
     try:
         # get the package manifest
         object = Services.getStorage().getObject(self.__oid)
         sourceId = object.getSourceId()
         payload = object.getPayload(sourceId)
         payloadReader = InputStreamReader(payload.open(), "UTF-8")
         self.__manifest = JsonConfigHelper(payloadReader)
         payloadReader.close()
         payload.close()
         object.close()
         # check if we need to do processing
         func = formData.get("func")
         if func == "get-rvt-manifest":
             result = self.__getRvtManifest(self.getManifest())
     except Exception, e:
         log.error("Failed to load manifest", e);
         result = '{ status: "error", message: "%s" }' % str(e)
Пример #6
0
 def getPackageTitle(self):
     return StringEscapeUtils.escapeHtml(formData.get("title", self.__manifest.get("title")))
Пример #7
0
 def getFormData(self, field):
     return StringEscapeUtils.escapeHtml(formData.get(field, ""))
Пример #8
0
 def getMeta(self, metaName):
     return StringEscapeUtils.escapeHtml(formData.get(metaName, self.__manifest.get(metaName)))
Пример #9
0
 def session_init(self):
     # Debugging purpose
     if formData.get("verb") == "clear-session":
         sessionState.clear()