Am 27. Mai 2010 17:49 schrieb Guido Trotter <[email protected]>:
> On Tue, May 25, 2010 at 5:18 PM, Michael Hanselmann <[email protected]> wrote:
>> --- a/daemons/import-export
>> +++ b/daemons/import-export
>> +class CommandBuilder(object):
>> + def __init__(self, mode, opts, socat_stderr_fd):
>> + """Initializes this class.
>>
>> - """
>> - return ["bash", "-o", "errexit", "-o", "pipefail", "-c", cmd]
>> + �...@param mode: Daemon mode (import or export)
>> + �...@param opts: Options object
>> + �...@type socat_stderr_fd: int
>> + �...@param socat_stderr_fd: File descriptor socat should write its
>> stderr to
>>
>> + """
>> + self._opts = opts
>> + self._mode = mode
>
> Could you check that the mode is in the valid set of modes here?
> assert mode in constants.IEMS or something similar :)
Calling “GetCommand”, the only public method, will check that.
>> + for i in [addr1, addr2]:
>> + for value in i:
>> + if "," in value:
>> + raise Error("Comma not allowed in socat option value: %r" % value)
>
> Wouldn't it be better to check for commas in the host/port arguments
> that go forming the addresses, rather than now after we built them?
This way we also check for commas in constants.
Michael