Beispiel #1
0
 def test02_one_caplist(self):
     rsd = SourceDescription()
     rsd.describedby = "http://example.org/about"
     self.assertEqual( len(rsd), 0 )
     rsd.md_at = None
     rsd.add_capability_list("http://example.org/ds1/cl.xml")
     self.assertEqual( len(rsd), 1 )
     self.assertEqual( rsd.as_xml(), '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/"><rs:ln href="http://example.org/about" rel="describedby" /><rs:md capability="description" /><url><loc>http://example.org/ds1/cl.xml</loc><rs:md capability="capabilitylist" /></url></urlset>' )
 def test01_empty(self):
     rsd = SourceDescription()
     rsd.describedby = "http://example.org/about"
     self.assertEqual(len(rsd), 0)
     rsd.md_at = None
     self.assertEqual(
         rsd.as_xml(),
         '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/"><rs:ln href="http://example.org/about" rel="describedby" /><rs:md capability="description" /></urlset>'
     )
# Print to file at args.resource_dir + "/resource-list.xml"
resource_list_file = open(args.resource_dir + "/resource-list.xml", "w")
resource_list_file.write(rl.as_xml())
resource_list_file.close()
print "Wrote resource list to: " + args.resource_dir + "/resource-list.xml"

timestamps.sort()

caps = CapabilityList()
caps.add_capability(rl, args.resource_url + "resource-list.xml")
if len(timestamps) > 0:
	caps.md['from'] = timestamps[0]

# Print to file at args.resource_dir + "/capability-list.xml"
capability_list_file = open(args.resource_dir + "/capability-list.xml", "w")
capability_list_file.write(caps.as_xml())
capability_list_file.close()

print "Wrote capability list to: " + args.resource_dir + "/capability-list.xml"

rsd = SourceDescription()
rsd.md_at = None
rsd.add_capability_list(args.resource_url + "capability-list.xml")

# Print to file at args.resource_dir + "/resourcesync"
source_description_file = open(args.resource_dir + "/resourcesync", "w")
source_description_file.write(rsd.as_xml())
source_description_file.close()

print "Wrote source description to: " + args.resource_dir + "/resourcesync"
Beispiel #4
0
# Print to file at args.resource_dir + "/resource-list.xml"
resource_list_file = open(args.resource_dir + "/resource-list.xml", "w")
resource_list_file.write(rl.as_xml())
resource_list_file.close()
print "Wrote resource list to: " + args.resource_dir + "/resource-list.xml"

timestamps.sort()

caps = CapabilityList()
caps.add_capability(rl, args.resource_url + "resource-list.xml")
if len(timestamps) > 0:
    caps.md['from'] = timestamps[0]

# Print to file at args.resource_dir + "/capability-list.xml"
capability_list_file = open(args.resource_dir + "/capability-list.xml", "w")
capability_list_file.write(caps.as_xml())
capability_list_file.close()

print "Wrote capability list to: " + args.resource_dir + "/capability-list.xml"

rsd = SourceDescription()
rsd.md_at = None
rsd.add_capability_list(args.resource_url + "capability-list.xml")

# Print to file at args.resource_dir + "/resourcesync"
source_description_file = open(args.resource_dir + "/resourcesync", "w")
source_description_file.write(rsd.as_xml())
source_description_file.close()

print "Wrote source description to: " + args.resource_dir + "/resourcesync"
Beispiel #5
0
 def test01_empty(self):
     rsd = SourceDescription()
     rsd.describedby = "http://example.org/about"
     self.assertEqual( len(rsd), 0 )
     rsd.md_at = None
     self.assertEqual( rsd.as_xml(), '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:rs="http://www.openarchives.org/rs/terms/"><rs:ln href="http://example.org/about" rel="describedby" /><rs:md capability="description" /></urlset>' )