Beispiel #1
0
 def _process(self):
     filename = "%s - contribution.xml" % self._target.getTitle()
     from MaKaC.common.output import outputGenerator, XSLTransformer
     xmlgen = XMLGen()
     xmlgen.initXml()
     outgen = outputGenerator(self.getAW(), xmlgen)
     xmlgen.openTag("event")
     outgen.confToXML(self._target.getConference(),
                      0,
                      1,
                      1,
                      showContribution=self._target.getId(),
                      overrideCache=True)
     xmlgen.closeTag("event")
     basexml = xmlgen.getXml()
     path = Config.getInstance().getStylesheetsDir()
     stylepath = "%s.xsl" % (os.path.join(path, self._xmltype))
     if self._xmltype != "standard" and os.path.exists(stylepath):
         try:
             parser = XSLTransformer(stylepath)
             data = parser.process(basexml)
         except:
             data = "Cannot parse stylesheet: %s" % sys.exc_info()[0]
     else:
         data = basexml
     self._req.headers_out["Content-Length"] = "%s" % len(data)
     cfg = Config.getInstance()
     mimetype = cfg.getFileTypeMimeType("XML")
     self._req.content_type = """%s""" % (mimetype)
     self._req.headers_out[
         "Content-Disposition"] = """inline; filename="%s\"""" % cleanHTMLHeaderFilename(
             filename)
     return data
Beispiel #2
0
 def _process(self):
     filename = "%s - contribution.xml" % self._target.getTitle()
     from MaKaC.common.output import outputGenerator, XSLTransformer
     xmlgen = XMLGen()
     xmlgen.initXml()
     outgen = outputGenerator(self.getAW(), xmlgen)
     xmlgen.openTag("event")
     outgen.confToXML(self._target.getConference(),
                      0,
                      1,
                      1,
                      showContribution=self._target.getId(),
                      overrideCache=True)
     xmlgen.closeTag("event")
     basexml = xmlgen.getXml()
     path = Config.getInstance().getStylesheetsDir()
     stylepath = "%s.xsl" % (os.path.join(path, self._xmltype))
     if self._xmltype != "standard" and os.path.exists(stylepath):
         try:
             parser = XSLTransformer(stylepath)
             data = parser.process(basexml)
         except:
             data = "Cannot parse stylesheet: %s" % sys.exc_info()[0]
     else:
         data = basexml
     return send_file(filename, StringIO(data), 'XML')
Beispiel #3
0
 def _setMailText(self):
     text = self.text
     if self.note:
         text = text + "Note: %s" % self.note
     if self.confSumary:
         #try:
             from MaKaC.common.output import outputGenerator
             from MaKaC.accessControl import AdminList, AccessWrapper
             import MaKaC.webinterface.urlHandlers as urlHandlers
             admin = AdminList().getInstance().getList()[0]
             aw = AccessWrapper()
             aw.setUser(admin)
             path = Config.getInstance().getStylesheetsDir()
             if os.path.exists("%s/text.xsl" % path):
                 stylepath = "%s/text.xsl" % path
             outGen = outputGenerator(aw)
             vars = { \
                     "modifyURL": urlHandlers.UHConferenceModification.getURL( self.conf ), \
                     "sessionModifyURLGen": urlHandlers.UHSessionModification.getURL, \
                     "contribModifyURLGen": urlHandlers.UHContributionModification.getURL, \
                     "subContribModifyURLGen":  urlHandlers.UHSubContribModification.getURL, \
                     "materialURLGen": urlHandlers.UHMaterialDisplay.getURL, \
                     "resourceURLGen": urlHandlers.UHFileAccess.getURL }
             confText = outGen.getOutput(self.conf,stylepath,vars)
             text += "\n\n\n" + confText
         #except:
         #    text += "\n\n\nSorry could not embed text version of the agenda..."
     self.mail.setText(text)
Beispiel #4
0
 def _setMailText(self):
     text = self.text
     if self.note:
         text = text + "Note: %s" % self.note
     if self.confSumary:
         #try:
         from MaKaC.common.output import outputGenerator
         from MaKaC.accessControl import AdminList, AccessWrapper
         import MaKaC.webinterface.urlHandlers as urlHandlers
         admin = AdminList().getInstance().getList()[0]
         aw = AccessWrapper()
         aw.setUser(admin)
         path = Config.getInstance().getStylesheetsDir()
         if os.path.exists("%s/text.xsl" % path):
             stylepath = "%s/text.xsl" % path
         outGen = outputGenerator(aw)
         vars = { \
                 "modifyURL": urlHandlers.UHConferenceModification.getURL( self.conf ), \
                 "sessionModifyURLGen": urlHandlers.UHSessionModification.getURL, \
                 "contribModifyURLGen": urlHandlers.UHContributionModification.getURL, \
                 "subContribModifyURLGen":  urlHandlers.UHSubContribModification.getURL, \
                 "materialURLGen": urlHandlers.UHMaterialDisplay.getURL, \
                 "resourceURLGen": urlHandlers.UHFileAccess.getURL }
         confText = outGen.getOutput(self.conf, stylepath, vars)
         text += "\n\n\n" + confText
     #except:
     #    text += "\n\n\nSorry could not embed text version of the agenda..."
     self.mail.setText(text)
Beispiel #5
0
 def _process(self):
     filename = "%s - Contribution.xml" % self._target.getTitle().replace(
         "/", "")
     from MaKaC.common.xmlGen import XMLGen
     from MaKaC.common.output import outputGenerator
     xmlgen = XMLGen()
     xmlgen.initXml()
     outgen = outputGenerator(self.getAW(), xmlgen)
     xmlgen.openTag("marc:record", [
         ["xmlns:marc", "http://www.loc.gov/MARC21/slim"],
         ["xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"],
         [
             "xsi:schemaLocation",
             "http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"
         ]
     ])
     outgen.contribToXMLMarc21(self._target, xmlgen)
     xmlgen.closeTag("marc:record")
     data = xmlgen.getXml()
     self._req.headers_out["Content-Length"] = "%s" % len(data)
     cfg = Config.getInstance()
     mimetype = cfg.getFileTypeMimeType("XML")
     self._req.content_type = """%s""" % (mimetype)
     self._req.headers_out[
         "Content-Disposition"] = """inline; filename="%s\"""" % cleanHTMLHeaderFilename(
             filename)
     return data
Beispiel #6
0
 def _process( self ):
     filename = "%s - contribution.xml"%self._target.getTitle()
     from MaKaC.common.output import outputGenerator, XSLTransformer
     xmlgen = XMLGen()
     xmlgen.initXml()
     outgen = outputGenerator(self.getAW(), xmlgen)
     xmlgen.openTag("event")
     outgen.confToXML(self._target.getConference(),0,1,1,showContribution=self._target.getId(), overrideCache=True)
     xmlgen.closeTag("event")
     basexml = xmlgen.getXml()
     path = Config.getInstance().getStylesheetsDir()
     stylepath = "%s.xsl" % (os.path.join(path,self._xmltype))
     if self._xmltype != "standard" and os.path.exists(stylepath):
         try:
             parser = XSLTransformer(stylepath)
             data = parser.process(basexml)
         except:
             data = "Cannot parse stylesheet: %s" % sys.exc_info()[0]
     else:
         data = basexml
     self._req.headers_out["Content-Length"] = "%s"%len(data)
     cfg = Config.getInstance()
     mimetype = cfg.getFileTypeMimeType( "XML" )
     self._req.content_type = """%s"""%(mimetype)
     self._req.headers_out["Content-Disposition"] = """inline; filename="%s\""""%filename.replace("\r\n"," ")
     return data
Beispiel #7
0
 def __init__(self):
     self.closed = False
     self.xml_generator = XMLGen()
     self.xml_generator.initXml()
     self.xml_generator.openTag(b'collection', [[b'xmlns', b'http://www.loc.gov/MARC21/slim']])
     # This is horrible. but refactoring all the code in the indico core would be just as bad.
     aw = AccessWrapper()
     aw.setUser(User.find_first(is_admin=True).as_avatar)
     self.output_generator = outputGenerator(aw, self.xml_generator)
Beispiel #8
0
 def __init__(self):
     self.closed = False
     self.xml_generator = XMLGen()
     self.xml_generator.initXml()
     self.xml_generator.openTag(b'collection', [[b'xmlns', b'http://www.loc.gov/MARC21/slim']])
     # This is horrible. but refactoring all the code in the indico core would be just as bad.
     aw = AccessWrapper()
     aw.setUser(User.find_first(is_admin=True).as_avatar)
     self.output_generator = outputGenerator(aw, self.xml_generator)
 def _process(self):
     filename = "%s - Event.xml" % self._target.getTitle()
     from MaKaC.common.xmlGen import XMLGen
     from MaKaC.common.output import outputGenerator
     xmlgen = XMLGen()
     xmlgen.initXml()
     outgen = outputGenerator(self.getAW(), xmlgen)
     xmlgen.openTag("event")
     outgen.confToXML(self._target.getConference(),0,0,1)
     xmlgen.closeTag("event")
     return send_file(filename, StringIO(xmlgen.getXml()), 'XML')
 def _process( self ):
     filename = "%s - Event.xml"%cleanHTMLHeaderFilename(self._target.getTitle())
     from MaKaC.common.xmlGen import XMLGen
     from MaKaC.common.output import outputGenerator
     xmlgen = XMLGen()
     xmlgen.initXml()
     outgen = outputGenerator(self.getAW(), xmlgen)
     xmlgen.openTag("marc:record", [["xmlns:marc","http://www.loc.gov/MARC21/slim"],["xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance"],["xsi:schemaLocation", "http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"]])
     outgen.confToXMLMarc21(self._target.getConference())
     xmlgen.closeTag("marc:record")
     return send_file(filename, StringIO(xmlgen.getXml()), 'XML')
Beispiel #11
0
 def _process(self):
     filename = "%s - Event.xml" % self._target.getTitle()
     from MaKaC.common.xmlGen import XMLGen
     from MaKaC.common.output import outputGenerator
     xmlgen = XMLGen()
     xmlgen.initXml()
     outgen = outputGenerator(self.getAW(), xmlgen)
     xmlgen.openTag("event")
     outgen.confToXML(self._target.getConference(),0,0,1)
     xmlgen.closeTag("event")
     return send_file(filename, StringIO(xmlgen.getXml()), 'XML')
Beispiel #12
0
 def _process(self):
     filename = "%s - Subcontribution.xml" % self._subContrib.getTitle().replace("/","")
     from MaKaC.common.xmlGen import XMLGen
     from MaKaC.common.output import outputGenerator
     xmlgen = XMLGen()
     xmlgen.initXml()
     outgen = outputGenerator(self.getAW(), xmlgen)
     xmlgen.openTag("marc:record", [["xmlns:marc","http://www.loc.gov/MARC21/slim"],["xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance"],["xsi:schemaLocation", "http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"]])
     outgen.subContribToXMLMarc21(self._subContrib, xmlgen)
     xmlgen.closeTag("marc:record")
     return send_file(filename, StringIO(xmlgen.getXml()), 'XML')
def buildCache(ids):
    i = 1
    for id in ids:
        DBMgr.getInstance().startRequest()
        try:
            conf = ConferenceHolder().getById(id)
        except:
            print "conf %s not found"
            continue
        print i, ":", conf.getId()
        og = outputGenerator(AccessWrapper())
        x = og.confToXML(conf, 1, 1, 1, overrideCache=True)
        y = og.confToXMLMarc21(conf, 1, 1, 1, overrideCache=True)
        i += 1
        DBMgr.getInstance().endRequest()
Beispiel #14
0
def buildCache(ids):
    i = 1
    for id in ids:
        DBMgr.getInstance().startRequest()
        try:
            conf = ConferenceHolder().getById(id)
        except:
            print "conf %s not found"
            continue
        print i, ":", conf.getId()
        og = outputGenerator(AccessWrapper())
        x = og.confToXML(conf, 1, 1, 1, overrideCache=True)
        y = og.confToXMLMarc21(conf, 1, 1, 1, overrideCache=True)
        i += 1
        DBMgr.getInstance().endRequest()
Beispiel #15
0
 def _process( self ):
     filename = "%s - Session.xml"%self._session.getTitle().replace("/","")
     from MaKaC.common.xmlGen import XMLGen
     from MaKaC.common.output import outputGenerator
     xmlgen = XMLGen()
     xmlgen.initXml()
     outgen = outputGenerator(self.getAW(), xmlgen)
     xmlgen.openTag("marc:record", [["xmlns:marc","http://www.loc.gov/MARC21/slim"],["xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance"],["xsi:schemaLocation", "http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"]])
     outgen.sessionToXMLMarc21(self._session, xmlgen)
     xmlgen.closeTag("marc:record")
     data = xmlgen.getXml()
     self._req.headers_out["Content-Length"] = "%s"%len(data)
     cfg = Config.getInstance()
     mimetype = cfg.getFileTypeMimeType( "XML" )
     self._req.content_type = """%s"""%(mimetype)
     self._req.headers_out["Content-Disposition"] = """inline; filename="%s\""""%cleanHTMLHeaderFilename(filename)
     return data
Beispiel #16
0
def buildCache(ids):
    i = 1
    for id in ids:
        DBMgr.getInstance().startRequest()
        try:
            conf = ConferenceHolder().getById(id)
        except:
            print "conf %s not found"
            continue
        j = 1
        for cont in conf.getContributionList():
            print "conf %d:%s - contrib %d:%s"%(i, conf.getId(), j, cont.getId())
            og = outputGenerator(AccessWrapper())
            x = og.contribToXMLMarc21(cont, 1, overrideCache=True)
            for subCont in cont.getSubContributionList():
                print "conf %d:%s - contrib %d:%s - subContrib:%s"%(i, conf.getId(), j, cont.getId(), subCont.getId())
                y = og.subContribToXMLMarc21(subCont, 1, overrideCache=True)
            j += 1
        i += 1
        DBMgr.getInstance().endRequest()
def buildCache(ids):
    i = 1
    for id in ids:
        DBMgr.getInstance().startRequest()
        try:
            conf = ConferenceHolder().getById(id)
        except:
            print "conf %s not found"
            continue
        j = 1
        for cont in conf.getContributionList():
            print "conf %d:%s - contrib %d:%s"%(i, conf.getId(), j, cont.getId())
            og = outputGenerator(AccessWrapper())
            x = og.contribToXMLMarc21(cont, 1, overrideCache=True)
            for subCont in cont.getSubContributionList():
                print "conf %d:%s - contrib %d:%s - subContrib:%s"%(i, conf.getId(), j, cont.getId(), subCont.getId())
                y = og.subContribToXMLMarc21(subCont, 1, overrideCache=True)
            j += 1
        i += 1
        DBMgr.getInstance().endRequest()
Beispiel #18
0
 def _process( self ):
     filename = "%s - contribution.xml"%self._target.getTitle()
     from MaKaC.common.output import outputGenerator, XSLTransformer
     xmlgen = XMLGen()
     xmlgen.initXml()
     outgen = outputGenerator(self.getAW(), xmlgen)
     xmlgen.openTag("event")
     outgen.confToXML(self._target.getConference(),0,1,1,showContribution=self._target.getId(), overrideCache=True)
     xmlgen.closeTag("event")
     basexml = xmlgen.getXml()
     path = Config.getInstance().getStylesheetsDir()
     stylepath = "%s.xsl" % (os.path.join(path,self._xmltype))
     if self._xmltype != "standard" and os.path.exists(stylepath):
         try:
             parser = XSLTransformer(stylepath)
             data = parser.process(basexml)
         except:
             data = "Cannot parse stylesheet: %s" % sys.exc_info()[0]
     else:
         data = basexml
     return send_file(filename, StringIO(data), 'XML')
Beispiel #19
0
    def _process(self):
        filename = "%s - Contribution.xml" % self._target.getTitle().replace("/", "")
        from MaKaC.common.xmlGen import XMLGen
        from MaKaC.common.output import outputGenerator

        xmlgen = XMLGen()
        xmlgen.initXml()
        outgen = outputGenerator(self.getAW(), xmlgen)
        xmlgen.openTag(
            "marc:record",
            [
                ["xmlns:marc", "http://www.loc.gov/MARC21/slim"],
                ["xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"],
                [
                    "xsi:schemaLocation",
                    "http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd",
                ],
            ],
        )
        outgen.contribToXMLMarc21(self._target, xmlgen)
        xmlgen.closeTag("marc:record")
        return send_file(filename, StringIO(xmlgen.getXml()), "XML")
Beispiel #20
0
 def  __init__(self, XG):
     # self.categoryRoot = conference.CategoryManager().getRoot()
     self._user = accessControl.AccessWrapper()
     self._XMLGen = XG
     self._config = Config.getInstance()
     self._outGen = outputGenerator(self._user, self._XMLGen)
Beispiel #21
0
 def __init__(self, XG):
     # self.categoryRoot = conference.CategoryManager().getRoot()
     self._user = accessControl.AccessWrapper()
     self._XMLGen = XG
     self._config = Config.getInstance()
     self._outGen = outputGenerator(self._user, self._XMLGen)
Beispiel #22
0
def getBasicXMLRepresentation(aw, IndicoID, contentType, videoFormat, languages):
    '''Generate the basic XML that is to be transformed using one of the XSL files.'''

    # Incantation to initialize XML that I don't fully understand
    xmlGen = XMLGen()
    xmlGen.initXml()

    # aw stands for AccessWrapper. I don't really understand exactly what
    # this command does, but it is apparently necessary
    og = outputGenerator(aw, xmlGen)

    # Generate XML event tag to enclose the entire conference
    xmlGen.openTag("event")

    # Given the IndicoID, retrieve the type of talk and IDs
    parsed = parseIndicoID(IndicoID)

    # populate dictionary with RecordingManager parameters to be used by methods in outputGenerator
    # such as confToXML, _confToXML, _sessionToXML, _contribToXML, _subContributionToXML
    tags = {'talkType':    parsed['type'],
            'talkId':      parsed[parsed['type']],
            'contentType': contentType,
            'videoFormat': videoFormat,
            'languages':   languages}

#    Logger.get('RecMan').info("tags: [%s] [%s] [%s] [%s]" %\
#                              (tags['talkType'],
#                              tags['talkId'],
#                              tags['contentType'],
#                              tags['videoFormat']))
#    for l in tags["languages"]:
#        Logger.get('RecMan').info("language: %s" % l)

    # Given the conference ID, retrieve the corresponding Conference object
    conference = ConferenceHolder().getById(parsed["conference"])

    # Defining the dictionary 'tags' is how we identify ourselves to the outputGenerator
    # methods.
    # Call ConfToXML with different args depending on talk type.
    # includeSession - descend into each session.
    #                  This is necessary for sessions, contributions, and subcontributions,
    #                  since contributions and subcontributions are children of sessions.
    # includeContribution - necessary for contributions and subcontributions
    # includeMaterial - this is always set to "1".
    # showSession - create XML for a particular session, identified by ID
    # showContribution - create XML for a particular contribution, identified by ID
    # showSubContribution - create XML for a particular subcontribution, identified by ID
    # overrideCache - True means force it NOT to use the cache.
    # recordingManagerTags - this is how we pass along all the necessary RecordingManager args to the outputGenerator methods.
    #
    # Nobody outside CERN should have access to CERN access lists.
    # OAI harvesters outside CERN call the same methods we'll be calling,
    # and we don't want to make the access lists available to them.
    if parsed["type"] == 'conference':
#        Logger.get('RecMan').info("generating MARC XML for a conference")
        og.confToXML(conference,
                     0, # includeSession
                     0, # includeContribution
                     1, # includeMaterial
                     showSession         = None,
                     showContribution    = None,
                     showSubContribution = None,
                     overrideCache       = True,
                     recordingManagerTags = tags)
    elif parsed["type"] == 'session':
#        Logger.get('RecMan').info("generating MARC XML for a session")
        og.confToXML(conference,
                     1, # includeSession
                     0, # includeContribution
                     1, # includeMaterial
                     showSession         = parsed["session"],
                     showContribution    = None,
                     showSubContribution = None,
                     overrideCache       = True,
                     recordingManagerTags = tags)
    elif parsed["type"] == 'contribution':
#        Logger.get('RecMan').info("generating MARC XML for a contribution")
        og.confToXML(conference,
                     1, # includeSession
                     1, # includeContribution
                     1, # includeMaterial
                     showSession         = parsed["session"],
                     showContribution    = parsed["contribution"],
                     showSubContribution = None,
                     overrideCache       = True,
                     recordingManagerTags = tags)
    elif parsed["type"] == 'subcontribution':
#        Logger.get('RecMan').info("generating MARC XML for a subcontribution")
        og.confToXML(conference,
                     1, # includeSession
                     1, # includeContribution
                     1, # includeMaterial
                     showSession         = None,
                     showContribution    = parsed["contribution"], # maybe I should turn this on?
                     showSubContribution = parsed["subcontribution"],
                     overrideCache       = True,
                     recordingManagerTags = tags)
    else:
        raise RecordingManagerException(_("IndicoID %s is not a known conference, session, contribution or subcontribution.") % IndicoID)

    xmlGen.closeTag("event")

    # Retrieve the entire basic XML string
    return xmlGen.getXml()
Beispiel #23
0
def getBasicXMLRepresentation(aw, IndicoID, contentType, videoFormat,
                              languages):
    '''Generate the basic XML that is to be transformed using one of the XSL files.'''

    # Incantation to initialize XML that I don't fully understand
    xmlGen = XMLGen()
    xmlGen.initXml()

    # aw stands for AccessWrapper. I don't really understand exactly what
    # this command does, but it is apparently necessary
    og = outputGenerator(aw, xmlGen)

    # Generate XML event tag to enclose the entire conference
    xmlGen.openTag("event")

    # Given the IndicoID, retrieve the type of talk and IDs
    parsed = parseIndicoID(IndicoID)

    # populate dictionary with RecordingManager parameters to be used by methods in outputGenerator
    # such as confToXML, _confToXML, _sessionToXML, _contribToXML, _subContributionToXML
    tags = {
        'talkType': parsed['type'],
        'talkId': parsed[parsed['type']],
        'contentType': contentType,
        'videoFormat': videoFormat,
        'languages': languages
    }

    #    Logger.get('RecMan').info("tags: [%s] [%s] [%s] [%s]" %\
    #                              (tags['talkType'],
    #                              tags['talkId'],
    #                              tags['contentType'],
    #                              tags['videoFormat']))
    #    for l in tags["languages"]:
    #        Logger.get('RecMan').info("language: %s" % l)

    # Given the conference ID, retrieve the corresponding Conference object
    conference = ConferenceHolder().getById(parsed["conference"])

    # Defining the dictionary 'tags' is how we identify ourselves to the outputGenerator
    # methods.
    # Call ConfToXML with different args depending on talk type.
    # includeSession - descend into each session.
    #                  This is necessary for sessions, contributions, and subcontributions,
    #                  since contributions and subcontributions are children of sessions.
    # includeContribution - necessary for contributions and subcontributions
    # includeMaterial - this is always set to "1".
    # showSession - create XML for a particular session, identified by ID
    # showContribution - create XML for a particular contribution, identified by ID
    # showSubContribution - create XML for a particular subcontribution, identified by ID
    # overrideCache - True means force it NOT to use the cache.
    # recordingManagerTags - this is how we pass along all the necessary RecordingManager args to the outputGenerator methods.
    #
    # Nobody outside CERN should have access to CERN access lists.
    # OAI harvesters outside CERN call the same methods we'll be calling,
    # and we don't want to make the access lists available to them.
    if parsed["type"] == 'conference':
        #        Logger.get('RecMan').info("generating MARC XML for a conference")
        og.confToXML(
            conference,
            0,  # includeSession
            0,  # includeContribution
            1,  # includeMaterial
            showSession=None,
            showContribution=None,
            showSubContribution=None,
            overrideCache=True,
            recordingManagerTags=tags)
    elif parsed["type"] == 'session':
        #        Logger.get('RecMan').info("generating MARC XML for a session")
        og.confToXML(
            conference,
            1,  # includeSession
            0,  # includeContribution
            1,  # includeMaterial
            showSession=parsed["session"],
            showContribution=None,
            showSubContribution=None,
            overrideCache=True,
            recordingManagerTags=tags)
    elif parsed["type"] == 'contribution':
        #        Logger.get('RecMan').info("generating MARC XML for a contribution")
        og.confToXML(
            conference,
            1,  # includeSession
            1,  # includeContribution
            1,  # includeMaterial
            showSession=parsed["session"],
            showContribution=parsed["contribution"],
            showSubContribution=None,
            overrideCache=True,
            recordingManagerTags=tags)
    elif parsed["type"] == 'subcontribution':
        #        Logger.get('RecMan').info("generating MARC XML for a subcontribution")
        og.confToXML(
            conference,
            1,  # includeSession
            1,  # includeContribution
            1,  # includeMaterial
            showSession=None,
            showContribution=parsed[
                "contribution"],  # maybe I should turn this on?
            showSubContribution=parsed["subcontribution"],
            overrideCache=True,
            recordingManagerTags=tags)
    else:
        raise RecordingManagerException(
            _("IndicoID %s is not a known conference, session, contribution or subcontribution."
              ) % IndicoID)

    xmlGen.closeTag("event")

    # Retrieve the entire basic XML string
    return xmlGen.getXml()
Beispiel #24
0
  def _process(self):
    if self._statusValue != "OK":
      return self._createResponse(self._statusValue, self._message)

    ih = indexes.IndexesHolder()
    calIdx = ih.getIndex("calendar")
    catIdx = ih.getIndex("category")
    ch = conference.ConferenceHolder()

    # A *preliminary* set of conference id's is created here
    # This set is constructed using indexes, without getting the Conference
    # objects from the DB.
 
    listOfSets = []

    if self._startDateAt != None:
      listOfSets.append(calIdx.getObjectsStartingInDay(self._startDateAt))

    if self._startDateFrom != None:
      listOfSets.append(calIdx.getObjectsStartingIn(self._startDateFrom,self._startDateTo))

    if self._endDateAt != None:
      listOfSets.append(calIdx.getObjectsEndingInDay(self._endDateAt))

    if self._endDateFrom != None:
      listOfSets.append(calIdx.getObjectsEndingIn(self._endDateFrom,self._endDateTo))

    if self._date != None:
      listOfSets.append(calIdx.getObjectsIn(self._date, self._date))

    if self._category != None:
      resultSet = Set()
      if type(self._category) is list:
        for i in self._category:
          resultSet.union_update(catIdx.getItems(i))
      else:
        resultSet.union_update(catIdx.getItems(self._category))

      listOfSets.append(resultSet)

    if self._id != None:
      resultSet = Set()
      if type(self._id) is list:
        listOfSets.append(Set(self._id))
      else:
        listOfSets.append(Set([self._id]))

    prelimResult = listOfSets[0]
    for i in range(1, len(listOfSets)):
      prelimResult.intersection_update(listOfSets[i])

    result = Set()

    XG = xmlGen.XMLGen()
    XG.openTag("response")
    XG.openTag("status")
    XG.writeTag("value", "OK")
    XG.writeTag("message", "Returning search results")
    XG.closeTag("status")
    XG.openTag("event-list")
    for i in prelimResult:
      try:
        try:
            c = ch.getById(i)
        except:
            continue
        if self._author != None and not self._checkAuthor(c, self._author):
          continue
        if self._room != None and not self._checkRoom(c, self._room):
          continue
        if self._startDateFrom != None:
          if c.getStartDate() < self._startDateFrom or \
            c.getStartDate() > self._startDateTo:
            continue
        if self._startDateAt != None:
          if c.getStartDate() != self._startDateAt:
            continue
        if self._endDateFrom != None:
          if c.getEndDate() < self._endDateFrom or \
            c.getEndDate() > self._endDateTo:
              continue
        if self._endDateAt != None:
          if c.getEndDate() != self._endDateAt:
            continue
        result.add(i)
        if self._format != "full":
            self._printConference(c, XG)
        else:
            XG.openTag("event")
            og = outputGenerator(self.getAW(), XG)
            og._confToXML(c,{})
            XG.closeTag("event")
            
      except KeyError:
        continue

    XG.closeTag("event-list")
    XG.closeTag("response")
    self._req.content_type = "text/xml"

    return XG.getXml()
Beispiel #25
0
    def _process(self):
        if self._statusValue != "OK":
            return self._createResponse(self._statusValue, self._message)

        ih = indexes.IndexesHolder()
        calIdx = ih.getIndex("calendar")
        catIdx = ih.getIndex("category")
        ch = conference.ConferenceHolder()

        # A *preliminary* set of conference id's is created here
        # This set is constructed using indexes, without getting the Conference
        # objects from the DB.

        listOfSets = []

        if self._startDateAt != None:
            listOfSets.append(calIdx.getObjectsStartingInDay(
                self._startDateAt))

        if self._startDateFrom != None:
            listOfSets.append(
                calIdx.getObjectsStartingIn(self._startDateFrom,
                                            self._startDateTo))

        if self._endDateAt != None:
            listOfSets.append(calIdx.getObjectsEndingInDay(self._endDateAt))

        if self._endDateFrom != None:
            listOfSets.append(
                calIdx.getObjectsEndingIn(self._endDateFrom, self._endDateTo))

        if self._date != None:
            listOfSets.append(calIdx.getObjectsIn(self._date, self._date))

        if self._category != None:
            resultSet = Set()
            if type(self._category) is list:
                for i in self._category:
                    resultSet.union_update(catIdx.getItems(i))
            else:
                resultSet.union_update(catIdx.getItems(self._category))

            listOfSets.append(resultSet)

        if self._id != None:
            resultSet = Set()
            if type(self._id) is list:
                listOfSets.append(Set(self._id))
            else:
                listOfSets.append(Set([self._id]))

        prelimResult = listOfSets[0]
        for i in range(1, len(listOfSets)):
            prelimResult.intersection_update(listOfSets[i])

        result = Set()

        XG = xmlGen.XMLGen()
        XG.openTag("response")
        XG.openTag("status")
        XG.writeTag("value", "OK")
        XG.writeTag("message", "Returning search results")
        XG.closeTag("status")
        XG.openTag("event-list")
        for i in prelimResult:
            try:
                try:
                    c = ch.getById(i)
                except:
                    continue
                if self._author != None and not self._checkAuthor(
                        c, self._author):
                    continue
                if self._room != None and not self._checkRoom(c, self._room):
                    continue
                if self._startDateFrom != None:
                    if c.getStartDate() < self._startDateFrom or \
                      c.getStartDate() > self._startDateTo:
                        continue
                if self._startDateAt != None:
                    if c.getStartDate() != self._startDateAt:
                        continue
                if self._endDateFrom != None:
                    if c.getEndDate() < self._endDateFrom or \
                      c.getEndDate() > self._endDateTo:
                        continue
                if self._endDateAt != None:
                    if c.getEndDate() != self._endDateAt:
                        continue
                result.add(i)
                if self._format != "full":
                    self._printConference(c, XG)
                else:
                    XG.openTag("event")
                    og = outputGenerator(self.getAW(), XG)
                    og._confToXML(c, {})
                    XG.closeTag("event")

            except KeyError:
                continue

        XG.closeTag("event-list")
        XG.closeTag("response")
        self._req.content_type = "text/xml"

        return XG.getXml()