Mercurial > mez_xml
annotate tools.py @ 5:d310e097c6de tip
Replace & with &
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sun, 02 Feb 2014 22:12:15 +0800 |
parents | 1727286834b5 |
children |
rev | line source |
---|---|
0
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
1 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
2 class scope(object): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
3 def __init__(self, temp, func, name): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
4 super(scope, self).__init__() |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
5 self.temp = temp |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
6 self.name = name |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
7 self.func = func |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
8 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
9 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
10 def __enter__(self): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
11 temp = self.temp |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
12 name = self.name |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
13 top = temp._nss[-1] |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
14 if top.has_key(name): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
15 if isinstance(top[name], dict): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
16 top[name] = [top[name]] |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
17 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
18 if isinstance(top[name], list): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
19 ntop = {} |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
20 top[name].append(ntop) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
21 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
22 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
23 else: |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
24 ntop = top[name] = {} |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
25 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
26 temp._nss.append(ntop) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
27 return temp |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
28 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
29 def __exit__(self, exc_type, exc_value, traceback): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
30 self.temp._nss.pop() |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
31 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
32 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
33 def __call__(self, *args, **kws): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
34 return self.func(self.temp, *args, **kws) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
35 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
36 def set_var(self, var): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
37 if not isinstance(var, (dict, list, tuple)): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
38 raise TypeError, 'var should be type of dict, list or tuple' |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
39 ntop = self.temp._nss[-1] |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
40 ntop[self.name] = var |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
41 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
42 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
43 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
44 class scope_deco(object): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
45 def __init__(self, name, func): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
46 super(scope_deco, self).__init__() |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
47 self.func = func |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
48 self.name = name |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
49 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
50 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
51 def __get__(self, temp, owner): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
52 return scope(temp, self.func, self.name) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
53 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
54 def __set__(self, temp, value): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
55 top = temp._nss[-1] |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
56 top[self.name] = value |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
57 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
58 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
59 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
60 class new_web_meta(type): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
61 def __init__(clz, name, bases, dict): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
62 super(new_web_meta, clz).__init__(name, bases, dict) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
63 for name in dict.keys(): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
64 if not name.startswith('_'): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
65 func = dict[name] |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
66 setattr(clz, name, scope_deco(name, func)) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
67 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
68 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
69 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
70 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
71 class nez_web(object): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
72 __metaclass__ = new_web_meta |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
73 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
74 def __init__(self): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
75 super(nez_web, self).__init__() |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
76 self.safe = False |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
77 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
78 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
79 def __enter__(self): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
80 self._rootns = {} |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
81 self._nss = [self._rootns] |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
82 self._committed = False |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
83 self._ready = False |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
84 pass |
5 | 85 |
0
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
86 def __exit__(self, exc_type, exc_value, traceback): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
87 if self._committed: |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
88 self._root({}, self._rootns) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
89 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
90 self._ready = True |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
91 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
92 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
93 def _feed_subtree(self, temp, pdata, cdata): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
94 if isinstance(cdata, dict): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
95 data = dict(pdata) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
96 data.update(cdata) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
97 temp(data) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
98 elif isinstance(cdata, list): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
99 for d in cdata: |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
100 data = dict(pdata) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
101 data.update(d) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
102 temp(data) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
103 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
104 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
105 else: |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
106 if self.safe: |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
107 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
108 self.ofo.write(cdata) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
109 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
110 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
111 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
112 def _esc_param(self, data): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
113 import types |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
114 if not (isinstance(data, types.StringTypes) and self.safe): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
115 return str(data) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
116 data = data.replace('&', '&') |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
117 data = data.replace('<', '<') |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
118 return str(data.replace('"', '')) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
119 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
120 def _esc_comm(self, data): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
121 import types |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
122 if not (isinstance(data, types.StringTypes) and self.safe): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
123 return str(data) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
124 return str(data.replace('--', '-d;')) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
125 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
126 def _esc_text(self, data): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
127 import types |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
128 if not (isinstance(data, types.StringTypes) and self.safe): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
129 return str(data) |
5 | 130 return str(data.replace('&', '&').replace('<', '<').replace('>', '>')) |
0
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
131 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
132 def _esc_cdata(self, data): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
133 import types |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
134 if not (isinstance(data, types.StringTypes) and self.safe): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
135 return str(data) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
136 return str(data.replace(']]>', ']]>')) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
137 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
138 def commit(self): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
139 assert not self._committed, '%s was committed more than one time.' % (repr(self),) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
140 if self._ready: |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
141 self._root({}, self._rootns) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
142 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
143 self._committed = True |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
144 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
145 |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
146 def gen_doc(self, data): |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
147 self._root({}, data) |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
148 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
149 pass |
3679d2d8443a
Import from CVS and goto mez_xml-0.4
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
150 |