# Buggy code
def on_create_clicked(self):
    if self.window().create_torrent_files_list.count() == 0:
        self.dialog = ConfirmationDialog(
            self,
            "Notice",
            "You should add at least one file to your torrent.",
            [("CLOSE", BUTTON_TYPE_NORMAL)],
        )
        self.dialog.button_clicked.connect(self.on_dialog_ok_clicked)
        self.dialog.show()
        return

    files_str = ""
    for ind in xrange(self.window().create_torrent_files_list.count()):
        files_str += "files[]=%s&" % urllib.quote_plus(
            self.window().create_torrent_files_list.item(ind).text().encode("utf-8")
        )

    description = urllib.quote_plus(
        self.window().create_torrent_description_field.toPlainText()
    )
    post_data = ("%s&description=%s" % (files_str[:-1], description)).encode("utf-8")
    url = (
        "createtorrent?download=1"
        if self.window().seed_after_adding_checkbox.isChecked()
        else "createtorrent"
    )
    self.request_mgr = TriblerRequestManager()
    self.request_mgr.perform_request(
        url, self.on_torrent_created, data=post_data, method="POST"
    )


# Traceback (AssertionError)
Tuples differ: (2, ('127.0.0.1', [5, 4, 3, 2,... != (2, ('127.0.0.1', [5, 4, 3, 2,...

First differing element 2:
u'None'
''

- (2, ('127.0.0.1', [5, 4, 3, 2, 1]), u'None')
?                                     - ----

+ (2, ('127.0.0.1', [5, 4, 3, 2, 1]), '')
Stacktrace

Traceback (most recent call last):
File "c:\python27\lib\unittest\case.py", line 329, in run
testMethod()
File "C:\workspace\jenkins\workspace\GH_Tribler_PR_tests_win64\tribler\Tribler\Test\test_as_server.py", line 58, in check
result = fun(*argv, **kwargs)
File "C:\workspace\jenkins\workspace\GH_Tribler_PR_tests_win64\tribler\Tribler\Test\Core\Upgrade\test_config_upgrade_70_71.py", line 33, in test_read_test_libtribler_conf
self.assertEqual(result_config.get_anon_proxy_settings(), (2, ("127.0.0.1", [5, 4, 3, 2, 1]), ''))
File "c:\python27\lib\unittest\case.py", line 513, in assertEqual
assertion_func(first, second, msg=msg)
File "c:\python27\lib\unittest\case.py", line 753, in assertTupleEqual
self.assertSequenceEqual(tuple1, tuple2, msg, seq_type=tuple)
File "c:\python27\lib\unittest\case.py", line 724, in assertSequenceEqual
self.fail(msg)
File "c:\python27\lib\unittest\case.py", line 410, in fail
raise self.failureException(msg)
AssertionError: Tuples differ: (2, ('127.0.0.1', [5, 4, 3, 2,... != (2, ('127.0.0.1', [5, 4, 3, 2,...

First differing element 2:
u'None'
''

- (2, ('127.0.0.1', [5, 4, 3, 2, 1]), u'None')
?                                     - ----

+ (2, ('127.0.0.1', [5, 4, 3, 2, 1]), '')

# Fixed code
def on_create_clicked(self):
    if self.window().create_torrent_files_list.count() == 0:
        self.dialog = ConfirmationDialog(
            self,
            "Notice",
            "You should add at least one file to your torrent.",
            [("CLOSE", BUTTON_TYPE_NORMAL)],
        )
        self.dialog.button_clicked.connect(self.on_dialog_ok_clicked)
        self.dialog.show()
        return

    files_str = ""
    for ind in xrange(self.window().create_torrent_files_list.count()):
        files_str += "files[]=%s&" % urllib.quote_plus(
            self.window().create_torrent_files_list.item(ind).text().encode("utf-8")
        )

    name = urllib.quote_plus(
        self.window().create_torrent_name_field.text().encode("utf-8")
    )
    description = urllib.quote_plus(
        self.window().create_torrent_description_field.toPlainText().encode("utf-8")
    )
    post_data = (
        "%s&name=%s&description=%s" % (files_str[:-1], name, description)
    ).encode("utf-8")
    url = (
        "createtorrent?download=1"
        if self.window().seed_after_adding_checkbox.isChecked()
        else "createtorrent"
    )
    self.request_mgr = TriblerRequestManager()
    self.request_mgr.perform_request(
        url, self.on_torrent_created, data=post_data, method="POST"
    )
    # Show creating torrent text
    self.window().edit_channel_create_torrent_progress_label.show()