version 1.93, 2008/11/19 14:22:42
|
version 1.98, 2009/04/16 15:40:42
|
Line 19 import bz2
|
Line 19 import bz2
|
import xmlrpclib |
import xmlrpclib |
import sys |
import sys |
import logging |
import logging |
|
import amara |
|
|
#erstzt logging |
#erstzt logging |
def logger(txt,method,txt2): |
def logger(txt,method,txt2): |
Line 27 def logger(txt,method,txt2):
|
Line 28 def logger(txt,method,txt2):
|
|
|
displayTypes = ['ZSQLExtendFolder','ZSQLBibliography','ECHO_group','ECHO_collection','ECHO_resource','ECHO_link','ECHO_sqlElement','ECHO_pageTemplate','ECHO_externalLink','ImageCollectionIFrame','VLP_resource','VLP_essay','ECHO_ZCatalogElement','ImageCollection','versionedFileFolder','extVersionedFileFolder','ECHO_movie'] |
displayTypes = ['ZSQLExtendFolder','ZSQLBibliography','ECHO_group','ECHO_collection','ECHO_resource','ECHO_link','ECHO_sqlElement','ECHO_pageTemplate','ECHO_externalLink','ImageCollectionIFrame','VLP_resource','VLP_essay','ECHO_ZCatalogElement','ImageCollection','versionedFileFolder','extVersionedFileFolder','ECHO_movie'] |
|
|
|
def normalizeCt(str): |
|
"""normalizes content_type""" |
|
#str= str.replace(" ","_") |
|
return str.replace("-"," ").lower() |
|
|
#decode and compress for xmlrpc communication with OSAS_server |
#decode and compress for xmlrpc communication with OSAS_server |
|
|
Line 87 class ECHO_basis:
|
Line 92 class ECHO_basis:
|
# Managment for the PID |
# Managment for the PID |
def setPID(self,pid): |
def setPID(self,pid): |
"""set the pid""" |
"""set the pid""" |
|
logging.debug(self.getID()+" PID set to "+pid) |
self.pid=pid |
self.pid=pid |
return True |
return True |
|
|
def getPID(self): |
def getPID(self): |
"""get the pid""" |
"""get the pid""" |
return getattr(self,'pid',None) |
|
|
|
|
pid =getattr(self,'pid',None) |
|
|
|
if pid == self.getParentPID(): |
|
return None |
|
else: |
|
return pid |
|
|
|
|
|
def getParentPID(self): |
|
"""get the PID of the parent""" |
|
parent = self.aq_parent |
|
|
|
pidF = getattr(parent,'getPID',None) |
|
|
|
if pidF is None: |
|
return None |
|
|
|
else: |
|
return pidF() |
|
|
def unicodify(self, s): |
def unicodify(self, s): |
"""return unicode object for string (utf-8 or latin1) or unicode object s""" |
"""return unicode object for string (utf-8 or latin1) or unicode object s""" |
Line 119 class ECHO_basis:
|
Line 143 class ECHO_basis:
|
def showRDF(self): |
def showRDF(self): |
"""showrdf""" |
"""showrdf""" |
self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml') |
self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml') |
ret="""<?xml version="1.0" encoding="utf-8"?>\n<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ECHONAVIGATION="http://www.echo.eu/rdf#">\n""" |
ret="""<?xml version="1.0" encoding="utf-8"?>\n<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ECHONAVIGATION="http://www.echo.eu/rdf#" |
|
xmlns:MPIWG="http://www.mpiwg-berlin.mpg.de/ns/mpiwg">\n""" |
|
|
ret+=self.getRDF(urn="echo:collectionroot")+"\n" |
ret+=self.getRDF(urn="echo:collectionroot")+"\n" |
|
|
Line 182 class ECHO_basis:
|
Line 207 class ECHO_basis:
|
nurn=self.absolute_url()+'/showMetaDataXML' |
nurn=self.absolute_url()+'/showMetaDataXML' |
ret+=getRDFDescription(self,self.absolute_url()+'/showMetaDataXML',urn=nurn,nameDef="Metadata",typeName="ECHO_metaData") |
ret+=getRDFDescription(self,self.absolute_url()+'/showMetaDataXML',urn=nurn,nameDef="Metadata",typeName="ECHO_metaData") |
|
|
return ret |
|
|
|
|
return ret |
def content_html_XMLRpc(self): |
def content_html_XMLRpc(self): |
"""xml_rpc_version""" |
"""xml_rpc_version""" |
return encodeRPC(self.content_html()) |
return encodeRPC(self.content_html()) |
Line 629 def readFieldFromXML(meta_url,parent,fie
|
Line 654 def readFieldFromXML(meta_url,parent,fie
|
|
|
return getText(field[0].childNodes) |
return getText(field[0].childNodes) |
|
|
|
def readFieldFromXML_xpath(meta_url,xpath): |
|
"""xpath auf meta_url""" |
|
#logging.debug("try to parse:"+meta_url) |
|
#logging.debug("Xtry to parse xpath:"+xpath) |
|
doc = amara.parse(meta_url) |
|
#logging.debug("have:"+doc.xml()) |
|
node= doc.xml_xpath(xpath) |
|
if node is None: |
|
return None |
|
|
|
return unicode(node[0]) |
|
|
def urlopen(url): |
def urlopen(url): |
"""urlopen mit timeout""" |
"""urlopen mit timeout""" |
Line 798 def reloadMetaDataFromStorage(self,RESPO
|
Line 833 def reloadMetaDataFromStorage(self,RESPO
|
|
|
return ret |
return ret |
|
|
def getRDFDescription(self,linkURL,urn=None,nameDef=None,typeName=None): |
def getRDFDescription(self,linkURL,urn=None,nameDef=None,typeName=None,ap=""): |
"""rdf""" |
"""rdf""" |
|
|
ret="" |
ret="" |
Line 808 def getRDFDescription(self,linkURL,urn=N
|
Line 843 def getRDFDescription(self,linkURL,urn=N
|
clickable="""<ECHONAVIGATION:linkClickable>%s</ECHONAVIGATION:linkClickable>""" |
clickable="""<ECHONAVIGATION:linkClickable>%s</ECHONAVIGATION:linkClickable>""" |
#link="""<ECHONAVIGATION:link RDF:about="%s"/>""" |
#link="""<ECHONAVIGATION:link RDF:about="%s"/>""" |
type="""<ECHONAVIGATION:type>%s</ECHONAVIGATION:type>""" |
type="""<ECHONAVIGATION:type>%s</ECHONAVIGATION:type>""" |
|
|
#xlink="""<ECHONAVIGATION:xlink xlink:href="%s"/>""" |
#xlink="""<ECHONAVIGATION:xlink xlink:href="%s"/>""" |
|
|
|
if ap=="": |
|
ap2="" |
|
else: |
|
ap2 = """<MPIWG:archive-path>%s</MPIWG:archive-path>"""%ap |
|
|
if not urn: |
if not urn: |
#urn="urn:"+re.sub('/',':',self.absolute_url()) |
#urn="urn:"+re.sub('/',':',self.absolute_url()) |
urn=self.absolute_url() |
urn=self.absolute_url() |
Line 835 def getRDFDescription(self,linkURL,urn=N
|
Line 877 def getRDFDescription(self,linkURL,urn=N
|
else: |
else: |
type2=type%typeName |
type2=type%typeName |
|
|
|
|
#ret=about2+"\n"+name2+"\n"+link2+"\n"+type2+"\n"+clickable2+"\n</RDF:Description>" |
#ret=about2+"\n"+name2+"\n"+link2+"\n"+type2+"\n"+clickable2+"\n</RDF:Description>" |
ret=about2+"\n"+name2+"\n"+type2+"\n"+clickable2+"\n</RDF:Description>" |
ret=about2+"\n"+name2+"\n"+type2+"\n"+clickable2+"\n"+ap2+"\n</RDF:Description>" |
return ret |
return ret |
|
|
def getCopyrightsFromForm(self,argv): |
def getCopyrightsFromForm(self,argv): |