[z3-checkins] r31276 - z3/jsonserver/branch/merge/z2_compatibility

reebalazs at codespeak.net reebalazs at codespeak.net
Sun Aug 13 08:16:58 CEST 2006


Author: reebalazs
Date: Sun Aug 13 08:16:55 2006
New Revision: 31276

Modified:
   z3/jsonserver/branch/merge/z2_compatibility/jsonrpc.py
Log:
Get rid of zLOG deprecation messages

Modified: z3/jsonserver/branch/merge/z2_compatibility/jsonrpc.py
==============================================================================
--- z3/jsonserver/branch/merge/z2_compatibility/jsonrpc.py	(original)
+++ z3/jsonserver/branch/merge/z2_compatibility/jsonrpc.py	Sun Aug 13 08:16:55 2006
@@ -17,14 +17,15 @@
 from Products.jsonserver.minjson import read, write, ReadException, WriteException
 from zExceptions.ExceptionFormatter import format_exception
 from StringIO import StringIO
-import sys, traceback, re
-from zLOG import LOG, INFO, DEBUG, WARNING, ERROR
+import sys, traceback, re, logging
 from cgi import FieldStorage
 import  ZPublisher.HTTPResponse
 from zope.interface import directlyProvides, directlyProvidedBy
 from interfaces import IJsonRequest
 from ZPublisher.HTTPRequest import HTTPRequest
 
+logger = logging.getLogger('jsonserver')
+
 try:
     from zope.app.publication.browser import setDefaultSkin
 except ImportError:
@@ -73,7 +74,7 @@
     params = data[u'params']
     # Translate '.' to '/' in meth to represent object traversal.
     method = method.replace('.', '/')
-    LOG('jsonserver', DEBUG, "processing request %s" % (data, ))
+    logger.debug("processing request %s" % (data, ))
     
     # Separare positional keywords from args
     # this works if client emits {'jsonclass': ['zope.kw', kw]}
@@ -158,13 +159,13 @@
         if self._jsonID is None:
             self._real.setBody('')
             self._real.setStatus(204)
-            LOG('jsonserver', DEBUG, "processing response 204 for id=%s" % (self._jsonID, ))
+            logger.debug("processing response 204 for id=%s" % (self._jsonID, ))
         else:
             body = premarshal(body)
             wrapper = {'id':self._jsonID}
             wrapper['result'] = body
             wrapper['error'] = None
-            LOG('jsonserver', DEBUG, "processing response %s" % (wrapper, ))
+            logger.debug("processing response %s" % (wrapper, ))
             response_encoding = self._response_encoding()
             content_type, cookedbody = get_response(wrapper, response_encoding)
             self._real.setHeader('content-type', content_type)
@@ -181,7 +182,7 @@
         else: 
             t, v, tb = sys.exc_info()
 
-        LOG('jsonserver', ERROR, 'Exception caught:' + '\n'.join(format_exception(t, v, tb)))
+        logger.error('Exception caught:' + '\n'.join(format_exception(t, v, tb)))
         s = '%s: %s' % (getattr(t, '__name__', t), v)
         wrapper = {'id': self._jsonID}
         wrapper['result'] = None
@@ -257,10 +258,10 @@
             charset = match.group(1)
         else:
             charset = 'utf-8'
-        #LOG('jsonserver', DEBUG, 'Considering request charset %s' % (repr(charset), None))
+        #logger.debug('Considering request charset %s' % (repr(charset), None))
         jsonID, meth, self.args, keywords = parse_input(fs.value, charset)
         # set the keywords on the form
-        #LOG('jsonserver', DEBUG, 'Keywords: %s' % (repr(keywords), ))
+        #logger.debug('Keywords: %s' % (repr(keywords), ))
         for key, value in keywords.iteritems():
             # make sure key is not unicode, but normal string!
             # XXX TODO Cannot decide the right policy here.
@@ -305,4 +306,4 @@
     'This will patch HTTPRequest to enable json-rpc handling'
     HTTPRequest._processInputs_jsonrc_patched, HTTPRequest.processInputs = \
         HTTPRequest.processInputs, processInputs
-    LOG('jsonserver', INFO, '*** Patching ZPublisher.HTTPRequest for json-rpc ***')
+    logger.info('*** Patching ZPublisher.HTTPRequest for json-rpc ***')


More information about the z3-checkins mailing list