Package muntjac :: Package event :: Package dd :: Package acceptcriteria :: Module client_side_criterion
[hide private]
[frames] | no frames]

Source Code for Module muntjac.event.dd.acceptcriteria.client_side_criterion

 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  """Parent class for criteria that can be completely validated on client 
17  side.""" 
18   
19  from muntjac.event.dd.acceptcriteria.accept_criterion import IAcceptCriterion 
20  from muntjac.util import clsname 
21   
22   
23 -class ClientSideCriterion(IAcceptCriterion):
24 """Parent class for criteria that can be completely validated on client 25 side. All classes that provide criteria that can be completely validated 26 on client side should extend this class. 27 28 It is recommended that subclasses of ClientSideCriterion re-validate the 29 condition on the server side in L{IAcceptCriterion.accept} after 30 the client side validation has accepted a transfer. 31 """ 32
33 - def isClientSideVerifiable(self):
34 return True
35 36
37 - def paint(self, target):
38 target.startTag('-ac') 39 target.addAttribute('name', self.getIdentifier()) 40 self.paintContent(target) 41 target.endTag('-ac')
42 43
44 - def paintContent(self, target):
45 pass
46 47
48 - def getIdentifier(self):
49 return clsname(self.__class__) # FIXME: Python client-side
50 51
52 - def paintResponse(self, target):
53 # NOP, nothing to do as this is client side verified criterion 54 pass
55