Make JMC work with PyXMPP 1.0.1

Ignore-this: cc242e6115e0359528974bc6607a9585

It will now be incompatible with PyXMPP <1.0.1

darcs-hash:20090701193604-86b55-70288dbfa46c93da43cae0e36bffe2bdb6df0178.gz
This commit is contained in:
David Rousselie
2009-07-01 21:36:04 +02:00
parent 9bab128113
commit 4a9e1552f3
4 changed files with 11 additions and 8 deletions

View File

@@ -68,10 +68,10 @@ class MailCommandManager(JCLCommandManager):
field_type="list-multi",
label="select attachments")
field.add_option(label="Next",
values=["-1"])
value="-1")
for (mail_id, mail_title) in _account.get_mail_with_attachment_list():
field.add_option(label=mail_title,
values=[mail_id])
value=mail_id)
result_form.as_xml(command_node)
return (result_form, [])
else:
@@ -154,7 +154,7 @@ class MailCommandManager(JCLCommandManager):
field_type="list-multi",
label=lang_class.field_email_subject)
for (email_index, email_subject) in email_list:
field.add_option(label=email_subject, values=[email_index])
field.add_option(label=email_subject, value=email_index)
if len(email_list) == 10:
result_form.add_field(name="fetch_more",
field_type="boolean",

View File

@@ -31,6 +31,7 @@ import time
from pyxmpp.iq import Iq
from pyxmpp.jabber.dataforms import Field
import pyxmpp.xmlextra
import jcl.tests
from jcl.tests import JCLTestCase
@@ -47,6 +48,8 @@ from jmc.lang import Lang
from jmc.jabber.tests.component import MockIMAPAccount
from jmc.jabber.command import MailCommandManager
PYXMPP_NS = pyxmpp.xmlextra.COMMON_NS
class MailCommandManagerTestCase(JCLCommandManagerTestCase):
def setUp(self, tables=[]):
tables += [POP3Account, IMAPAccount, GlobalSMTPAccount,
@@ -286,7 +289,7 @@ class MailCommandManagerGetEmailCommand_TestCase(MailCommandManagerTestCase):
self.assertTrue(jcl.tests.is_xml_equal(\
u"<message from='account11@" + unicode(self.comp.jid)
+ "' to='test1@test.com' "
+ "xmlns='http://pyxmpp.jabberstudio.org/xmlns/common'>"
+ "xmlns='" + PYXMPP_NS + "'>"
+ "<subject>" + Lang.en.mail_subject \
% ("from" + str(index) + "@test.com")
+ "</subject>"
@@ -570,7 +573,7 @@ class MailCommandManagerGetEmailCommand_TestCase(MailCommandManagerTestCase):
self.assertTrue(jcl.tests.is_xml_equal(\
u"<iq from='unknown@" + unicode(self.comp.jid)
+ "' to='test1@test.com' type='error' "
+ "xmlns='http://pyxmpp.jabberstudio.org/xmlns/common'>"
+ "xmlns='" + PYXMPP_NS + "'>"
+ "<command xmlns='http://jabber.org/protocol/commands' "
+ "node='jmc#get-email' />"
+ "<error type='cancel'>"

View File

@@ -527,7 +527,7 @@ class IMAPAccount_TestCase(InheritableAccount_TestCase):
try:
tested_func()
except Exception, e:
self.assertEquals(e.message, exception_message)
self.assertEquals(str(e), exception_message)
return
self.fail("No exception raised when selecting non existing mailbox")
test_func = self.make_test(\
@@ -608,7 +608,7 @@ class IMAPAccount_TestCase(InheritableAccount_TestCase):
try:
self.imap_account.get_new_mail_list()
except Exception, e:
self.assertEquals(e.message, "Mailbox does not exist")
self.assertEquals(str(e), "Mailbox does not exist")
return
self.fail("No exception raised when selecting non existing mailbox")
test_func = self.make_test(\