Package bodhi
[hide private]
[frames] | no frames]

Source Code for Package bodhi

 1  # $Id: $ 
 2   
 3  ## 
 4  ## Monkeypatch CherryPy's DecodingFilter to fix the issue when someone 
 5  ## POSTs a request after their session times out.  This filter will prevent 
 6  ## the decoding from happening twice. 
 7  ## 
 8  ## Taken from http://trac.turbogears.org/ticket/1022#comment:4 
 9  ## 
10   
11  import cherrypy 
12  from cherrypy.filters.basefilter import BaseFilter 
13   
14 -class BodhiDecodingFilter(BaseFilter):
15 """Automatically decodes request parameters (except uploads).""" 16
17 - def before_main(self):
18 conf = cherrypy.config.get 19 if not conf('decoding_filter.on', False): 20 return 21 if getattr(cherrypy.request, "_decoding_attempted", False): 22 return 23 cherrypy.request._decoding_attempted = True
24 25 from cherrypy.filters.decodingfilter import DecodingFilter 26 DecodingFilter.before_main = BodhiDecodingFilter().before_main 27