commit 21473325c7dcb66a87ee0d1d0471ecf6226cb2fc
Author: David Fifield <david(a)bamsoftware.com>
Date: Wed Sep 19 16:00:56 2012 -0700
Make the registrant_addr parameter optional.
---
facilitator/fac.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/facilitator/fac.py b/facilitator/fac.py
index cb77ccc..9d77b95 100644
--- a/facilitator/fac.py
+++ b/facilitator/fac.py
@@ -194,12 +194,15 @@ def transact(f, command, *params):
raise ValueError("No newline at end of string returned by facilitator")
return parse_transaction(line[:-1])
-def put_reg(facilitator_addr, client_addr, registrant_addr):
+def put_reg(facilitator_addr, client_addr, registrant_addr=None):
"""Send a registration to the facilitator using a one-time socket. Returns
true iff the command was successful."""
f = fac_socket(facilitator_addr)
+ params = [("CLIENT", format_addr(client_addr))]
+ if registrant_addr is not None:
+ params.append(("FROM", format_addr(registrant_addr)))
try:
- command, params = transact(f, "PUT", ("CLIENT", format_addr(client_addr)), ("FROM", format_addr(registrant_addr)))
+ command, params = transact(f, "PUT", *params)
finally:
f.close()
return command == "OK"