cubicweb/pyramid/bwcompat.py
changeset 11913 4516c3956d46
parent 11812 4e0829ade86f
child 11967 83739be20fab
equal deleted inserted replaced
11912:c9e6df20e5a4 11913:4516c3956d46
    50     def __call__(self, request):
    50     def __call__(self, request):
    51         """
    51         """
    52         Handler that mimics what CubicWebPublisher.main_handle_request and
    52         Handler that mimics what CubicWebPublisher.main_handle_request and
    53         CubicWebPublisher.core_handle do
    53         CubicWebPublisher.core_handle do
    54         """
    54         """
    55 
       
    56         # XXX The main handler of CW forbid anonymous https connections
       
    57         # I guess we can drop this "feature" but in doubt I leave this comment
       
    58         # so we don't forget about it. (cdevienne)
       
    59 
    55 
    60         req = request.cw_request
    56         req = request.cw_request
    61         vreg = request.registry['cubicweb.registry']
    57         vreg = request.registry['cubicweb.registry']
    62 
    58 
    63         try:
    59         try:
   168     def __init__(self, handler, registry):
   164     def __init__(self, handler, registry):
   169         self.handler = handler
   165         self.handler = handler
   170         self.cwhandler = registry['cubicweb.handler']
   166         self.cwhandler = registry['cubicweb.handler']
   171 
   167 
   172     def __call__(self, request):
   168     def __call__(self, request):
   173         if request.path.startswith('/https/'):
       
   174             request.environ['PATH_INFO'] = request.environ['PATH_INFO'][6:]
       
   175             assert not request.path.startswith('/https/')
       
   176             request.scheme = 'https'
       
   177         try:
   169         try:
   178             response = self.handler(request)
   170             response = self.handler(request)
   179         except httpexceptions.HTTPNotFound:
   171         except httpexceptions.HTTPNotFound:
   180             response = self.cwhandler(request)
   172             response = self.cwhandler(request)
   181         return response
   173         return response