--- ECHO_content/ECHO_collection.py 2004/09/01 19:11:36 1.169 +++ ECHO_content/ECHO_collection.py 2004/09/28 15:00:08 1.171 @@ -1135,7 +1135,9 @@ class ECHO_resource(Folder,Persistent): texttools=dom.getElementsByTagName('texttool') text=texttools[0].getElementsByTagName('text') texturl=getText(text[0].childNodes) - + if not (texturl.split(":")[0] in ['http','ftp','file']): + texturl=re.sub("//","/",texturl) + #return texturl+"::"+texturl.split(":")[0] if not noredirect: self.REQUEST.RESPONSE.setHeader('Content-Type','text/xml') self.REQUEST.RESPONSE.redirect(texturl) @@ -2278,6 +2280,11 @@ class ECHO_collection(Folder, Persistent def getCollectionTreeXML(self): """Tree as XML""" + def addPassWd(str): + """adds a user/passwd to an url""" + txt2=re.sub(r"(http://)(.*?)","\g<1>www:3333@\g<2>",str) + return txt2 + def getCollection(object,depth=0): depth+=1 collections="" @@ -2285,7 +2292,7 @@ class ECHO_collection(Folder, Persistent element=getattr(object,entry) try: if element.meta_type in ["ECHO_collection","ECHO_group"]: - collections+="" + collections+="" collections+=getCollection(element,depth)+"\n" except: """nothing""" @@ -3675,11 +3682,22 @@ class ECHO_root(Folder,Persistent,Implic def getMetaDatasXML(self,viewerType=None,filter=None): """gebe all ressourcen aus""" + # check if the request's host part was OK + http_host = self.REQUEST['HTTP_HOST'] + host_port = self.REQUEST['SERVER_PORT'] + fix_host = None + if http_host and http_host.rfind(host_port) == -1: + print "HTTP_HOST needs fixing!" + fix_host = http_host + ":" + host_port + ret=""" """ for resource in self.ZopeFind(self,obj_metatypes=['ECHO_resource'],search_sub=1): echo_url=resource[1].absolute_url() + if fix_host: + #print "replacing ", http_host, " by ", fix_host + echo_url = string.replace(echo_url, http_host, fix_host, 1) if hasattr(resource[1],'link'): meta_url=echo_url+"/getMetaDataXML" @@ -3697,8 +3715,7 @@ class ECHO_root(Folder,Persistent,Implic ret +="""\n""" - - + self.REQUEST.RESPONSE.setHeader("Content-Type", "text/xml") self.REQUEST.RESPONSE.write(ret)