Fixed some fields of the DC extension

Signed-off-by: Lars Kiesow <lkiesow@uos.de>
This commit is contained in:
Lars Kiesow 2014-07-20 22:19:17 +02:00
parent eab1f874f2
commit ae760d0463
No known key found for this signature in database
GPG key ID: 5DAFE8D9C823CE73
2 changed files with 6 additions and 14 deletions

View file

@ -31,7 +31,9 @@ if __name__ == '__main__':
print_enc (' rss -- Generate RSS test output and print it to stdout.')
print_enc (' <file>.atom -- Generate ATOM test feed and write it to file.atom.')
print_enc (' <file>.rss -- Generate RSS test teed and write it to file.rss.')
print_enc (' podcast -- Generator Podcast test output and print it to stdout.')
print_enc (' podcast -- Generate Podcast test output and print it to stdout.')
print_enc (' dc.atom -- Generate DC extension test output (atom format) and print it to stdout.')
print_enc (' dc.rss -- Generate DC extension test output (rss format) and print it to stdout.')
print_enc ('')
exit()

View file

@ -54,19 +54,12 @@ class DcBaseExtension(BaseExtension):
for elem in ['contributor', 'coverage', 'creator', 'date', 'description',
'language', 'publisher', 'relation', 'rights', 'source', 'subject',
'title', 'type']:
'title', 'type', 'format', 'identifier']:
if hasattr(self, '_dcelem_%s' % elem):
for val in getattr(self, '_dcelem_%s' % elem) or []:
node = etree.SubElement(xml_elem, '{%s}%s' % (DCELEMENTS_NS, elem))
node.text = val
if self._dcelem_format:
node = etree.SubElement(xml_elem, '{%s}format' % DCELEMENTS_NS)
node.text = format
if self._dcelem_identifier:
node = etree.SubElement(xml_elem, '{%s}identifier' % DCELEMENTS_NS)
node.text = identifier
def extend_atom(self, atom_feed):
'''Extend an Atom feed with the set DC fields.
@ -225,14 +218,11 @@ class DcBaseExtension(BaseExtension):
'''Get or set the dc:identifier which should be an unambiguous reference
to the resource within a given context.
If not set, the value of atom:id will be used. But setting this value
will on the other hand not set atom:id.
For more inidentifierion see:
http://dublincore.org/documents/dcmi-terms/#elements-identifier
:param identifier: Identifier of the resource or list of identifiers.
:param replace: Replace alredy set format (deault: True).
:param replace: Replace alredy set identifier (deault: True).
:returns: Identifiers of the resource.
'''
if not identifier is None: