1717: post-review w/ perforce fails on multiple aliases for perforce server

dad****@gmai***** (Google Code) (Is this you? Claim this profile.)
Jan. 22, 2012
1682
What version are you running?
RBTools 0.2

What's the URL of the page containing the problem?


What steps will reproduce the problem?
1. post-review --server=http://reviews/sfoffice.qc 46624
2. (w/ perforce)
3.

What is the expected output? What do you see instead?
dadkins-l:p4 dadkins$ post-review --debug --server=http://reviews.sfoffice.qc 46624
>>> svn info
>>> git rev-parse --git-dir
>>> hg root
>>> p4 info
>>> repository info: Path: ['perforce1.sfo1.qc:1666', '40.1.10.10.in-addr.arpa:1666'], Base path: None, Supports changesets: True
>>> Generating diff for changenum 46624
>>> p4 describe -s 46624
>>> Processing edit of //depot/main/platform/kfssort/kosmosfs/src/cc/telemetry/packet.h
>>> Writing "//depot/main/platform/kfssort/kosmosfs/src/cc/telemetry/packet.h#3" to "/var/folders/q8/q8r34PtkFFWw67FjK1-cxU+++TM/-Tmp-/tmpd5Qit7"
>>> p4 print -o /var/folders/q8/q8r34PtkFFWw67FjK1-cxU+++TM/-Tmp-/tmpd5Qit7 -q //depot/main/platform/kfssort/kosmosfs/src/cc/telemetry/packet.h#3
>>> Writing "//depot/main/platform/kfssort/kosmosfs/src/cc/telemetry/packet.h#4" to "/var/folders/q8/q8r34PtkFFWw67FjK1-cxU+++TM/-Tmp-/tmplOac32"
>>> p4 print -o /var/folders/q8/q8r34PtkFFWw67FjK1-cxU+++TM/-Tmp-/tmplOac32 -q //depot/main/platform/kfssort/kosmosfs/src/cc/telemetry/packet.h#4
>>> diff -urNp /var/folders/q8/q8r34PtkFFWw67FjK1-cxU+++TM/-Tmp-/tmpd5Qit7 /var/folders/q8/q8r34PtkFFWw67FjK1-cxU+++TM/-Tmp-/tmplOac32
>>> Looking for 'reviews.sfoffice.qc /' cookie in /Users/dadkins/.post-review-cookies.txt
>>> Loaded valid cookie -- no login required
>>> HTTP GETting /api/json/repositories/
>>> Repositories on Server: [{u'path': u'perforce1:1666', u'tool': u'Perforce', u'id': 1, u'name': u'Perforce'}]
>>> Server Aliases: ['perforce1.sfo1.qc:1666', '40.1.10.10.in-addr.arpa:1666']
>>> Attempting to create review request on ['perforce1.sfo1.qc:1666', '40.1.10.10.in-addr.arpa:1666'] for 46624
>>> HTTP POSTing to http://reviews.sfoffice.qc/api/json/reviewrequests/new/: {'repository_path': ['perforce1.sfo1.qc:1666', '40.1.10.10.in-addr.arpa:1666'], 'changenum': '46624'}
Traceback (most recent call last):
  File "/usr/local/bin/post-review", line 8, in <module>
    load_entry_point('RBTools==0.2', 'console_scripts', 'post-review')()
  File "build/bdist.linux-x86_64/egg/rbtools/postreview.py", line 2861, in main
  File "build/bdist.linux-x86_64/egg/rbtools/postreview.py", line 2497, in tempt_fate
  File "build/bdist.linux-x86_64/egg/rbtools/postreview.py", line 422, in new_review_request
  File "build/bdist.linux-x86_64/egg/rbtools/postreview.py", line 648, in api_post
  File "build/bdist.linux-x86_64/egg/rbtools/postreview.py", line 620, in http_post
  File "build/bdist.linux-x86_64/egg/rbtools/postreview.py", line 666, in _encode_multipart_formdata
TypeError: can only concatenate list (not "str") to list


What operating system are you using? What browser?
Mac OS X

Please provide any additional information below.
Problem is originates when a list is supplied for the repository path:

postreview.py:1396
            # If aliases exist for hostname, create a list of alias:port                            
            # strings for repository_path.                                                          
            if info[1]:
                servers = [info[0]] + info[1]
                repository_path = ["%s:%s" % (server, port)
                                   for server in servers]
            else:
                repository_path = "%s:%s" % (info[0], port)
#1 jeam****@gmai***** (Google Code) (Is this you? Claim this profile.)
I've posted http://reviews.reviewboard.org/r/1818/ as a patch to eliminate the gethostbyaddr() lookup.  I don't know if it will be accepted, but it solved this issue for me!