From 181951ce6debfaedb814d9f390b5b5944f6d2df1 Mon Sep 17 00:00:00 2001 From: Felix Rabe Date: Mon, 16 Jul 2007 13:47:08 +0200 Subject: [PATCH] QotW - Alex: 'i always use print for debugging - i've never found that i needed more' --- Systematiki/Networking/BlockingStringProtocol.py | 16 ---------------- Systematiki/Networking/GObjectStringProtocol.py | 5 ----- Systematiki/Networking/XDRRPC.py | 7 ++----- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/Systematiki/Networking/BlockingStringProtocol.py b/Systematiki/Networking/BlockingStringProtocol.py index d789e16..b6fc6d2 100644 --- a/Systematiki/Networking/BlockingStringProtocol.py +++ b/Systematiki/Networking/BlockingStringProtocol.py @@ -30,25 +30,9 @@ TODO: Properly track closing of connection. # http://infon.dividuum.de/trac/browser/trunk/contrib/infon-devel/infonconn.py # (example for non-blocking connect) -import logging import socket import struct -# logging.basicConfig(level=logging.WARNING, -logging.basicConfig(level=logging.DEBUG, - format="%(asctime)s %(levelname)s %(message)s") - - -def _dbg(f): - def g(*a, **kw): - logging.debug("%s -> %s %r %r ...", - f.__module__, f.__name__, a, kw) - r = f(*a, **kw) - logging.debug(" => %r", (r,)) - return r - g.__name__ = f.__name__ - return g - class StringProtocol(object): """ diff --git a/Systematiki/Networking/GObjectStringProtocol.py b/Systematiki/Networking/GObjectStringProtocol.py index 35a1d78..acacd61 100644 --- a/Systematiki/Networking/GObjectStringProtocol.py +++ b/Systematiki/Networking/GObjectStringProtocol.py @@ -35,11 +35,6 @@ import socket import gobject from Systematiki.Networking import BlockingStringProtocol -from Systematiki.Networking.BlockingStringProtocol import _dbg - -if False: - if logging.getLogger().level <= logging.DEBUG: - gobject.io_add_watch = _dbg(gobject.io_add_watch) class StringProtocol(BlockingStringProtocol.StringProtocol): diff --git a/Systematiki/Networking/XDRRPC.py b/Systematiki/Networking/XDRRPC.py index 435e703..1b50804 100644 --- a/Systematiki/Networking/XDRRPC.py +++ b/Systematiki/Networking/XDRRPC.py @@ -27,7 +27,6 @@ import time import xdrlib from Systematiki.DeferredReturn import DeferredReturn -from Systematiki.Networking.BlockingStringProtocol import _dbg def _pack_args(typestr, args): @@ -54,7 +53,6 @@ class _XDRRPCMethod(object): self._rpc = xdrrpc self._name = name - @_dbg def __call__(self, *args): typestr, arg_packer = _pack_args("C", args) header_packer = xdrlib.Packer() @@ -81,10 +79,10 @@ class XDRRPC(object): self._string_protocol.recv(self._recv_cb) self._served_object = served_object - @_dbg def __getattr__(self, name): + print "__getattr__", name if name.startswith("_"): - raise AttributeError, name + return super(XDRRPC, self).__getattr__(name) return _XDRRPCMethod(self, name) def _deferred_cb(self, t, r, name, args): @@ -97,7 +95,6 @@ class XDRRPC(object): msg = header_packer.get_buffer() + arg_packer.get_buffer() self._string_protocol.send(msg) - @_dbg def _recv_cb(self, proto, msg): unpacker = xdrlib.Unpacker(msg) t = unpacker.unpack_double() -- 2.11.4.GIT