コード例 #1
0
ファイル: login_form.py プロジェクト: MatiasNAmendola/muntjac
 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
ファイル: login_form.py プロジェクト: fbeneventi/muntjac
 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
ファイル: class_resource.py プロジェクト: Lemoncandy/muntjac
    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
コード例 #5
0
ファイル: file_resource.py プロジェクト: AvdN/muntjac
    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
コード例 #6
0
ファイル: stream_resource.py プロジェクト: fbeneventi/muntjac
 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
コード例 #7
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
コード例 #8
0
ファイル: file_resource.py プロジェクト: fbeneventi/muntjac
    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
コード例 #9
0
ファイル: login_form.py プロジェクト: fbeneventi/muntjac
 def getStream(self):
     return DownloadStream(StringIO(self._form.getLoginHTML()),
                           self.getMIMEType(), self.getFilename())
コード例 #10
0
ファイル: google_map.py プロジェクト: fbeneventi/muntjac
 def getStream(self):
     return DownloadStream(StringIO(self._markerSource.getMarkerJSON()),
             self.getMIMEType(), self.getFilename())