Package muntjac :: Package data :: Package util :: Package filter :: Module unsupported_filter_exception
[hide private]
[frames] | no frames]

Source Code for Module muntjac.data.util.filter.unsupported_filter_exception

 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  """Exception for cases where a container does not support a specific 
17  type of filters.""" 
18   
19 -class UnsupportedFilterException(RuntimeError):
20 """Exception for cases where a container does not support a specific 21 type of filters. 22 23 If possible, this should be thrown already when adding a filter to a 24 container. If a problem is not detected at that point, an 25 L{NotImplementedError} can be thrown when attempting to perform filtering. 26 """ 27
28 - def __init__(self, *args):
29 nargs = len(args) 30 if nargs == 0: 31 pass 32 elif nargs == 1: 33 if isinstance(args[0], Exception): 34 cause, = args 35 super(UnsupportedFilterException, self).__init__(cause) 36 else: 37 message, = args 38 super(UnsupportedFilterException, self).__init__(message) 39 elif nargs == 2: 40 message, cause = args 41 super(UnsupportedFilterException, self).__init__(message, cause) 42 else: 43 raise ValueError
44