`RietveldInfo.server` or `args.server` make different assumptions
Closed this issue · 1 comments
dhermes commented
Essentially, args.server
is returned from optparse
. When it is not the default, it is a singleton list with the server passed as a flag, else it is simply a list.
For example, this current failure is caused by RietveldInfo.server
assuming it will always receive a string (which it should):
$ git rv export -s review-site.appspot.com -r reviewer@mail.com
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "__main__.py", line 28, in <module>
File "__main__.py", line 23, in main
File "export.py", line 159, in callback
File "export.py", line 66, in __init__
File "export.py", line 88, in __update_rietveld_info_from_args
File "utils.py", line 699, in setter
File "utils.py", line 618, in _string_type_cast
utils.GitRvException: Property must be string. Received ['review-site.appspot.com'].
The following change in ExportAction.__update_rietveld_info_from_args
should be sufficient:
class ExportAction(object):
Args:
args: An argparse.Namespace object to extract parameters from.
"""
- self.__rietveld_info.server = args.server
+ server = args.server
+ if isinstance(server, list):
+ assert len(server) == 1
+ server = server[0]
+ self.__rietveld_info.server = server