@@ 143-155 (lines=13) @@ | ||
140 | ||
141 | ||
142 | def make_logger(sess): |
|
143 | output = StringIO() |
|
144 | sess.logger = Namespace( |
|
145 | warn=lambda code, text, **opts: output.write(u"%s: %s %s\n" % (code, force_text(text), opts)), |
|
146 | info=lambda text, **opts: output.write(force_text(text) + u'\n'), |
|
147 | error=lambda text: output.write(force_text(text) + u'\n'), |
|
148 | ) |
|
149 | sess.storage.logger = Namespace( |
|
150 | warn=lambda code, text, **opts: output.write(u"%s: %s %s\n" % (code, force_text(text), opts)), |
|
151 | info=lambda text, **opts: output.write(force_text(text) + u'\n'), |
|
152 | error=lambda text: output.write(force_text(text) + u'\n'), |
|
153 | ) |
|
154 | return output |
|
155 | ||
156 | ||
157 | def test_rendering(sess): |
|
158 | output = make_logger(sess) |
@@ 137-149 (lines=13) @@ | ||
134 | if isinstance(text, text_type): |
|
135 | return text.encode('utf-8') |
|
136 | else: |
|
137 | return text |
|
138 | ||
139 | ||
140 | def make_logger(sess): |
|
141 | output = StringIO() |
|
142 | sess.logger = Namespace( |
|
143 | warn=lambda code, text, **opts: output.write(u"%s: %s %s\n" % (code, force_text(text), opts)), |
|
144 | info=lambda text, **opts: output.write(force_text(text) + u'\n'), |
|
145 | error=lambda text: output.write(force_text(text) + u'\n'), |
|
146 | ) |
|
147 | sess.storage.logger = Namespace( |
|
148 | warn=lambda code, text, **opts: output.write(u"%s: %s %s\n" % (code, force_text(text), opts)), |
|
149 | info=lambda text, **opts: output.write(force_text(text) + u'\n'), |
|
150 | error=lambda text: output.write(force_text(text) + u'\n'), |
|
151 | ) |
|
152 | return output |