Beispiel #1
0
 def __init__(self, nsMap, title, description, linkTemplate, **linkFields):
     XmlCompose.__init__(self,
         template="ignored",
         nsMap=nsMap,
         title=title,
         description=description,
         **linkFields)
     self._linkTemplate = linkTemplate
     assertLinkTemplate(linkTemplate, linkFields)
Beispiel #2
0
 def __init__(self, nsMap, baseURL, harvestDate, metadataNamespace, identifier, datestamp):
     XmlCompose.__init__(self,
         PROVENANCE_TEMPLATE,
         nsMap,
         baseURL=baseURL,
         harvestDate=harvestDate,
         metadataNamespace=metadataNamespace,
         identifier=identifier,
         datestamp=datestamp)
Beispiel #3
0
 def __init__(self, nsMap, baseURL, harvestDate, metadataNamespace,
              identifier, datestamp):
     XmlCompose.__init__(self,
                         PROVENANCE_TEMPLATE,
                         nsMap,
                         baseURL=baseURL,
                         harvestDate=harvestDate,
                         metadataNamespace=metadataNamespace,
                         identifier=identifier,
                         datestamp=datestamp)
    def testOne(self):
        xmlcompose = XmlCompose(
            template="""<template><one>%(one)s</one><two>%(two)s</two></template>""",
            nsMap={"ns1": "http://namespaces.org/ns1"},
            one=("partname1", "/ns1:one/ns1:tag/text()"),
            two=("partname2", "/two/tag/@name"),
        )
        observer = MockStorage()
        xmlcompose.addObserver(observer)

        result = xmlcompose.getRecord("recordId")
        self.assertEqualsWS(result, """<template><one>1</one><two>&lt;one&gt;</two></template>""")
    def testOne(self):
        xmlcompose = XmlCompose(
            template=
            """<template><one>%(one)s</one><two>%(two)s</two></template>""",
            nsMap={'ns1': "http://namespaces.org/ns1"},
            one=('partname1', '/ns1:one/ns1:tag/text()'),
            two=('partname2', '/two/tag/@name'))
        observer = MockStorage()
        xmlcompose.addObserver(observer)

        result = xmlcompose.getRecord("recordId")
        self.assertEqualsWS(
            result,
            """<template><one>1</one><two>&lt;one&gt;</two></template>""")