Clean TODO comments

darcs-hash:20080310192034-86b55-8b97689085329491097a6b1ff13e8e15e5fbe630.gz
This commit is contained in:
David Rousselie
2008-03-10 20:20:34 +01:00
parent 723fa4987e
commit 0ddf21516f
6 changed files with 17 additions and 25 deletions

View File

@@ -425,7 +425,6 @@ class AccountManager(object):
if field_name is None:
# TODO : Add page when empty tuple given
pass
else:
lang_label_attr = "field_" + field_name
if hasattr(lang_class, lang_label_attr):
@@ -808,7 +807,7 @@ class JCLComponent(Component, object):
elif account_type is None: # root
self.__logger.debug("Applying behavior on root node")
result = root_handler(name, from_jid, "",
lang_class) # TODO : account_type not needed
lang_class)
else: # account type
self.__logger.debug("Applying behavior on account type " +
account_type)
@@ -882,14 +881,15 @@ class JCLComponent(Component, object):
return 1
def handle_set_gateway(self, info_query):
"""Handle IQ-set "jabber:iq:gateway" requests.
"""
Handle IQ-set "jabber:iq:gateway" requests.
Return well formed JID from legacy ID.
"""
self.__logger.debug("SET_GATEWAY")
prompt_nodes = info_query.xpath_eval("jig:query/jig:prompt",
{"jig" : "jabber:iq:gateway"})
# TODO : Add malformed content error handling
jid = prompt_nodes[0].content.replace("@", "%") + "@" + unicode(self.jid)
jid = prompt_nodes[0].content.replace("@", "%") \
+ "@" + unicode(self.jid)
info_query = info_query.make_result_response()
query = info_query.new_query("jabber:iq:gateway")
query.newTextChild(query.ns(), "jid", jid)

View File

@@ -27,7 +27,6 @@ import traceback
import pyxmpp.error as error
from jcl.error import FieldError
import jcl.model as model
import jcl.jabber as jabber
class SetRegisterHandler(object):
@@ -76,14 +75,8 @@ class RootSetRegisterHandler(SetRegisterHandler):
self.__logger.debug("root_set_register")
_account = None
if not "name" in x_data or x_data["name"].value == "":
# TODO : use handle_error
iq_error = info_query.make_error_response("not-acceptable")
text = iq_error.get_error().xmlnode.newTextChild(\
None,
"text",
lang_class.mandatory_field % ("name"))
text.setNs(text.newNs(error.STANZA_ERROR_NS, None))
return [iq_error]
return self.handle_error(FieldError("name", ""),
info_query, lang_class)
try:
info_queries = self.account_manager.create_default_account(\
x_data["name"].value,

View File

@@ -870,7 +870,6 @@ class JCLComponent_TestCase(JCLTestCase):
self.assertEquals(fields[4].prop("type"), "list-single")
self.assertEquals(fields[4].prop("var"), "test_enum")
self.assertEquals(fields[4].prop("label"), "test_enum")
# TODO : correct xpath expression (field[4])
options = iq_sent.xpath_eval("jir:query/jxd:x/jxd:field/jxd:option", \
{"jir" : "jabber:iq:register", \
"jxd" : "jabber:x:data"})
@@ -1029,7 +1028,6 @@ class JCLComponent_TestCase(JCLTestCase):
self.assertEquals(field.prop("label"), "test_enum")
self.assertEquals(field.children.name, "value")
self.assertEquals(field.children.content, "choice3")
# TODO : correct xpath expression (field[4])
options = iq_sent.xpath_eval("jir:query/jxd:x/jxd:field/jxd:option",
{"jir" : "jabber:iq:register",
"jxd" : "jabber:x:data"})

View File

@@ -21,22 +21,24 @@
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##
"""lang -- contains translations
"""
lang -- contains translations
"""
__revision__ = "$Id: lang.py,v 1.3 2005/09/18 20:24:07 dax Exp $"
# TODO delete JMC translation
class Lang:
"""Lang.
"""
# TODO get help on docstring
Lang.
"""
# pylint: disable-msg=W0232, R0903, C0103, C0111
def __init__(self, default_lang = "en"):
self.default_lang = default_lang
def get_lang_from_node(self, node):
"""Extract lang contain in a XML node.
"""
Extract lang contain in a XML node.
:Parameters:
- `node`: XML node.
@@ -240,6 +242,7 @@ class Lang:
help_message_subject = u"Help"
help_message_body = u"No help"
command_last_error = u"Get account's last error"
field_last_error = u"Last error"
account_no_error = u"This account has no error"
@@ -428,6 +431,7 @@ class Lang:
help_message_subject = u"Aide"
help_message_body = u"Pas d'aide !"
command_last_error = u"Récupérer la dernière erreur du compte"
field_last_error = u"Dernière erreur"
account_no_error = u"Ce compte n'a pas d'erreur"

View File

@@ -58,7 +58,7 @@ def mandatory_field(field_name, field_value):
"""Used as default function for field that must be specified
and cannot have an empty value"""
if field_value is None or str(field_value) == "":
raise FieldError(field_name, "Field required") # TODO : add translated message
raise FieldError(field_name, "Field required")
return field_value
class User(InheritableSQLObject):
@@ -167,8 +167,6 @@ class Account(InheritableSQLObject):
setattr(self, 'password', None)
else:
if self._status == OFFLINE:
# TODO : first_check
self.first_check = True
self.lastlogin = datetime.datetime.today()
self._status = status

View File

@@ -252,7 +252,6 @@ class Account_TestCase(InheritableAccount_TestCase):
jid="account11@jcl.test.com")
account11.status = account.OFFLINE
self.assertEquals(account11.status, account.OFFLINE)
# TODO : test first_check attribute
model.db_disconnect()
def test_set_status_live_password(self):