Package muntjac :: Package terminal :: Module uri_handler
[hide private]
[frames] | no frames]

Source Code for Module muntjac.terminal.uri_handler

 1  # Copyright (C) 2012 Vaadin Ltd.  
 2  # Copyright (C) 2012 Richard Lincoln 
 3  #  
 4  # Licensed under the Apache License, Version 2.0 (the "License");  
 5  # you may not use this file except in compliance with the License.  
 6  # You may obtain a copy of the License at  
 7  #  
 8  #     http://www.apache.org/licenses/LICENSE-2.0  
 9  #  
10  # Unless required by applicable law or agreed to in writing, software  
11  # distributed under the License is distributed on an "AS IS" BASIS,  
12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13  # See the License for the specific language governing permissions and  
14  # limitations under the License. 
15   
16  from muntjac.terminal.terminal import IErrorEvent as ITerminalErrorEvent 
17   
18   
19 -class IUriHandler(object):
20 """A IUriHandler is used for handling URIs requested by the user and can 21 optionally provide a L{DownloadStream}. If a L{DownloadStream} 22 is returned by L{handleURI}, the stream is sent to the client. 23 24 @author: Vaadin Ltd. 25 @author: Richard Lincoln 26 @version: 1.1.2 27 """ 28
29 - def handleURI(self, context, relativeUri):
30 """Handles a given URI. If the URI handler to emit a downloadable 31 stream it should return a C{DownloadStream} object. 32 33 @param context: 34 the base URL 35 @param relativeUri: 36 a URI relative to C{context} 37 @return: A downloadable stream or null if no stream is provided 38 """ 39 pass
40 41
42 -class IErrorEvent(ITerminalErrorEvent):
43 """An C{IErrorEvent} implementation for IUriHandler.""" 44
45 - def getURIHandler(self):
46 """Gets the IUriHandler that caused this error. 47 48 @return: the IUriHandler that caused the error 49 """ 50 pass
51