def getStream(self): """Gets the resource as stream. @see: L{IApplicationResource.getStream} """ try: ds = DownloadStream(file(self._sourceFile, "rb"), self.getMIMEType(), self.getFilename()) length = str(getsize(self._sourceFile)) ds.setParameter("Content-Length", length) ds.setCacheTime(self._cacheTime) return ds except IOError: # Log the exception using the application error handler class Error(IErrorEvent): def getThrowable(self): return self.e self.getApplication().getErrorHandler().terminalError(Error()) return None
def getStream(self): """Gets the resource as stream. @see: L{IApplicationResource.getStream} """ try: ds = DownloadStream(file(self._sourceFile, 'rb'), self.getMIMEType(), self.getFilename()) length = str(getsize(self._sourceFile)) ds.setParameter('Content-Length', length) ds.setCacheTime(self._cacheTime) return ds except IOError: # Log the exception using the application error handler class Error(IErrorEvent): def getThrowable(self): return self.e self.getApplication().getErrorHandler().terminalError(Error()) return None