+
+class Notification:
+
+ pass
+
+
+
+from builder import TreeBuilder
+from common import BASE_NS
+from common import qualify as _
+
+################################################################################
+
+_ = qualify
+
+def build(msgid, op, encoding='utf-8'):
+ "TODO: docstring"
+ if isinstance(op, basestring):
+ return RPCBuilder.build_from_string(msgid, op, encoding)
+ else:
+ return RPCBuilder.build_from_spec(msgid, op, encoding)
+
+def build_from_spec(msgid, opspec, encoding='utf-8'):
+ "TODO: docstring"
+ spec = {
+ 'tag': _('rpc', BASE_NS),
+ 'attributes': {'message-id': msgid},
+ 'children': opspec
+ }
+ return TreeBuilder(spec).to_string(encoding)
+
+def build_from_string(msgid, opstr, encoding='utf-8'):
+ "TODO: docstring"
+ decl = '<?xml version="1.0" encoding="%s"?>' % encoding
+ doc = (u'''<rpc message-id="%s" xmlns="%s">%s</rpc>''' %
+ (msgid, BASE_NS, opstr)).encode(encoding)
+ return (decl + doc)
+
+################################################################################
+
+# parsing stuff TODO
+
+