/usr/share/doc/python-logilab-common/apidoc/logilab.common.ureports-pysrc.html is in python-logilab-common 1.1.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | <?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>logilab.common.ureports</title>
<link rel="stylesheet" href="epydoc.css" type="text/css" />
<script type="text/javascript" src="epydoc.js"></script>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th> <a
href="logilab.common-module.html">Home</a> </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
>Logilab's common library</th>
</tr></table></th>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="100%">
<span class="breadcrumbs">
Package logilab ::
<a href="logilab.common-module.html">Package common</a> ::
Package ureports
</span>
</td>
<td>
<table cellpadding="0" cellspacing="0">
<!-- hide/show private -->
<tr><td align="right"><span class="options"
>[<a href="frames.html" target="_top">frames</a
>] | <a href="logilab.common.ureports-pysrc.html"
target="_top">no frames</a>]</span></td></tr>
</table>
</td>
</tr>
</table>
<h1 class="epydoc">Source Code for <a href="logilab.common.ureports-module.html">Package logilab.common.ureports</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno"> 1</tt> <tt class="py-line"><tt class="py-comment"># copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.</tt> </tt>
<a name="L2"></a><tt class="py-lineno"> 2</tt> <tt class="py-line"><tt class="py-comment"># contact http://www.logilab.fr/ -- mailto:contact@logilab.fr</tt> </tt>
<a name="L3"></a><tt class="py-lineno"> 3</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L4"></a><tt class="py-lineno"> 4</tt> <tt class="py-line"><tt class="py-comment"># This file is part of logilab-common.</tt> </tt>
<a name="L5"></a><tt class="py-lineno"> 5</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L6"></a><tt class="py-lineno"> 6</tt> <tt class="py-line"><tt class="py-comment"># logilab-common is free software: you can redistribute it and/or modify it under</tt> </tt>
<a name="L7"></a><tt class="py-lineno"> 7</tt> <tt class="py-line"><tt class="py-comment"># the terms of the GNU Lesser General Public License as published by the Free</tt> </tt>
<a name="L8"></a><tt class="py-lineno"> 8</tt> <tt class="py-line"><tt class="py-comment"># Software Foundation, either version 2.1 of the License, or (at your option) any</tt> </tt>
<a name="L9"></a><tt class="py-lineno"> 9</tt> <tt class="py-line"><tt class="py-comment"># later version.</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt> <tt class="py-line"><tt class="py-comment"># logilab-common is distributed in the hope that it will be useful, but WITHOUT</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt> <tt class="py-line"><tt class="py-comment"># ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt> <tt class="py-line"><tt class="py-comment"># FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more</tt> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt> <tt class="py-line"><tt class="py-comment"># details.</tt> </tt>
<a name="L15"></a><tt class="py-lineno"> 15</tt> <tt class="py-line"><tt class="py-comment">#</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt> <tt class="py-line"><tt class="py-comment"># You should have received a copy of the GNU Lesser General Public License along</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt> <tt class="py-line"><tt class="py-comment"># with logilab-common. If not, see <http://www.gnu.org/licenses/>.</tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt> <tt class="py-line"><tt class="py-docstring">"""Universal report objects and some formatting drivers.</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt> <tt class="py-line"><tt class="py-docstring">A way to create simple reports using python objects, primarily designed to be</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt> <tt class="py-line"><tt class="py-docstring">formatted as text and html.</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt> <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt> <tt class="py-line"><tt class="py-name">__docformat__</tt> <tt class="py-op">=</tt> <tt class="py-string">"restructuredtext en"</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt> <tt class="py-line"> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">sys</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt> <tt class="py-line"> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">logilab</tt><tt class="py-op">.</tt><tt id="link-0" class="py-name" targets="Package logilab.common=logilab.common-module.html"><a title="logilab.common" class="py-name" href="#" onclick="return doclink('link-0', 'common', 'link-0');">common</a></tt><tt class="py-op">.</tt><tt id="link-1" class="py-name" targets="Module logilab.common.compat=logilab.common.compat-module.html"><a title="logilab.common.compat" class="py-name" href="#" onclick="return doclink('link-1', 'compat', 'link-1');">compat</a></tt> <tt class="py-keyword">import</tt> <tt class="py-name">StringIO</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">logilab</tt><tt class="py-op">.</tt><tt id="link-2" class="py-name"><a title="logilab.common" class="py-name" href="#" onclick="return doclink('link-2', 'common', 'link-0');">common</a></tt><tt class="py-op">.</tt><tt id="link-3" class="py-name" targets="Module logilab.common.textutils=logilab.common.textutils-module.html"><a title="logilab.common.textutils" class="py-name" href="#" onclick="return doclink('link-3', 'textutils', 'link-3');">textutils</a></tt> <tt class="py-keyword">import</tt> <tt id="link-4" class="py-name" targets="Variable logilab.common.textutils.linesep=logilab.common.textutils-module.html#linesep"><a title="logilab.common.textutils.linesep" class="py-name" href="#" onclick="return doclink('link-4', 'linesep', 'link-4');">linesep</a></tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt> <tt class="py-line"> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt> <tt class="py-line"> </tt>
<a name="get_nodes"></a><div id="get_nodes-def"><a name="L31"></a><tt class="py-lineno"> 31</tt> <a class="py-toggle" href="#" id="get_nodes-toggle" onclick="return toggle('get_nodes');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.ureports-module.html#get_nodes">get_nodes</a><tt class="py-op">(</tt><tt class="py-param">node</tt><tt class="py-op">,</tt> <tt class="py-param">klass</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="get_nodes-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="get_nodes-expanded"><a name="L32"></a><tt class="py-lineno"> 32</tt> <tt class="py-line"> <tt class="py-docstring">"""return an iterator on all children node of the given klass"""</tt> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">child</tt> <tt class="py-keyword">in</tt> <tt id="link-5" class="py-name" targets="Method logilab.common.vcgutils.VCGPrinter.node()=logilab.common.vcgutils.VCGPrinter-class.html#node"><a title="logilab.common.vcgutils.VCGPrinter.node" class="py-name" href="#" onclick="return doclink('link-5', 'node', 'link-5');">node</a></tt><tt class="py-op">.</tt><tt class="py-name">children</tt><tt class="py-op">:</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">child</tt><tt class="py-op">,</tt> <tt class="py-name">klass</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt> <tt class="py-line"> <tt class="py-keyword">yield</tt> <tt class="py-name">child</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt> <tt class="py-line"> <tt class="py-comment"># recurse (FIXME: recursion controled by an option)</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">grandchild</tt> <tt class="py-keyword">in</tt> <tt id="link-6" class="py-name" targets="Function logilab.common.ureports.get_nodes()=logilab.common.ureports-module.html#get_nodes"><a title="logilab.common.ureports.get_nodes" class="py-name" href="#" onclick="return doclink('link-6', 'get_nodes', 'link-6');">get_nodes</a></tt><tt class="py-op">(</tt><tt class="py-name">child</tt><tt class="py-op">,</tt> <tt class="py-name">klass</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L38"></a><tt class="py-lineno"> 38</tt> <tt class="py-line"> <tt class="py-keyword">yield</tt> <tt class="py-name">grandchild</tt> </tt>
</div><a name="L39"></a><tt class="py-lineno"> 39</tt> <tt class="py-line"> </tt>
<a name="layout_title"></a><div id="layout_title-def"><a name="L40"></a><tt class="py-lineno"> 40</tt> <a class="py-toggle" href="#" id="layout_title-toggle" onclick="return toggle('layout_title');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.ureports-module.html#layout_title">layout_title</a><tt class="py-op">(</tt><tt class="py-param">layout</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="layout_title-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="layout_title-expanded"><a name="L41"></a><tt class="py-lineno"> 41</tt> <tt class="py-line"> <tt class="py-docstring">"""try to return the layout's title as string, return None if not found</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">child</tt> <tt class="py-keyword">in</tt> <tt class="py-name">layout</tt><tt class="py-op">.</tt><tt class="py-name">children</tt><tt class="py-op">:</tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">child</tt><tt class="py-op">,</tt> <tt id="link-7" class="py-name" targets="Class logilab.common.ureports.nodes.Title=logilab.common.ureports.nodes.Title-class.html"><a title="logilab.common.ureports.nodes.Title" class="py-name" href="#" onclick="return doclink('link-7', 'Title', 'link-7');">Title</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">u' '</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt id="link-8" class="py-name"><a title="logilab.common.vcgutils.VCGPrinter.node" class="py-name" href="#" onclick="return doclink('link-8', 'node', 'link-5');">node</a></tt><tt class="py-op">.</tt><tt class="py-name">data</tt> <tt class="py-keyword">for</tt> <tt id="link-9" class="py-name"><a title="logilab.common.vcgutils.VCGPrinter.node" class="py-name" href="#" onclick="return doclink('link-9', 'node', 'link-5');">node</a></tt> <tt class="py-keyword">in</tt> <tt id="link-10" class="py-name"><a title="logilab.common.ureports.get_nodes" class="py-name" href="#" onclick="return doclink('link-10', 'get_nodes', 'link-6');">get_nodes</a></tt><tt class="py-op">(</tt><tt class="py-name">child</tt><tt class="py-op">,</tt> <tt id="link-11" class="py-name" targets="Class logilab.common.ureports.nodes.Text=logilab.common.ureports.nodes.Text-class.html"><a title="logilab.common.ureports.nodes.Text" class="py-name" href="#" onclick="return doclink('link-11', 'Text', 'link-11');">Text</a></tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
</div><a name="L46"></a><tt class="py-lineno"> 46</tt> <tt class="py-line"> </tt>
<a name="build_summary"></a><div id="build_summary-def"><a name="L47"></a><tt class="py-lineno"> 47</tt> <a class="py-toggle" href="#" id="build_summary-toggle" onclick="return toggle('build_summary');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.ureports-module.html#build_summary">build_summary</a><tt class="py-op">(</tt><tt class="py-param">layout</tt><tt class="py-op">,</tt> <tt class="py-param">level</tt><tt class="py-op">=</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="build_summary-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="build_summary-expanded"><a name="L48"></a><tt class="py-lineno"> 48</tt> <tt class="py-line"> <tt class="py-docstring">"""make a summary for the report, including X level"""</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt> <tt class="py-line"> <tt class="py-keyword">assert</tt> <tt id="link-12" class="py-name" targets="Variable logilab.common.configuration.OptionsProviderMixIn.level=logilab.common.configuration.OptionsProviderMixIn-class.html#level"><a title="logilab.common.configuration.OptionsProviderMixIn.level" class="py-name" href="#" onclick="return doclink('link-12', 'level', 'link-12');">level</a></tt> <tt class="py-op">></tt> <tt class="py-number">0</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt> <tt class="py-line"> <tt id="link-13" class="py-name"><a title="logilab.common.configuration.OptionsProviderMixIn.level" class="py-name" href="#" onclick="return doclink('link-13', 'level', 'link-12');">level</a></tt> <tt class="py-op">-=</tt> <tt class="py-number">1</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt> <tt class="py-line"> <tt class="py-name">summary</tt> <tt class="py-op">=</tt> <tt id="link-14" class="py-name" targets="Class logilab.common.ureports.nodes.List=logilab.common.ureports.nodes.List-class.html"><a title="logilab.common.ureports.nodes.List" class="py-name" href="#" onclick="return doclink('link-14', 'List', 'link-14');">List</a></tt><tt class="py-op">(</tt><tt class="py-name">klass</tt><tt class="py-op">=</tt><tt class="py-string">u'summary'</tt><tt class="py-op">)</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">child</tt> <tt class="py-keyword">in</tt> <tt class="py-name">layout</tt><tt class="py-op">.</tt><tt class="py-name">children</tt><tt class="py-op">:</tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">child</tt><tt class="py-op">,</tt> <tt id="link-15" class="py-name" targets="Class logilab.common.ureports.nodes.Section=logilab.common.ureports.nodes.Section-class.html"><a title="logilab.common.ureports.nodes.Section" class="py-name" href="#" onclick="return doclink('link-15', 'Section', 'link-15');">Section</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt> <tt class="py-line"> <tt class="py-keyword">continue</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt> <tt class="py-line"> <tt class="py-name">label</tt> <tt class="py-op">=</tt> <tt id="link-16" class="py-name" targets="Function logilab.common.ureports.layout_title()=logilab.common.ureports-module.html#layout_title"><a title="logilab.common.ureports.layout_title" class="py-name" href="#" onclick="return doclink('link-16', 'layout_title', 'link-16');">layout_title</a></tt><tt class="py-op">(</tt><tt class="py-name">child</tt><tt class="py-op">)</tt> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">label</tt> <tt class="py-keyword">and</tt> <tt class="py-keyword">not</tt> <tt class="py-name">child</tt><tt class="py-op">.</tt><tt class="py-name">id</tt><tt class="py-op">:</tt> </tt>
<a name="L57"></a><tt class="py-lineno"> 57</tt> <tt class="py-line"> <tt class="py-keyword">continue</tt> </tt>
<a name="L58"></a><tt class="py-lineno"> 58</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">child</tt><tt class="py-op">.</tt><tt class="py-name">id</tt><tt class="py-op">:</tt> </tt>
<a name="L59"></a><tt class="py-lineno"> 59</tt> <tt class="py-line"> <tt class="py-name">child</tt><tt class="py-op">.</tt><tt class="py-name">id</tt> <tt class="py-op">=</tt> <tt class="py-name">label</tt><tt class="py-op">.</tt><tt id="link-17" class="py-name" targets="Method logilab.common.tree.Node.replace()=logilab.common.tree.Node-class.html#replace"><a title="logilab.common.tree.Node.replace" class="py-name" href="#" onclick="return doclink('link-17', 'replace', 'link-17');">replace</a></tt><tt class="py-op">(</tt><tt class="py-string">' '</tt><tt class="py-op">,</tt> <tt class="py-string">'-'</tt><tt class="py-op">)</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt> <tt class="py-line"> <tt id="link-18" class="py-name"><a title="logilab.common.vcgutils.VCGPrinter.node" class="py-name" href="#" onclick="return doclink('link-18', 'node', 'link-5');">node</a></tt> <tt class="py-op">=</tt> <tt id="link-19" class="py-name" targets="Class logilab.common.ureports.nodes.Link=logilab.common.ureports.nodes.Link-class.html"><a title="logilab.common.ureports.nodes.Link" class="py-name" href="#" onclick="return doclink('link-19', 'Link', 'link-19');">Link</a></tt><tt class="py-op">(</tt><tt class="py-string">u'#'</tt><tt class="py-op">+</tt><tt class="py-name">child</tt><tt class="py-op">.</tt><tt class="py-name">id</tt><tt class="py-op">,</tt> <tt class="py-name">label</tt><tt class="py-op">=</tt><tt class="py-name">label</tt> <tt class="py-keyword">or</tt> <tt class="py-name">child</tt><tt class="py-op">.</tt><tt class="py-name">id</tt><tt class="py-op">)</tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt> <tt class="py-line"> <tt class="py-comment"># FIXME: Three following lines produce not very compliant</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt> <tt class="py-line"> <tt class="py-comment"># docbook: there are some useless <para><para>. They might be</tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt> <tt class="py-line"> <tt class="py-comment"># replaced by the three commented lines but this then produces</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt> <tt class="py-line"> <tt class="py-comment"># a bug in html display...</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt id="link-20" class="py-name"><a title="logilab.common.configuration.OptionsProviderMixIn.level" class="py-name" href="#" onclick="return doclink('link-20', 'level', 'link-12');">level</a></tt> <tt class="py-keyword">and</tt> <tt class="py-op">[</tt><tt class="py-name">n</tt> <tt class="py-keyword">for</tt> <tt class="py-name">n</tt> <tt class="py-keyword">in</tt> <tt class="py-name">child</tt><tt class="py-op">.</tt><tt class="py-name">children</tt> <tt class="py-keyword">if</tt> <tt class="py-name">isinstance</tt><tt class="py-op">(</tt><tt class="py-name">n</tt><tt class="py-op">,</tt> <tt id="link-21" class="py-name"><a title="logilab.common.ureports.nodes.Section" class="py-name" href="#" onclick="return doclink('link-21', 'Section', 'link-15');">Section</a></tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt> <tt class="py-line"> <tt id="link-22" class="py-name"><a title="logilab.common.vcgutils.VCGPrinter.node" class="py-name" href="#" onclick="return doclink('link-22', 'node', 'link-5');">node</a></tt> <tt class="py-op">=</tt> <tt id="link-23" class="py-name" targets="Class logilab.common.ureports.nodes.Paragraph=logilab.common.ureports.nodes.Paragraph-class.html"><a title="logilab.common.ureports.nodes.Paragraph" class="py-name" href="#" onclick="return doclink('link-23', 'Paragraph', 'link-23');">Paragraph</a></tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt id="link-24" class="py-name"><a title="logilab.common.vcgutils.VCGPrinter.node" class="py-name" href="#" onclick="return doclink('link-24', 'node', 'link-5');">node</a></tt><tt class="py-op">,</tt> <tt id="link-25" class="py-name" targets="Function logilab.common.ureports.build_summary()=logilab.common.ureports-module.html#build_summary"><a title="logilab.common.ureports.build_summary" class="py-name" href="#" onclick="return doclink('link-25', 'build_summary', 'link-25');">build_summary</a></tt><tt class="py-op">(</tt><tt class="py-name">child</tt><tt class="py-op">,</tt> <tt id="link-26" class="py-name"><a title="logilab.common.configuration.OptionsProviderMixIn.level" class="py-name" href="#" onclick="return doclink('link-26', 'level', 'link-12');">level</a></tt><tt class="py-op">)</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt> <tt class="py-line"> <tt class="py-name">summary</tt><tt class="py-op">.</tt><tt id="link-27" class="py-name" targets="Method logilab.common.tree.ListNode.append()=logilab.common.tree.ListNode-class.html#append,Method logilab.common.tree.Node.append()=logilab.common.tree.Node-class.html#append,Method logilab.common.ureports.nodes.BaseLayout.append()=logilab.common.ureports.nodes.BaseLayout-class.html#append"><a title="logilab.common.tree.ListNode.append
logilab.common.tree.Node.append
logilab.common.ureports.nodes.BaseLayout.append" class="py-name" href="#" onclick="return doclink('link-27', 'append', 'link-27');">append</a></tt><tt class="py-op">(</tt><tt id="link-28" class="py-name"><a title="logilab.common.vcgutils.VCGPrinter.node" class="py-name" href="#" onclick="return doclink('link-28', 'node', 'link-5');">node</a></tt><tt class="py-op">)</tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt> <tt class="py-line"><tt class="py-comment"># summary.append(node)</tt> </tt>
<a name="L69"></a><tt class="py-lineno"> 69</tt> <tt class="py-line"><tt class="py-comment"># if level and [n for n in child.children if isinstance(n, Section)]:</tt> </tt>
<a name="L70"></a><tt class="py-lineno"> 70</tt> <tt class="py-line"><tt class="py-comment"># summary.append(build_summary(child, level))</tt> </tt>
<a name="L71"></a><tt class="py-lineno"> 71</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">summary</tt> </tt>
</div><a name="L72"></a><tt class="py-lineno"> 72</tt> <tt class="py-line"> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt> <tt class="py-line"> </tt>
<a name="BaseWriter"></a><div id="BaseWriter-def"><a name="L74"></a><tt class="py-lineno"> 74</tt> <a class="py-toggle" href="#" id="BaseWriter-toggle" onclick="return toggle('BaseWriter');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="logilab.common.ureports.BaseWriter-class.html">BaseWriter</a><tt class="py-op">(</tt><tt class="py-base-class">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="BaseWriter-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="BaseWriter-expanded"><a name="L75"></a><tt class="py-lineno"> 75</tt> <tt class="py-line"> <tt class="py-docstring">"""base class for ureport writers"""</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt> <tt class="py-line"> </tt>
<a name="BaseWriter.format"></a><div id="BaseWriter.format-def"><a name="L77"></a><tt class="py-lineno"> 77</tt> <a class="py-toggle" href="#" id="BaseWriter.format-toggle" onclick="return toggle('BaseWriter.format');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.ureports.BaseWriter-class.html#format">format</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">layout</tt><tt class="py-op">,</tt> <tt class="py-param">stream</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-param">encoding</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="BaseWriter.format-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="BaseWriter.format-expanded"><a name="L78"></a><tt class="py-lineno"> 78</tt> <tt class="py-line"> <tt class="py-docstring">"""format and write the given layout into the stream object</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt> <tt class="py-line"><tt class="py-docstring"> unicode policy: unicode strings may be found in the layout;</tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt> <tt class="py-line"><tt class="py-docstring"> try to call stream.write with it, but give it back encoded using</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt> <tt class="py-line"><tt class="py-docstring"> the given encoding if it fails</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">stream</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt> <tt class="py-line"> <tt class="py-name">stream</tt> <tt class="py-op">=</tt> <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">stdout</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">encoding</tt><tt class="py-op">:</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt> <tt class="py-line"> <tt class="py-name">encoding</tt> <tt class="py-op">=</tt> <tt class="py-name">getattr</tt><tt class="py-op">(</tt><tt class="py-name">stream</tt><tt class="py-op">,</tt> <tt class="py-string">'encoding'</tt><tt class="py-op">,</tt> <tt class="py-string">'UTF-8'</tt><tt class="py-op">)</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">encoding</tt> <tt class="py-op">=</tt> <tt class="py-name">encoding</tt> <tt class="py-keyword">or</tt> <tt class="py-string">'UTF-8'</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__compute_funcs</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">out</tt> <tt class="py-op">=</tt> <tt class="py-name">stream</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-29" class="py-name" targets="Method logilab.common.ureports.BaseWriter.begin_format()=logilab.common.ureports.BaseWriter-class.html#begin_format,Method logilab.common.ureports.docbook_writer.DocbookWriter.begin_format()=logilab.common.ureports.docbook_writer.DocbookWriter-class.html#begin_format,Method logilab.common.ureports.html_writer.HTMLWriter.begin_format()=logilab.common.ureports.html_writer.HTMLWriter-class.html#begin_format,Method logilab.common.ureports.text_writer.TextWriter.begin_format()=logilab.common.ureports.text_writer.TextWriter-class.html#begin_format"><a title="logilab.common.ureports.BaseWriter.begin_format
logilab.common.ureports.docbook_writer.DocbookWriter.begin_format
logilab.common.ureports.html_writer.HTMLWriter.begin_format
logilab.common.ureports.text_writer.TextWriter.begin_format" class="py-name" href="#" onclick="return doclink('link-29', 'begin_format', 'link-29');">begin_format</a></tt><tt class="py-op">(</tt><tt class="py-name">layout</tt><tt class="py-op">)</tt> </tt>
<a name="L92"></a><tt class="py-lineno"> 92</tt> <tt class="py-line"> <tt class="py-name">layout</tt><tt class="py-op">.</tt><tt id="link-30" class="py-name" targets="Method logilab.common.visitor.VisitedMixIn.accept()=logilab.common.visitor.VisitedMixIn-class.html#accept"><a title="logilab.common.visitor.VisitedMixIn.accept" class="py-name" href="#" onclick="return doclink('link-30', 'accept', 'link-30');">accept</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">)</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-31" class="py-name" targets="Method logilab.common.ureports.BaseWriter.end_format()=logilab.common.ureports.BaseWriter-class.html#end_format,Method logilab.common.ureports.docbook_writer.DocbookWriter.end_format()=logilab.common.ureports.docbook_writer.DocbookWriter-class.html#end_format,Method logilab.common.ureports.html_writer.HTMLWriter.end_format()=logilab.common.ureports.html_writer.HTMLWriter-class.html#end_format"><a title="logilab.common.ureports.BaseWriter.end_format
logilab.common.ureports.docbook_writer.DocbookWriter.end_format
logilab.common.ureports.html_writer.HTMLWriter.end_format" class="py-name" href="#" onclick="return doclink('link-31', 'end_format', 'link-31');">end_format</a></tt><tt class="py-op">(</tt><tt class="py-name">layout</tt><tt class="py-op">)</tt> </tt>
</div><a name="L94"></a><tt class="py-lineno"> 94</tt> <tt class="py-line"> </tt>
<a name="BaseWriter.format_children"></a><div id="BaseWriter.format_children-def"><a name="L95"></a><tt class="py-lineno"> 95</tt> <a class="py-toggle" href="#" id="BaseWriter.format_children-toggle" onclick="return toggle('BaseWriter.format_children');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.ureports.BaseWriter-class.html#format_children">format_children</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">layout</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="BaseWriter.format_children-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="BaseWriter.format_children-expanded"><a name="L96"></a><tt class="py-lineno"> 96</tt> <tt class="py-line"> <tt class="py-docstring">"""recurse on the layout children and call their accept method</tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt> <tt class="py-line"><tt class="py-docstring"> (see the Visitor pattern)</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">child</tt> <tt class="py-keyword">in</tt> <tt class="py-name">getattr</tt><tt class="py-op">(</tt><tt class="py-name">layout</tt><tt class="py-op">,</tt> <tt class="py-string">'children'</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt> <tt class="py-line"> <tt class="py-name">child</tt><tt class="py-op">.</tt><tt id="link-32" class="py-name"><a title="logilab.common.visitor.VisitedMixIn.accept" class="py-name" href="#" onclick="return doclink('link-32', 'accept', 'link-30');">accept</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">)</tt> </tt>
</div><a name="L101"></a><tt class="py-lineno">101</tt> <tt class="py-line"> </tt>
<a name="BaseWriter.writeln"></a><div id="BaseWriter.writeln-def"><a name="L102"></a><tt class="py-lineno">102</tt> <a class="py-toggle" href="#" id="BaseWriter.writeln-toggle" onclick="return toggle('BaseWriter.writeln');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.ureports.BaseWriter-class.html#writeln">writeln</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">string</tt><tt class="py-op">=</tt><tt class="py-string">u''</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="BaseWriter.writeln-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="BaseWriter.writeln-expanded"><a name="L103"></a><tt class="py-lineno">103</tt> <tt class="py-line"> <tt class="py-docstring">"""write a line in the output buffer"""</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-33" class="py-name" targets="Method logilab.common.changelog.ChangeLog.write()=logilab.common.changelog.ChangeLog-class.html#write,Method logilab.common.changelog.ChangeLogEntry.write()=logilab.common.changelog.ChangeLogEntry-class.html#write,Method logilab.common.ureports.BaseWriter.write()=logilab.common.ureports.BaseWriter-class.html#write"><a title="logilab.common.changelog.ChangeLog.write
logilab.common.changelog.ChangeLogEntry.write
logilab.common.ureports.BaseWriter.write" class="py-name" href="#" onclick="return doclink('link-33', 'write', 'link-33');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">string</tt> <tt class="py-op">+</tt> <tt id="link-34" class="py-name"><a title="logilab.common.textutils.linesep" class="py-name" href="#" onclick="return doclink('link-34', 'linesep', 'link-4');">linesep</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L105"></a><tt class="py-lineno">105</tt> <tt class="py-line"> </tt>
<a name="BaseWriter.write"></a><div id="BaseWriter.write-def"><a name="L106"></a><tt class="py-lineno">106</tt> <a class="py-toggle" href="#" id="BaseWriter.write-toggle" onclick="return toggle('BaseWriter.write');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.ureports.BaseWriter-class.html#write">write</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">string</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="BaseWriter.write-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="BaseWriter.write-expanded"><a name="L107"></a><tt class="py-lineno">107</tt> <tt class="py-line"> <tt class="py-docstring">"""write a string in the output buffer"""</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">out</tt><tt class="py-op">.</tt><tt id="link-35" class="py-name"><a title="logilab.common.changelog.ChangeLog.write
logilab.common.changelog.ChangeLogEntry.write
logilab.common.ureports.BaseWriter.write" class="py-name" href="#" onclick="return doclink('link-35', 'write', 'link-33');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">string</tt><tt class="py-op">)</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">UnicodeEncodeError</tt><tt class="py-op">:</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">out</tt><tt class="py-op">.</tt><tt id="link-36" class="py-name"><a title="logilab.common.changelog.ChangeLog.write
logilab.common.changelog.ChangeLogEntry.write
logilab.common.ureports.BaseWriter.write" class="py-name" href="#" onclick="return doclink('link-36', 'write', 'link-33');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">string</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">encoding</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L112"></a><tt class="py-lineno">112</tt> <tt class="py-line"> </tt>
<a name="BaseWriter.begin_format"></a><div id="BaseWriter.begin_format-def"><a name="L113"></a><tt class="py-lineno">113</tt> <a class="py-toggle" href="#" id="BaseWriter.begin_format-toggle" onclick="return toggle('BaseWriter.begin_format');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.ureports.BaseWriter-class.html#begin_format">begin_format</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">layout</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="BaseWriter.begin_format-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="BaseWriter.begin_format-expanded"><a name="L114"></a><tt class="py-lineno">114</tt> <tt class="py-line"> <tt class="py-docstring">"""begin to format a layout"""</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">section</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
</div><a name="L116"></a><tt class="py-lineno">116</tt> <tt class="py-line"> </tt>
<a name="BaseWriter.end_format"></a><div id="BaseWriter.end_format-def"><a name="L117"></a><tt class="py-lineno">117</tt> <a class="py-toggle" href="#" id="BaseWriter.end_format-toggle" onclick="return toggle('BaseWriter.end_format');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.ureports.BaseWriter-class.html#end_format">end_format</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">layout</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="BaseWriter.end_format-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="BaseWriter.end_format-expanded"><a name="L118"></a><tt class="py-lineno">118</tt> <tt class="py-line"> <tt class="py-docstring">"""finished to format a layout"""</tt> </tt>
</div><a name="L119"></a><tt class="py-lineno">119</tt> <tt class="py-line"> </tt>
<a name="BaseWriter.get_table_content"></a><div id="BaseWriter.get_table_content-def"><a name="L120"></a><tt class="py-lineno">120</tt> <a class="py-toggle" href="#" id="BaseWriter.get_table_content-toggle" onclick="return toggle('BaseWriter.get_table_content');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.ureports.BaseWriter-class.html#get_table_content">get_table_content</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">table</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="BaseWriter.get_table_content-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="BaseWriter.get_table_content-expanded"><a name="L121"></a><tt class="py-lineno">121</tt> <tt class="py-line"> <tt class="py-docstring">"""trick to get table content without actually writing it</tt> </tt>
<a name="L122"></a><tt class="py-lineno">122</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt> <tt class="py-line"><tt class="py-docstring"> return an aligned list of lists containing table cells values as string</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt> <tt class="py-line"> <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">[</tt><tt class="py-op">]</tt><tt class="py-op">]</tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt> <tt class="py-line"> <tt class="py-name">cols</tt> <tt class="py-op">=</tt> <tt id="link-37" class="py-name" targets="Module logilab.common.table=logilab.common.table-module.html"><a title="logilab.common.table" class="py-name" href="#" onclick="return doclink('link-37', 'table', 'link-37');">table</a></tt><tt class="py-op">.</tt><tt class="py-name">cols</tt> </tt>
<a name="L127"></a><tt class="py-lineno">127</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">cell</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-38" class="py-name" targets="Method logilab.common.ureports.BaseWriter.compute_content()=logilab.common.ureports.BaseWriter-class.html#compute_content"><a title="logilab.common.ureports.BaseWriter.compute_content" class="py-name" href="#" onclick="return doclink('link-38', 'compute_content', 'link-38');">compute_content</a></tt><tt class="py-op">(</tt><tt id="link-39" class="py-name"><a title="logilab.common.table" class="py-name" href="#" onclick="return doclink('link-39', 'table', 'link-37');">table</a></tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">cols</tt> <tt class="py-op">==</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
<a name="L129"></a><tt class="py-lineno">129</tt> <tt class="py-line"> <tt class="py-name">result</tt><tt class="py-op">.</tt><tt id="link-40" class="py-name"><a title="logilab.common.tree.ListNode.append
logilab.common.tree.Node.append
logilab.common.ureports.nodes.BaseLayout.append" class="py-name" href="#" onclick="return doclink('link-40', 'append', 'link-27');">append</a></tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
<a name="L130"></a><tt class="py-lineno">130</tt> <tt class="py-line"> <tt class="py-name">cols</tt> <tt class="py-op">=</tt> <tt id="link-41" class="py-name"><a title="logilab.common.table" class="py-name" href="#" onclick="return doclink('link-41', 'table', 'link-37');">table</a></tt><tt class="py-op">.</tt><tt class="py-name">cols</tt> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt> <tt class="py-line"> <tt class="py-name">cols</tt> <tt class="py-op">-=</tt> <tt class="py-number">1</tt> </tt>
<a name="L132"></a><tt class="py-lineno">132</tt> <tt class="py-line"> <tt class="py-name">result</tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt id="link-42" class="py-name"><a title="logilab.common.tree.ListNode.append
logilab.common.tree.Node.append
logilab.common.ureports.nodes.BaseLayout.append" class="py-name" href="#" onclick="return doclink('link-42', 'append', 'link-27');">append</a></tt><tt class="py-op">(</tt><tt class="py-name">cell</tt><tt class="py-op">)</tt> </tt>
<a name="L133"></a><tt class="py-lineno">133</tt> <tt class="py-line"> <tt class="py-comment"># fill missing cells</tt> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt> <tt class="py-line"> <tt class="py-keyword">while</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">result</tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> <tt class="py-op"><</tt> <tt class="py-name">cols</tt><tt class="py-op">:</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt> <tt class="py-line"> <tt class="py-name">result</tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">.</tt><tt id="link-43" class="py-name"><a title="logilab.common.tree.ListNode.append
logilab.common.tree.Node.append
logilab.common.ureports.nodes.BaseLayout.append" class="py-name" href="#" onclick="return doclink('link-43', 'append', 'link-27');">append</a></tt><tt class="py-op">(</tt><tt class="py-string">u''</tt><tt class="py-op">)</tt> </tt>
<a name="L136"></a><tt class="py-lineno">136</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">result</tt> </tt>
</div><a name="L137"></a><tt class="py-lineno">137</tt> <tt class="py-line"> </tt>
<a name="BaseWriter.compute_content"></a><div id="BaseWriter.compute_content-def"><a name="L138"></a><tt class="py-lineno">138</tt> <a class="py-toggle" href="#" id="BaseWriter.compute_content-toggle" onclick="return toggle('BaseWriter.compute_content');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="logilab.common.ureports.BaseWriter-class.html#compute_content">compute_content</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">layout</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="BaseWriter.compute_content-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="BaseWriter.compute_content-expanded"><a name="L139"></a><tt class="py-lineno">139</tt> <tt class="py-line"> <tt class="py-docstring">"""trick to compute the formatting of children layout before actually</tt> </tt>
<a name="L140"></a><tt class="py-lineno">140</tt> <tt class="py-line"><tt class="py-docstring"> writing it</tt> </tt>
<a name="L141"></a><tt class="py-lineno">141</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L142"></a><tt class="py-lineno">142</tt> <tt class="py-line"><tt class="py-docstring"> return an iterator on strings (one for each child element)</tt> </tt>
<a name="L143"></a><tt class="py-lineno">143</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
<a name="L144"></a><tt class="py-lineno">144</tt> <tt class="py-line"> <tt class="py-comment"># use cells !</tt> </tt>
<a name="L145"></a><tt class="py-lineno">145</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">write</tt><tt class="py-op">(</tt><tt class="py-param">data</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L146"></a><tt class="py-lineno">146</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L147"></a><tt class="py-lineno">147</tt> <tt class="py-line"> <tt class="py-name">stream</tt><tt class="py-op">.</tt><tt id="link-44" class="py-name"><a title="logilab.common.changelog.ChangeLog.write
logilab.common.changelog.ChangeLogEntry.write
logilab.common.ureports.BaseWriter.write" class="py-name" href="#" onclick="return doclink('link-44', 'write', 'link-33');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">data</tt><tt class="py-op">)</tt> </tt>
<a name="L148"></a><tt class="py-lineno">148</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">UnicodeEncodeError</tt><tt class="py-op">:</tt> </tt>
<a name="L149"></a><tt class="py-lineno">149</tt> <tt class="py-line"> <tt class="py-name">stream</tt><tt class="py-op">.</tt><tt id="link-45" class="py-name"><a title="logilab.common.changelog.ChangeLog.write
logilab.common.changelog.ChangeLogEntry.write
logilab.common.ureports.BaseWriter.write" class="py-name" href="#" onclick="return doclink('link-45', 'write', 'link-33');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">data</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">encoding</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L150"></a><tt class="py-lineno">150</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">writeln</tt><tt class="py-op">(</tt><tt class="py-param">data</tt><tt class="py-op">=</tt><tt class="py-string">u''</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L151"></a><tt class="py-lineno">151</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L152"></a><tt class="py-lineno">152</tt> <tt class="py-line"> <tt class="py-name">stream</tt><tt class="py-op">.</tt><tt id="link-46" class="py-name"><a title="logilab.common.changelog.ChangeLog.write
logilab.common.changelog.ChangeLogEntry.write
logilab.common.ureports.BaseWriter.write" class="py-name" href="#" onclick="return doclink('link-46', 'write', 'link-33');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">data</tt><tt class="py-op">+</tt><tt id="link-47" class="py-name"><a title="logilab.common.textutils.linesep" class="py-name" href="#" onclick="return doclink('link-47', 'linesep', 'link-4');">linesep</a></tt><tt class="py-op">)</tt> </tt>
<a name="L153"></a><tt class="py-lineno">153</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">UnicodeEncodeError</tt><tt class="py-op">:</tt> </tt>
<a name="L154"></a><tt class="py-lineno">154</tt> <tt class="py-line"> <tt class="py-name">stream</tt><tt class="py-op">.</tt><tt id="link-48" class="py-name"><a title="logilab.common.changelog.ChangeLog.write
logilab.common.changelog.ChangeLogEntry.write
logilab.common.ureports.BaseWriter.write" class="py-name" href="#" onclick="return doclink('link-48', 'write', 'link-33');">write</a></tt><tt class="py-op">(</tt><tt class="py-name">data</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">encoding</tt><tt class="py-op">)</tt><tt class="py-op">+</tt><tt id="link-49" class="py-name"><a title="logilab.common.textutils.linesep" class="py-name" href="#" onclick="return doclink('link-49', 'linesep', 'link-4');">linesep</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L155"></a><tt class="py-lineno">155</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-50" class="py-name"><a title="logilab.common.changelog.ChangeLog.write
logilab.common.changelog.ChangeLogEntry.write
logilab.common.ureports.BaseWriter.write" class="py-name" href="#" onclick="return doclink('link-50', 'write', 'link-33');">write</a></tt> <tt class="py-op">=</tt> <tt id="link-51" class="py-name"><a title="logilab.common.changelog.ChangeLog.write
logilab.common.changelog.ChangeLogEntry.write
logilab.common.ureports.BaseWriter.write" class="py-name" href="#" onclick="return doclink('link-51', 'write', 'link-33');">write</a></tt> </tt>
<a name="L156"></a><tt class="py-lineno">156</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-52" class="py-name" targets="Method logilab.common.ureports.BaseWriter.writeln()=logilab.common.ureports.BaseWriter-class.html#writeln"><a title="logilab.common.ureports.BaseWriter.writeln" class="py-name" href="#" onclick="return doclink('link-52', 'writeln', 'link-52');">writeln</a></tt> <tt class="py-op">=</tt> <tt id="link-53" class="py-name"><a title="logilab.common.ureports.BaseWriter.writeln" class="py-name" href="#" onclick="return doclink('link-53', 'writeln', 'link-52');">writeln</a></tt> </tt>
<a name="L157"></a><tt class="py-lineno">157</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__compute_funcs</tt><tt class="py-op">.</tt><tt id="link-54" class="py-name"><a title="logilab.common.tree.ListNode.append
logilab.common.tree.Node.append
logilab.common.ureports.nodes.BaseLayout.append" class="py-name" href="#" onclick="return doclink('link-54', 'append', 'link-27');">append</a></tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt id="link-55" class="py-name"><a title="logilab.common.changelog.ChangeLog.write
logilab.common.changelog.ChangeLogEntry.write
logilab.common.ureports.BaseWriter.write" class="py-name" href="#" onclick="return doclink('link-55', 'write', 'link-33');">write</a></tt><tt class="py-op">,</tt> <tt id="link-56" class="py-name"><a title="logilab.common.ureports.BaseWriter.writeln" class="py-name" href="#" onclick="return doclink('link-56', 'writeln', 'link-52');">writeln</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L158"></a><tt class="py-lineno">158</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">child</tt> <tt class="py-keyword">in</tt> <tt class="py-name">layout</tt><tt class="py-op">.</tt><tt class="py-name">children</tt><tt class="py-op">:</tt> </tt>
<a name="L159"></a><tt class="py-lineno">159</tt> <tt class="py-line"> <tt class="py-name">stream</tt> <tt class="py-op">=</tt> <tt class="py-name">StringIO</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L160"></a><tt class="py-lineno">160</tt> <tt class="py-line"> <tt class="py-name">child</tt><tt class="py-op">.</tt><tt id="link-57" class="py-name"><a title="logilab.common.visitor.VisitedMixIn.accept" class="py-name" href="#" onclick="return doclink('link-57', 'accept', 'link-30');">accept</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">)</tt> </tt>
<a name="L161"></a><tt class="py-lineno">161</tt> <tt class="py-line"> <tt class="py-keyword">yield</tt> <tt class="py-name">stream</tt><tt class="py-op">.</tt><tt class="py-name">getvalue</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L162"></a><tt class="py-lineno">162</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__compute_funcs</tt><tt class="py-op">.</tt><tt id="link-58" class="py-name" targets="Variable logilab.common.cache.Cache.pop=logilab.common.cache.Cache-class.html#pop,Method logilab.common.tree.ListNode.pop()=logilab.common.tree.ListNode-class.html#pop"><a title="logilab.common.cache.Cache.pop
logilab.common.tree.ListNode.pop" class="py-name" href="#" onclick="return doclink('link-58', 'pop', 'link-58');">pop</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L163"></a><tt class="py-lineno">163</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L164"></a><tt class="py-lineno">164</tt> <tt class="py-line"> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-59" class="py-name"><a title="logilab.common.changelog.ChangeLog.write
logilab.common.changelog.ChangeLogEntry.write
logilab.common.ureports.BaseWriter.write" class="py-name" href="#" onclick="return doclink('link-59', 'write', 'link-33');">write</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-60" class="py-name"><a title="logilab.common.ureports.BaseWriter.writeln" class="py-name" href="#" onclick="return doclink('link-60', 'writeln', 'link-52');">writeln</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__compute_funcs</tt><tt class="py-op">[</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
<a name="L165"></a><tt class="py-lineno">165</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">IndexError</tt><tt class="py-op">:</tt> </tt>
<a name="L166"></a><tt class="py-lineno">166</tt> <tt class="py-line"> <tt class="py-keyword">del</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-61" class="py-name"><a title="logilab.common.changelog.ChangeLog.write
logilab.common.changelog.ChangeLogEntry.write
logilab.common.ureports.BaseWriter.write" class="py-name" href="#" onclick="return doclink('link-61', 'write', 'link-33');">write</a></tt> </tt>
<a name="L167"></a><tt class="py-lineno">167</tt> <tt class="py-line"> <tt class="py-keyword">del</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-62" class="py-name"><a title="logilab.common.ureports.BaseWriter.writeln" class="py-name" href="#" onclick="return doclink('link-62', 'writeln', 'link-52');">writeln</a></tt> </tt>
</div></div><a name="L168"></a><tt class="py-lineno">168</tt> <tt class="py-line"> </tt>
<a name="L169"></a><tt class="py-lineno">169</tt> <tt class="py-line"> </tt>
<a name="L170"></a><tt class="py-lineno">170</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">logilab</tt><tt class="py-op">.</tt><tt id="link-63" class="py-name"><a title="logilab.common" class="py-name" href="#" onclick="return doclink('link-63', 'common', 'link-0');">common</a></tt><tt class="py-op">.</tt><tt id="link-64" class="py-name" targets="Package logilab.common.ureports=logilab.common.ureports-module.html"><a title="logilab.common.ureports" class="py-name" href="#" onclick="return doclink('link-64', 'ureports', 'link-64');">ureports</a></tt><tt class="py-op">.</tt><tt id="link-65" class="py-name" targets="Module logilab.common.ureports.nodes=logilab.common.ureports.nodes-module.html"><a title="logilab.common.ureports.nodes" class="py-name" href="#" onclick="return doclink('link-65', 'nodes', 'link-65');">nodes</a></tt> <tt class="py-keyword">import</tt> <tt class="py-op">*</tt> </tt>
<a name="L171"></a><tt class="py-lineno">171</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">logilab</tt><tt class="py-op">.</tt><tt id="link-66" class="py-name"><a title="logilab.common" class="py-name" href="#" onclick="return doclink('link-66', 'common', 'link-0');">common</a></tt><tt class="py-op">.</tt><tt id="link-67" class="py-name"><a title="logilab.common.ureports" class="py-name" href="#" onclick="return doclink('link-67', 'ureports', 'link-64');">ureports</a></tt><tt class="py-op">.</tt><tt id="link-68" class="py-name" targets="Module logilab.common.ureports.text_writer=logilab.common.ureports.text_writer-module.html"><a title="logilab.common.ureports.text_writer" class="py-name" href="#" onclick="return doclink('link-68', 'text_writer', 'link-68');">text_writer</a></tt> <tt class="py-keyword">import</tt> <tt id="link-69" class="py-name" targets="Class logilab.common.ureports.text_writer.TextWriter=logilab.common.ureports.text_writer.TextWriter-class.html"><a title="logilab.common.ureports.text_writer.TextWriter" class="py-name" href="#" onclick="return doclink('link-69', 'TextWriter', 'link-69');">TextWriter</a></tt> </tt>
<a name="L172"></a><tt class="py-lineno">172</tt> <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">logilab</tt><tt class="py-op">.</tt><tt id="link-70" class="py-name"><a title="logilab.common" class="py-name" href="#" onclick="return doclink('link-70', 'common', 'link-0');">common</a></tt><tt class="py-op">.</tt><tt id="link-71" class="py-name"><a title="logilab.common.ureports" class="py-name" href="#" onclick="return doclink('link-71', 'ureports', 'link-64');">ureports</a></tt><tt class="py-op">.</tt><tt id="link-72" class="py-name" targets="Module logilab.common.ureports.html_writer=logilab.common.ureports.html_writer-module.html"><a title="logilab.common.ureports.html_writer" class="py-name" href="#" onclick="return doclink('link-72', 'html_writer', 'link-72');">html_writer</a></tt> <tt class="py-keyword">import</tt> <tt id="link-73" class="py-name" targets="Class logilab.common.ureports.html_writer.HTMLWriter=logilab.common.ureports.html_writer.HTMLWriter-class.html"><a title="logilab.common.ureports.html_writer.HTMLWriter" class="py-name" href="#" onclick="return doclink('link-73', 'HTMLWriter', 'link-73');">HTMLWriter</a></tt> </tt>
<a name="L173"></a><tt class="py-lineno">173</tt> <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th> <a
href="logilab.common-module.html">Home</a> </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
>Logilab's common library</th>
</tr></table></th>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
Generated by Epydoc 3.0.1
on Sun Jan 17 22:12:20 2016
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
>http://epydoc.sourceforge.net</a>
</td>
</tr>
</table>
<script type="text/javascript">
<!--
// Private objects are initially displayed (because if
// javascript is turned off then we want them to be
// visible); but by default, we want to hide them. So hide
// them unless we have a cookie that says to show them.
checkCookie();
// -->
</script>
</body>
</html>
|