[basetemplate] Use a proper UStringIO instead of a simple list for components (closes #4542740)

This allows writing components using cwtags which monkeypatches CubicWeb's UStringIO for correct operations.

This fixes a regression introduced by commit 45b3eb604765.

authorRémi Cardona <remi.cardona@logilab.fr>
changeset1eb85791a7fa
branchdefault
phasepublic
hiddenno
parent revision#56190bc5ea48 [component] fix a double "class" attribute occurrence
child revision#30c90c063940 [pkg] Prepare 0.3.7 release
files modified by this revision
views/basetemplates.py
# HG changeset patch
# User Rémi Cardona <remi.cardona@logilab.fr>
# Date 1414682416 -3600
# Thu Oct 30 16:20:16 2014 +0100
# Node ID 1eb85791a7fa55af5ec8a2ae9d60e8dccbb1a7b4
# Parent 56190bc5ea4811d66adb6e5070335c1ac260b34d
[basetemplate] Use a proper UStringIO instead of a simple list for components (closes #4542740)

This allows writing components using cwtags which monkeypatches
CubicWeb's UStringIO for correct operations.

This fixes a regression introduced by commit 45b3eb604765.

diff --git a/views/basetemplates.py b/views/basetemplates.py
@@ -114,18 +114,19 @@
1      return self.w(u'<div class="alert alert-info">%s</div>' % msg)
2 
3  @monkeypatch(basetemplates.TheMainTemplate)
4  def nav_column(self, view, boxes, context):
5      if boxes:
6 -        html = []
7 +        stream = UStringIO()
8          for box in boxes:
9 -            box.render(w=html.append, view=view)
10 +            box.render(w=stream.write, view=view)
11 +        html = stream.getvalue()
12          if html:
13              # only display aside columns if html availble
14              self.w(u'<aside id="aside-main-%s" class="col-md-3 cwjs-aside">\n' %
15                     context)
16 -            self.w(u'\n'.join(html))
17 +            self.w(html)
18              self.w(u'</aside>\n')
19      return len(boxes)
20 
21  @monkeypatch(basetemplates.TheMainTemplate)
22  def content_column(self, view, content_cols):