Code review comment for lp:~leonardr/wadllib/convert-datetime-309950

Revision history for this message
Edwin Grubbs (edwin-grubbs) wrote :

merge-conditional

Hi Leonard,

I just have one item to add.

=== modified file 'wadllib/application.py'
--- wadllib/application.py>-----2009-01-21 19:12:41 +0000
+++ wadllib/application.py>-----2009-01-22 21:29:11 +0000
+ def _dereference_namespace(self, tag, value):
+ """Splits a value into namespace URI and value.
+
+ :param tag: A tag to use as context when mapping namespace
+ names to URIs.
+ """
+ namespace_url = None
+ if value is not None and ':' in value:
+ namespace, value = value.split(':', 1)
+ else:
+ namespace = ''
+ if namespace is not None:

This if-statement isn't necessary, since value.split()
will always set it to a string. It's also easy to miss the
default value for namespace_url above, which isn't necessary
if you remove the if-statement.

+ ns_map = tag.get(NS_MAP)
+ namespace_url = ns_map.get(namespace)
+ return namespace_url, value
+

« Back to merge proposal