Mercurial > hg > MetaDataProvider
changeset 36:559907a4d538
json schnittstellen
author | dwinter |
---|---|
date | Thu, 16 May 2013 18:04:14 +0200 |
parents | f6a8055f6798 |
children | e231cff8688b |
files | MetaDataFolder.py |
diffstat | 1 files changed, 32 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/MetaDataFolder.py Mon May 06 12:34:03 2013 +0200 +++ b/MetaDataFolder.py Thu May 16 18:04:14 2013 +0200 @@ -222,6 +222,22 @@ """returns dict with metadata descriptions and data for bibdata""" return self.resource.meta.bib.getMappedData(bibdata, allFields=allFields) + def getBibMappedDataJSON(self, bibdata=None, allFields=False): + """returns dict with metadata descriptions and data for bibdata as JSON takes bidata as JSON""" + + import json + + + + if bibdata is None: + bibdata=self.REQUEST.form + + bibdata = json.loads(bibdata,'utf-8') + + return json.dumps(self.resource.meta.bib.getMappedData(bibdata, allFields=allFields)); + + + def getDCDataFromPath(self,path): """returns DC mapped data from path to index.meta""" return self.resource.meta.bib.getDCDataFromPath(path) @@ -229,9 +245,24 @@ def getDCMappedData(self, bibdata): """returns dict with DC keys and data from bibdata""" return self.resource.meta.bib.getDCMappedData(bibdata) - + + def getBibFormattedMetaDataJSON(self, path=None, dom=None, bibdata=None, bibxdata=None): + """get the metadafrom server as json, takes bibdata json-formatted""" + import json + + logging.debug("getBibFormattedMetaData(path=%s)"%path) + + if bibdata is None: + bibdata=self.REQUEST.form + + + bibdata = json.loads(bibdata,'utf-8') + + return json.dumps(self.resource.meta.bib.getFormatted('metadata_template', path=path, dom=dom, data=bibdata, xdata=bibxdata)) + def getBibFormattedMetaData(self, path=None, dom=None, bibdata=None, bibxdata=None): """get the metadafrom server""" + logging.debug("getBibFormattedMetaData(path=%s)"%path) return self.resource.meta.bib.getFormatted('metadata_template', path=path, dom=dom, data=bibdata, xdata=bibxdata)