Пример #1
0
 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
Пример #2
0
 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
Пример #3
0
 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
Пример #4
0
 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
Пример #5
0
    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
Пример #6
0
    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
Пример #7
0
    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
Пример #8
0
    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