Example #1
0
    def confToXMLMarc21(self,
                        event,
                        includeSession=1,
                        includeContribution=1,
                        includeMaterial=1,
                        out=None,
                        overrideCache=False):

        if not out:
            out = self._XMLGen
        #try to get a cache
        version = "MARC21_ses-%s_cont-%s_mat-%s" % (
            includeSession, includeContribution, includeMaterial)
        obj = None
        if not overrideCache:
            obj = self.cache.loadObject(version, event.as_legacy)
        if obj:
            xml = obj.getContent()
        else:
            # No cache, build the XML
            temp = XMLGen(init=False)
            self._event_to_xml_marc_21(event,
                                       includeSession,
                                       includeContribution,
                                       includeMaterial,
                                       out=temp)
            xml = temp.getXml()
            # save XML in cache
            self.cache.cacheObject(version, xml, event.as_legacy)
        out.writeXML(xml)
Example #2
0
 def subContribToXMLMarc21(self,subCont,includeMaterial=1, out=None, overrideCache=False):
     if not out:
         out = self._XMLGen
     #try to get a cache
     version = "MARC21_mat-%s"%(includeMaterial)
     obj = None
     if not overrideCache:
         obj = self.cache.loadObject(version, subCont)
     if obj:
         xml = obj.getContent()
     else:
         # No cache, build the XML
         temp = XMLGen(init=False)
         self._subcontrib_to_marc_xml_21(subCont,includeMaterial, out=temp)
         xml = temp.getXml()
         # save XML in cache
         self.cache.cacheObject(version, xml, subCont)
     out.writeXML(xml)
Example #3
0
    def confToXMLMarc21(self,event,includeSession=1,includeContribution=1,includeMaterial=1,out=None, overrideCache=False):

        if not out:
            out = self._XMLGen
        #try to get a cache
        version = "MARC21_ses-%s_cont-%s_mat-%s"%(includeSession,includeContribution,includeMaterial)
        obj = None
        if not overrideCache:
            obj = self.cache.loadObject(version, event.as_legacy)
        if obj:
            xml = obj.getContent()
        else:
            # No cache, build the XML
            temp = XMLGen(init=False)
            self._event_to_xml_marc_21(event, includeSession, includeContribution, includeMaterial, out=temp)
            xml = temp.getXml()
            # save XML in cache
            self.cache.cacheObject(version, xml, event.as_legacy)
        out.writeXML(xml)
Example #4
0
 def __init__(self, aw, XG=None):
     self.__aw = aw
     if XG != None:
         self._XMLGen = XG
     else:
         self._XMLGen = XMLGen()
     self._config = Config.getInstance()
     self.text = ""
     self.time_XML = 0
     self.time_HTML = 0
     self.cache = XMLCache()
Example #5
0
 def subContribToXMLMarc21(self,
                           subCont,
                           includeMaterial=1,
                           out=None,
                           overrideCache=False):
     if not out:
         out = self._XMLGen
     #try to get a cache
     version = "MARC21_mat-%s" % (includeMaterial)
     obj = None
     if not overrideCache:
         obj = self.cache.loadObject(version, subCont)
     if obj:
         xml = obj.getContent()
     else:
         # No cache, build the XML
         temp = XMLGen(init=False)
         self._subcontrib_to_marc_xml_21(subCont, includeMaterial, out=temp)
         xml = temp.getXml()
         # save XML in cache
         self.cache.cacheObject(version, xml, subCont)
     out.writeXML(xml)
Example #6
0
    def __init__(self, aw, XG=None):
        self.__aw = aw
        if XG != None:
            self._XMLGen = XG
        else:
            self._XMLGen = XMLGen()
        self._config = Config.getInstance()
        self.text = ""
        self.time_XML = 0
        self.time_HTML = 0
        self.cache = XMLCache()

        from MaKaC.webinterface.webFactoryRegistry import WebFactoryRegistry
        self.webFactory = WebFactoryRegistry()