Mercurial > hg > MetaDataProvider
changeset 35:f6a8055f6798
take first value from multiple occurrences of same tag.
author | casties |
---|---|
date | Mon, 06 May 2013 12:34:03 +0200 |
parents | 460c286c252e |
children | 559907a4d538 |
files | MetaData.py version.txt |
diffstat | 2 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/MetaData.py Mon Jan 07 18:45:34 2013 +0100 +++ b/MetaData.py Mon May 06 12:34:03 2013 +0200 @@ -1,6 +1,5 @@ from OFS.Folder import Folder from Products.PageTemplates.PageTemplateFile import PageTemplateFile -from Globals import package_home from AccessControl import ClassSecurityInfo import logging @@ -8,7 +7,7 @@ import xml.sax.saxutils from MetaDataMapping import MetaDataMapping -from SrvTxtUtils import getHttpData, getText +from SrvTxtUtils import getText def normalizeFieldName(bt, underscore=True): """returns normalised field type for looking up mappings""" @@ -145,8 +144,10 @@ # add multiple tags as list putAppend(data, key, val) else: - data[key] = val - + if key not in data: + # don't overwrite element data + data[key] = val + #logging.debug("_getDataFromDom: returns %s"%repr(data)) return data @@ -357,7 +358,7 @@ if remove is not None: path=path.replace(remove,'') if prefix is not None: - path=os.path.join(prefix,path) + path="%s/%s"%(prefix,path) if cut>0: splitted=path.split("/")