def handleURI(self, context, relativeUri): if relativeUri is not None and 'loginHandler' in relativeUri: if self._form._window is not None: self._form._window.removeURIHandler(self) downloadStream = DownloadStream(StringIO(self._responce), 'text/html', 'loginSuccesfull') downloadStream.setCacheTime(-1) return downloadStream else: return None
def getStream(self): """@see: L{IApplicationResource.getStream}""" ss = self.getStreamSource() if ss is None: return None ds = DownloadStream(ss.getStream(), self.getMIMEType(), self.getFilename()) ds.setBufferSize(self.getBufferSize()) ds.setCacheTime(self._cacheTime) return ds
def getStream(self): """Gets resource as stream. @see: L{IApplicationResource.getStream} """ ds = DownloadStream( self._associatedClass.getResourceAsStream(self._resourceName), self.getMIMEType(), self.getFilename()) ds.setBufferSize(self.getBufferSize()) ds.setCacheTime(self._cacheTime) return ds
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
def getStream(self): return DownloadStream(StringIO(self._form.getLoginHTML()), self.getMIMEType(), self.getFilename())
def getStream(self): return DownloadStream(StringIO(self._markerSource.getMarkerJSON()), self.getMIMEType(), self.getFilename())