--- zogiLib/zogiLib.py 2004/05/06 14:20:58 1.16 +++ zogiLib/zogiLib.py 2004/05/18 17:54:34 1.17 @@ -20,12 +20,25 @@ def getString(self,key,default=''): except: return default - def sendFile(self, filename, type): - """schickt ein lokales file (aus dem Produkt) als response""" - fn = os.path.join(package_home(globals()), filename) - self.REQUEST.RESPONSE.setHeader('Content-Type', type) - self.REQUEST.RESPONSE.write(file(fn).read()) + """sends an object or a local file (in the product) as response""" + paths = filename.split('/') + object = self + # look for an object called filename + for path in paths: + if hasattr(object, path): + object = getattr(object, path) + else: + object = None + break + if object: + # send the object + object() + else: + # send a local file with the given content-type + fn = os.path.join(package_home(globals()), filename) + self.REQUEST.RESPONSE.setHeader("Content-Type", type) + self.REQUEST.RESPONSE.write(file(fn).read()) return class zogiLib_navTemplate(ZopePageTemplate):