comparison MetaDataFolder.py @ 33:1f845c76dad3

all getXXX take recursive and all parameters.
author casties
date Tue, 18 Dec 2012 19:25:02 +0100
parents ab58edfc0707
children 559907a4d538
comparison
equal deleted inserted replaced
32:a0a147409f67 33:1f845c76dad3
146 146
147 else: 147 else:
148 logging.error("getXmlPathFormatted: MetaData object for '%s' not found!"%xmlpath) 148 logging.error("getXmlPathFormatted: MetaData object for '%s' not found!"%xmlpath)
149 return '' 149 return ''
150 150
151 def getResourceData(self, path=None, dom=None): 151 def getResourceData(self, path=None, dom=None, recursive=0, all=False):
152 """returns contents of resource tag as dict""" 152 """returns contents of resource tag as dict"""
153 return self.getXmlPathData('resource', path=path, dom=dom) 153 return self.getXmlPathData('resource', path=path, dom=dom, recursive=recursive, all=all)
154 154
155 def getTexttoolData(self, path=None, dom=None, recursive=0, all=False): 155 def getTexttoolData(self, path=None, dom=None, recursive=0, all=False):
156 """returns contents of texttool tag as dict""" 156 """returns contents of texttool tag as dict"""
157 return self.getXmlPathData('resource/meta/texttool', path=path, dom=dom, recursive=recursive, all=all) 157 return self.getXmlPathData('resource/meta/texttool', path=path, dom=dom, recursive=recursive, all=all)
158 158
159 def getAccessData(self, path=None, dom=None): 159 def getAccessData(self, path=None, dom=None, recursive=0, all=False):
160 """returns contents of access tag as dict""" 160 """returns contents of access tag as dict"""
161 return self.getXmlPathData('resource/meta/access-conditions/access', path=path, dom=dom) 161 return self.getXmlPathData('resource/meta/access-conditions/access', path=path, dom=dom, recursive=recursive, all=all)
162 162
163 def getAttributionData(self, path=None, dom=None, all=True): 163 def getAttributionData(self, path=None, dom=None, recursive=0, all=True):
164 """returns contents of attribution tag as dict""" 164 """returns contents of attribution tag as dict"""
165 return self.getXmlPathData('resource/meta/access-conditions/attribution', path=path, dom=dom, all=all) 165 return self.getXmlPathData('resource/meta/access-conditions/attribution', path=path, dom=dom, recursive=recursive, all=all)
166 166
167 def getAttributionFormatted(self, template, path=None, dom=None, data=None, all=True): 167 def getAttributionFormatted(self, template, path=None, dom=None, data=None, recursive=0, all=True):
168 """returns formatted contents of access tag""" 168 """returns formatted contents of access tag"""
169 return self.getXmlPathFormatted('resource/meta/access-conditions/attribution', template, path=path, dom=dom, data=data, all=all) 169 return self.getXmlPathFormatted('resource/meta/access-conditions/attribution', template, path=path, dom=dom, data=data, recursive=recursive, all=all)
170 170
171 def getCopyrightData(self, path=None, dom=None, recursive=1, all=True): 171 def getCopyrightData(self, path=None, dom=None, recursive=1, all=True):
172 """returns contents of copyright tag as dict""" 172 """returns contents of copyright tag as dict"""
173 # information is two tags deep - recursive=1 173 # information is two tags deep - recursive=1
174 return self.getXmlPathData('resource/meta/access-conditions/copyright', path=path, dom=dom, recursive=recursive, all=all) 174 return self.getXmlPathData('resource/meta/access-conditions/copyright', path=path, dom=dom, recursive=recursive, all=all)
176 def getCopyrightFormatted(self, template, path=None, dom=None, data=None, recursive=1, all=True): 176 def getCopyrightFormatted(self, template, path=None, dom=None, data=None, recursive=1, all=True):
177 """returns formatted contents of access tag""" 177 """returns formatted contents of access tag"""
178 # information is two tags deep - recursive=1 178 # information is two tags deep - recursive=1
179 return self.getXmlPathFormatted('resource/meta/access-conditions/copyright', template, path=path, dom=dom, data=data, recursive=recursive, all=all) 179 return self.getXmlPathFormatted('resource/meta/access-conditions/copyright', template, path=path, dom=dom, data=data, recursive=recursive, all=all)
180 180
181 def getContextData(self, path=None, dom=None, all=True): 181 def getContextData(self, path=None, dom=None, recursive=0, all=True):
182 """returns contents of context tag as dict""" 182 """returns contents of context tag as dict"""
183 # information is two tags deep - recursive=1 183 # information is two tags deep - recursive=1
184 return self.getXmlPathData('resource/meta/context', path=path, dom=dom, all=all) 184 return self.getXmlPathData('resource/meta/context', path=path, dom=dom, recursive=recursive, all=all)
185 185
186 186
187 def getDRI(self, path=None, dom=None, type="escidoc"): 187 def getDRI(self, path=None, dom=None, type="escidoc"):
188 """returns the DRI of the document""" 188 """returns the DRI of the document"""
189 dris = self.getXmlPathData('resource/meta/dri', path=path, dom=dom, all=True) 189 dris = self.getXmlPathData('resource/meta/dri', path=path, dom=dom, all=True)