Merge lp:~esteve/txamqp/397557-support-loading-xml-from-string into lp:txamqp

Proposed by Esteve Fernandez
Status: Merged
Merged at revision: not available
Proposed branch: lp:~esteve/txamqp/397557-support-loading-xml-from-string
Merge into: lp:txamqp
Diff against target: None lines
To merge this branch: bzr merge lp:~esteve/txamqp/397557-support-loading-xml-from-string
Reviewer Review Type Date Requested Status
Elliot Murphy (community) Approve
Esteve Fernandez Approve
txAMQP Team Pending
Review via email: mp+8497@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Esteve Fernandez (esteve) :
review: Approve
Revision history for this message
Esteve Fernandez (esteve) wrote :

It's been almost a week and nobody reviewed this branch, but I'm going to merge it anyway. It's a fairly trivial change, though.

Revision history for this message
Elliot Murphy (statik) wrote :

> It's been almost a week and nobody reviewed this branch, but I'm going to
> merge it anyway. It's a fairly trivial change, though.

Looks like a perfectly reasonable change to me :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/txamqp/spec.py'
2--- src/txamqp/spec.py 2008-10-29 18:31:04 +0000
3+++ src/txamqp/spec.py 2009-07-09 21:28:09 +0000
4@@ -244,9 +244,12 @@
5 l.add(Field(f_nd["@name"], f_nd.index(), type, get_docs(f_nd)))
6
7 def load(specfile):
8- doc = xmlutil.parse(specfile)
9+ return loadString(open(specfile).read(), specfilename=specfile.name)
10+
11+def loadString(specfilestr, specfilename=None):
12+ doc = xmlutil.parseString(specfilestr)
13 root = doc["amqp"][0]
14- spec = Spec(int(root["@major"]), int(root["@minor"]), specfile)
15+ spec = Spec(int(root["@major"]), int(root["@minor"]), specfilename)
16
17 # constants
18 for nd in root["constant"]:
19
20=== modified file 'src/txamqp/xmlutil.py'
21--- src/txamqp/xmlutil.py 2008-10-29 18:31:04 +0000
22+++ src/txamqp/xmlutil.py 2009-07-09 21:28:09 +0000
23@@ -29,6 +29,11 @@
24 xml.sax.parse(file, Builder(doc))
25 return doc
26
27+def parseString(string):
28+ doc = Node("root")
29+ xml.sax.parseString(string, Builder(doc))
30+ return doc
31+
32 class Node:
33
34 def __init__(self, name, attrs = None, text = None, parent = None):

Subscribers

People subscribed via source and target branches

to status/vote changes: