comparison MetaDataFolder.py @ 17:ba617e755c56

mostly finished attributions and copyright
author casties
date Tue, 02 Aug 2011 18:28:39 +0200
parents 41b90f09a1f2
children 611b6df70840
comparison
equal deleted inserted replaced
16:5d41c350dd2b 17:ba617e755c56
129 xmlpath = xmlpath[1:] 129 xmlpath = xmlpath[1:]
130 130
131 obj = self.restrictedTraverse(xmlpath, None) 131 obj = self.restrictedTraverse(xmlpath, None)
132 return obj 132 return obj
133 133
134 def getXmlPathData(self, xmlpath, path=None, dom=None, allText=False, all=False): 134 def getXmlPathData(self, xmlpath, path=None, dom=None, recursive=0, all=False, allText=False):
135 """returns contents of element at xmlpath as dict""" 135 """returns contents of element at xmlpath as dict"""
136 logging.error("getXmlPathData(%s)"%xmlpath) 136 logging.error("getXmlPathData(%s)"%xmlpath)
137 mdObj = self.getXmlPathObj(xmlpath) 137 mdObj = self.getXmlPathObj(xmlpath)
138 if mdObj is not None: 138 if mdObj is not None:
139 return mdObj.getData(path=path, dom=dom, allText=allText, all=all) 139 return mdObj.getData(path=path, dom=dom, recursive=recursive, all=all, allText=allText)
140 else: 140 else:
141 logging.error("getXmlPathData: MetaData element at '%s' not found!"%xmlpath) 141 logging.error("getXmlPathData: MetaData element at '%s' not found!"%xmlpath)
142 return None 142 return None
143 143
144 def getXmlPathFormatted(self, xmlpath, template, path=None, dom=None, data=None, allFields=False, allText=False, all=False): 144 def getXmlPathFormatted(self, xmlpath, template, path=None, dom=None, data=None, allFields=False, recursive=0, all=False, allText=False):
145 """returns contents of element at xmlpath as dict""" 145 """returns contents of element at xmlpath as dict"""
146 logging.error("getXmlPathFormatted(xmlpath=%s, template=%s)"%(xmlpath,template)) 146 logging.error("getXmlPathFormatted(xmlpath=%s, template=%s)"%(xmlpath,template))
147 mdObj = self.getXmlPathObj(xmlpath) 147 mdObj = self.getXmlPathObj(xmlpath)
148 if mdObj is not None: 148 if mdObj is not None:
149 if data is None: 149 if data is None:
150 data = mdObj.getData(path=path, dom=dom, allText=allText, all=all) 150 data = mdObj.getData(path=path, dom=dom, recursive=recursive, all=all, allText=allText)
151 151
152 if data is None: 152 if data is None:
153 return '' 153 return ''
154 154
155 fmt = '' 155 fmt = ''
186 186
187 def getAttributionFormatted(self, template, path=None, dom=None, data=None, all=True): 187 def getAttributionFormatted(self, template, path=None, dom=None, data=None, all=True):
188 """returns formatted contents of access tag""" 188 """returns formatted contents of access tag"""
189 return self.getXmlPathFormatted('resource/meta/access-conditions/attribution', template, path=path, dom=dom, data=data, all=all) 189 return self.getXmlPathFormatted('resource/meta/access-conditions/attribution', template, path=path, dom=dom, data=data, all=all)
190 190
191 def getCopyrightData(self, path=None, dom=None, all=True): 191 def getCopyrightData(self, path=None, dom=None, recursive=1, all=True):
192 """returns contents of copyright tag as dict""" 192 """returns contents of copyright tag as dict"""
193 return self.getXmlPathData('resource/meta/access-conditions/copyright', path=path, dom=dom, allText=True, all=all) 193 return self.getXmlPathData('resource/meta/access-conditions/copyright', path=path, dom=dom, recursive=recursive, all=all)
194 194
195 def getCopyrightFormatted(self, template, path=None, dom=None, data=None, all=True): 195 def getCopyrightFormatted(self, template, path=None, dom=None, data=None, all=True):
196 """returns formatted contents of access tag""" 196 """returns formatted contents of access tag"""
197 return self.getXmlPathFormatted('resource/meta/access-conditions/copyright', template, path=path, dom=dom, data=data, all=all) 197 return self.getXmlPathFormatted('resource/meta/access-conditions/copyright', template, path=path, dom=dom, data=data, all=all)
198 198