added code quality comment about masking of locals builtin

This commit is contained in:
Tavis Rudd
2010-02-27 01:26:21 -05:00
parent cea4fc8188
commit aaba23f25d

View File

@@ -34,11 +34,12 @@ class FileProxy(object):
def __getattr__(self, attr):
fixups = object.__getattribute__(self, 'fixups')
if attr in fixups:
return fixups[attr]
return fixups[attr]
f = object.__getattribute__(self, 'f')
return getattr(f, attr)
# @@tavis: the `locals` args below mask the built-in function. Should
# be renamed.
class SocketConsole(greenlets.greenlet):
def __init__(self, desc, hostport, locals):
self.hostport = hostport
@@ -70,12 +71,12 @@ class SocketConsole(greenlets.greenlet):
def backdoor_server(sock, locals=None):
""" Blocking function that runs a backdoor server on the socket *sock*,
""" Blocking function that runs a backdoor server on the socket *sock*,
accepting connections and running backdoor consoles for each client that
connects.
The *locals* argument is a dictionary that will be included in the locals()
of the interpreters. It can be convenient to stick important application
of the interpreters. It can be convenient to stick important application
variables in here.
"""
print "backdoor server listening on %s:%s" % sock.getsockname()
@@ -94,7 +95,7 @@ def backdoor_server(sock, locals=None):
def backdoor((conn, addr), locals=None):
"""Sets up an interactive console on a socket with a single connected
client. This does not block the caller, as it spawns a new greenlet to
client. This does not block the caller, as it spawns a new greenlet to
handle the console. This is meant to be called from within an accept loop
(such as backdoor_server).
"""
@@ -108,4 +109,3 @@ def backdoor((conn, addr), locals=None):
if __name__ == '__main__':
backdoor_server(eventlet.listen(('127.0.0.1', 9000)), {})