Show
Ignore:
Timestamp:
06/20/08 20:45:18 (7 months ago)
Author:
thijs
Message:

Adding branch for tickets #306, #316, #317

Location:
pyamf/branches/client-headers
Files:
5 modified
1 copied

Legend:

Unmodified
Added
Removed
  • pyamf/branches/client-headers/pyamf/remoting/gateway/__init__.py

    r1441 r1444  
    88""" 
    99 
     10import platform 
    1011import types 
    1112 
    1213import pyamf 
    1314from pyamf import remoting, logging, util 
     15 
     16DEFAULT_SERVER_NAME = 'PyAMF/%s Python/%s' % ( 
     17    '.'.join(map(lambda x: str(x), pyamf.__version__)), 
     18    platform.python_version() 
     19) 
    1420 
    1521fault_alias = pyamf.get_class_alias(remoting.ErrorFault) 
  • pyamf/branches/client-headers/pyamf/remoting/gateway/django.py

    r1441 r1444  
    8787            request = remoting.decode(http_request.raw_post_data, context) 
    8888        except pyamf.DecodeError: 
    89             self.logger.error(gateway.format_exception()) 
     89            self.logger.exception(gateway.format_exception()) 
    9090            http_response.status_code = 400 
    9191 
     
    100100            raise 
    101101        except: 
    102             self.logger.error(gateway.format_exception()) 
     102            self.logger.exception(gateway.format_exception()) 
    103103 
    104104            return http.HttpResponseServerError() 
     
    110110            stream = remoting.encode(response, context) 
    111111        except pyamf.EncodeError: 
    112             self.logger.error(gateway.format_exception()) 
     112            self.logger.exception(gateway.format_exception()) 
    113113 
    114114            return http.HttpResponseServerError('Unable to encode the response') 
     
    117117        http_response['Content-Type'] = remoting.CONTENT_TYPE 
    118118        http_response['Content-Length'] = str(len(buf)) 
     119        http_response['Server'] = gateway.DEFAULT_SERVER_NAME 
    119120        http_response.write(buf) 
    120121 
  • pyamf/branches/client-headers/pyamf/remoting/gateway/google.py

    r1441 r1444  
    6060    def get(self): 
    6161        self.response.headers['Content-Type'] = 'text/plain' 
     62        self.response.headers['Server'] = gateway.DEFAULT_SERVER_NAME 
    6263        self.error(405) 
    6364        self.response.out.write("405 Method Not Allowed\n\n" + \ 
     
    7576            request = remoting.decode(body, context) 
    7677        except pyamf.DecodeError: 
    77             self.logger.error(gateway.format_exception()) 
     78            self.logger.exception(gateway.format_exception()) 
    7879 
    7980            response = "400 Bad Request\n\nThe request body was unable to " \ 
     
    8586            self.error(400) 
    8687            self.response.headers['Content-Type'] = 'text/plain' 
     88            self.response.headers['Server'] = gateway.DEFAULT_SERVER_NAME 
    8789            self.response.out.write(response) 
    8890 
     
    9799            raise 
    98100        except: 
    99             self.logger.error(gateway.format_exception()) 
     101            self.logger.exception(gateway.format_exception()) 
    100102 
    101103            response = "500 Internal Server Error\n\nThe request was " \ 
     
    107109            self.error(500) 
    108110            self.response.headers['Content-Type'] = 'text/plain' 
     111            self.response.headers['Server'] = gateway.DEFAULT_SERVER_NAME 
    109112            self.response.out.write(response) 
    110113 
     
    117120            stream = remoting.encode(response, context) 
    118121        except pyamf.EncodeError: 
    119             self.logger.error(gateway.format_exception()) 
     122            self.logger.exception(gateway.format_exception()) 
    120123 
    121124            response = "500 Internal Server Error\n\nThe request was " \ 
     
    127130            self.error(500) 
    128131            self.response.headers['Content-Type'] = 'text/plain' 
     132            self.response.headers['Server'] = gateway.DEFAULT_SERVER_NAME 
    129133            self.response.out.write(response) 
    130134 
     
    135139        self.response.headers['Content-Type'] = remoting.CONTENT_TYPE 
    136140        self.response.headers['Content-Length'] = str(len(response)) 
     141        self.response.headers['Server'] = gateway.DEFAULT_SERVER_NAME 
     142         
    137143        self.response.out.write(response) 
    138144 
  • pyamf/branches/client-headers/pyamf/remoting/gateway/twisted.py

    r1441 r1444  
    6969 
    7070        def response_cb(result): 
    71             self.gateway.logger.debug("AMF Response: %r" % result) 
    7271            response.body = result 
     72 
     73            self.gateway.logger.debug("AMF Response: %r" % response) 
    7374            deferred_response.callback(response) 
    7475 
     
    124125 
    125126        def response_cb(result): 
    126             self.gateway.logger.debug("AMF Response: %r" % result) 
     127             
    127128            ro_response.body = result 
    128             deferred_response.callback(remoting.Response(ro_response)) 
     129            res = remoting.Response(ro_response) 
     130            self.gateway.logger.debug("AMF Response: %r" % res) 
     131             
     132            deferred_response.callback(res) 
    129133 
    130134        def process_cb(result): 
     
    195199        request.setHeader("Content-Type", mimetype) 
    196200        request.setHeader("Content-Length", str(len(content))) 
     201        request.setHeader("Server", gateway.DEFAULT_SERVER_NAME) 
    197202 
    198203        request.write(content) 
     
    210215            Return HTTP 400 Bad Request. 
    211216            """ 
    212             self.logger.error(failure.printDetailedTraceback()) 
     217            self.logger.exception(failure.printDetailedTraceback()) 
    213218 
    214219            body = "400 Bad Request\n\nThe request body was unable to " \ 
  • pyamf/branches/client-headers/pyamf/remoting/gateway/wsgi.py

    r1441 r1444  
    6161            ('Content-Type', 'text/plain'), 
    6262            ('Content-Length', str(len(response))), 
     63            ('Server', gateway.DEFAULT_SERVER_NAME), 
    6364        ]) 
    6465 
     
    8283            request = remoting.decode(body, context) 
    8384        except pyamf.DecodeError: 
    84             self.logger.error(gateway.format_exception()) 
     85            self.logger.exception(gateway.format_exception()) 
    8586 
    8687            response = "400 Bad Request\n\nThe request body was unable to " \ 
     
    9394                ('Content-Type', 'text/plain'), 
    9495                ('Content-Length', str(len(response))), 
     96                ('Server', gateway.DEFAULT_SERVER_NAME), 
    9597            ]) 
    9698 
     
    105107            raise 
    106108        except: 
    107             self.logger.error(gateway.format_exception()) 
     109            self.logger.exception(gateway.format_exception()) 
    108110 
    109111            response = "500 Internal Server Error\n\nThe request was " \ 
     
    116118                ('Content-Type', 'text/plain'), 
    117119                ('Content-Length', str(len(response))), 
     120                ('Server', gateway.DEFAULT_SERVER_NAME), 
    118121            ]) 
    119122 
     
    126129            stream = remoting.encode(response, context) 
    127130        except pyamf.EncodeError: 
    128             self.logger.error(gateway.format_exception()) 
     131            self.logger.exception(gateway.format_exception()) 
    129132 
    130133            response = "500 Internal Server Error\n\nThe request was " \ 
     
    137140                ('Content-Type', 'text/plain'), 
    138141                ('Content-Length', str(len(response))), 
     142                ('Server', gateway.DEFAULT_SERVER_NAME), 
    139143            ]) 
    140144 
     
    146150            ('Content-Type', remoting.CONTENT_TYPE), 
    147151            ('Content-Length', str(len(response))), 
     152            ('Server', gateway.DEFAULT_SERVER_NAME), 
    148153        ]) 
    149154