Changeset 1486 for pyamf/trunk

Show
Ignore:
Timestamp:
07/08/08 19:51:10 (6 months ago)
Author:
nick
Message:

Reverting r1474

Location:
pyamf/trunk
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • pyamf/trunk/CHANGES.txt

    r1475 r1486  
    770.4.0 (unreleased) 
    88------------------ 
    9  - The remoting gateways now send a customizable Server header (Ticket:317) 
    109 - The remoting client now sends a customizable User-Agent header (Ticket:306) 
    1110 - Added ability to set the HTTP referer in remoting client (Ticket:316) 
  • pyamf/trunk/pyamf/remoting/gateway/__init__.py

    r1477 r1486  
    88""" 
    99 
    10 import platform 
    1110import types 
    1211 
    1312import pyamf 
    1413from pyamf import remoting, logging, util 
    15  
    16 #: Value for the Server response-header that contains  
    17 #: information about the PyAMF and Python version used 
    18 #: by the origin server to handle the request.  
    19 SERVER_NAME = 'PyAMF/%s Python/%s' % ( 
    20     '.'.join(map(lambda x: str(x), pyamf.__version__)), 
    21     platform.python_version() 
    22 ) 
    2314 
    2415fault_alias = pyamf.get_class_alias(remoting.ErrorFault) 
  • pyamf/trunk/pyamf/remoting/gateway/django.py

    r1474 r1486  
    8787            request = remoting.decode(http_request.raw_post_data, context) 
    8888        except pyamf.DecodeError: 
    89             self.logger.exception(gateway.format_exception()) 
     89            self.logger.error(gateway.format_exception()) 
    9090            http_response.status_code = 400 
    9191 
     
    100100            raise 
    101101        except: 
    102             self.logger.exception(gateway.format_exception()) 
     102            self.logger.error(gateway.format_exception()) 
    103103 
    104104            return http.HttpResponseServerError() 
     
    110110            stream = remoting.encode(response, context) 
    111111        except pyamf.EncodeError: 
    112             self.logger.exception(gateway.format_exception()) 
     112            self.logger.error(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.SERVER_NAME 
    120119        http_response.write(buf) 
    121120 
  • pyamf/trunk/pyamf/remoting/gateway/google.py

    r1474 r1486  
    6060    def get(self): 
    6161        self.response.headers['Content-Type'] = 'text/plain' 
    62         self.response.headers['Server'] = gateway.SERVER_NAME 
    6362        self.error(405) 
    6463        self.response.out.write("405 Method Not Allowed\n\n" + \ 
     
    7675            request = remoting.decode(body, context) 
    7776        except pyamf.DecodeError: 
    78             self.logger.exception(gateway.format_exception()) 
     77            self.logger.error(gateway.format_exception()) 
    7978 
    8079            response = "400 Bad Request\n\nThe request body was unable to " \ 
     
    8685            self.error(400) 
    8786            self.response.headers['Content-Type'] = 'text/plain' 
    88             self.response.headers['Server'] = gateway.SERVER_NAME 
    8987            self.response.out.write(response) 
    9088 
     
    9997            raise 
    10098        except: 
    101             self.logger.exception(gateway.format_exception()) 
     99            self.logger.error(gateway.format_exception()) 
    102100 
    103101            response = "500 Internal Server Error\n\nThe request was " \ 
     
    109107            self.error(500) 
    110108            self.response.headers['Content-Type'] = 'text/plain' 
    111             self.response.headers['Server'] = gateway.SERVER_NAME 
    112109            self.response.out.write(response) 
    113110 
     
    120117            stream = remoting.encode(response, context) 
    121118        except pyamf.EncodeError: 
    122             self.logger.exception(gateway.format_exception()) 
     119            self.logger.error(gateway.format_exception()) 
    123120 
    124121            response = "500 Internal Server Error\n\nThe request was " \ 
     
    130127            self.error(500) 
    131128            self.response.headers['Content-Type'] = 'text/plain' 
    132             self.response.headers['Server'] = gateway.SERVER_NAME 
    133129            self.response.out.write(response) 
    134130 
     
    139135        self.response.headers['Content-Type'] = remoting.CONTENT_TYPE 
    140136        self.response.headers['Content-Length'] = str(len(response)) 
    141         self.response.headers['Server'] = gateway.SERVER_NAME 
    142          
    143137        self.response.out.write(response) 
    144138 
  • pyamf/trunk/pyamf/remoting/gateway/twisted.py

    r1474 r1486  
    6969 
    7070        def response_cb(result): 
     71            self.gateway.logger.debug("AMF Response: %r" % result) 
    7172            response.body = result 
    72  
    73             self.gateway.logger.debug("AMF Response: %r" % response) 
    7473            deferred_response.callback(response) 
    7574 
     
    125124 
    126125        def response_cb(result): 
    127              
     126            self.gateway.logger.debug("AMF Response: %r" % result) 
    128127            ro_response.body = result 
    129             res = remoting.Response(ro_response) 
    130             self.gateway.logger.debug("AMF Response: %r" % res) 
    131              
    132             deferred_response.callback(res) 
     128            deferred_response.callback(remoting.Response(ro_response)) 
    133129 
    134130        def process_cb(result): 
     
    199195        request.setHeader("Content-Type", mimetype) 
    200196        request.setHeader("Content-Length", str(len(content))) 
    201         request.setHeader("Server", gateway.SERVER_NAME) 
    202197 
    203198        request.write(content) 
     
    215210            Return HTTP 400 Bad Request. 
    216211            """ 
    217             self.logger.exception(failure.printDetailedTraceback()) 
     212            self.logger.error(failure.printDetailedTraceback()) 
    218213 
    219214            body = "400 Bad Request\n\nThe request body was unable to " \ 
  • pyamf/trunk/pyamf/remoting/gateway/wsgi.py

    r1474 r1486  
    6161            ('Content-Type', 'text/plain'), 
    6262            ('Content-Length', str(len(response))), 
    63             ('Server', gateway.SERVER_NAME), 
    6463        ]) 
    6564 
     
    8382            request = remoting.decode(body, context) 
    8483        except pyamf.DecodeError: 
    85             self.logger.exception(gateway.format_exception()) 
     84            self.logger.error(gateway.format_exception()) 
    8685 
    8786            response = "400 Bad Request\n\nThe request body was unable to " \ 
     
    9493                ('Content-Type', 'text/plain'), 
    9594                ('Content-Length', str(len(response))), 
    96                 ('Server', gateway.SERVER_NAME), 
    9795            ]) 
    9896 
     
    107105            raise 
    108106        except: 
    109             self.logger.exception(gateway.format_exception()) 
     107            self.logger.error(gateway.format_exception()) 
    110108 
    111109            response = "500 Internal Server Error\n\nThe request was " \ 
     
    118116                ('Content-Type', 'text/plain'), 
    119117                ('Content-Length', str(len(response))), 
    120                 ('Server', gateway.SERVER_NAME), 
    121118            ]) 
    122119 
     
    129126            stream = remoting.encode(response, context) 
    130127        except pyamf.EncodeError: 
    131             self.logger.exception(gateway.format_exception()) 
     128            self.logger.error(gateway.format_exception()) 
    132129 
    133130            response = "500 Internal Server Error\n\nThe request was " \ 
     
    140137                ('Content-Type', 'text/plain'), 
    141138                ('Content-Length', str(len(response))), 
    142                 ('Server', gateway.SERVER_NAME), 
    143139            ]) 
    144140 
     
    150146            ('Content-Type', remoting.CONTENT_TYPE), 
    151147            ('Content-Length', str(len(response))), 
    152             ('Server', gateway.SERVER_NAME), 
    153148        ]) 
    154149