view commons/pyRepetUnit/doc/commons.Checker-pysrc.html @ 31:0ab839023fe4

Uploaded
author m-zytnicki
date Tue, 30 Apr 2013 14:33:21 -0400
parents 94ab73e8a190
children
line wrap: on
line source

<?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>commons.Checker</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">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Package&nbsp;commons ::
        Module&nbsp;Checker
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="commons.Checker-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="commons.Checker-module.html">Module commons.Checker</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-docstring">'''</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"><tt class="py-docstring">Created on 9 avr. 2009</tt> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"><tt class="py-docstring">@author: oinizan</tt> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-docstring">'''</tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt class="py-name">config</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">ConfigParser</tt> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">ConfigParser</tt> <tt class="py-keyword">import</tt> <tt class="py-name">NoSectionError</tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt class="py-name">ConfigParser</tt> <tt class="py-keyword">import</tt> <tt class="py-name">NoOptionError</tt> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"> </tt>
<a name="L11"></a><tt class="py-lineno"> 11</tt>  <tt class="py-line"><tt id="link-0" class="py-name" targets="Variable commons.Checker.LOG_FILE=commons.Checker-module.html#LOG_FILE"><a title="commons.Checker.LOG_FILE" class="py-name" href="#" onclick="return doclink('link-0', 'LOG_FILE', 'link-0');">LOG_FILE</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"/home/oinizan/workspace/repet_pipe/pyRepetUnit/blaster/check/longconf.ini"</tt> </tt>
<a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line"><tt id="link-1" class="py-name" targets="Variable commons.Checker.DEFAULT_LOGGER_NAME=commons.Checker-module.html#DEFAULT_LOGGER_NAME"><a title="commons.Checker.DEFAULT_LOGGER_NAME" class="py-name" href="#" onclick="return doclink('link-1', 'DEFAULT_LOGGER_NAME', 'link-1');">DEFAULT_LOGGER_NAME</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"log02"</tt> </tt>
<a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"> </tt>
<a name="IChecker"></a><div id="IChecker-def"><a name="L14"></a><tt class="py-lineno"> 14</tt> <a class="py-toggle" href="#" id="IChecker-toggle" onclick="return toggle('IChecker');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="commons.Checker.IChecker-class.html">IChecker</a><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="IChecker-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="IChecker-expanded"><a name="L15"></a><tt class="py-lineno"> 15</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line"><tt class="py-docstring">    Interface emulation for a checker </tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="IChecker.check"></a><div id="IChecker.check-def"><a name="L18"></a><tt class="py-lineno"> 18</tt> <a class="py-toggle" href="#" id="IChecker.check-toggle" onclick="return toggle('IChecker.check');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="commons.Checker.IChecker-class.html#check">check</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">arg</tt><tt class="py-op">=</tt><tt class="py-string">""</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="IChecker.check-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="IChecker.check-expanded"><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">        perform check, raise a CheckerException if error occured</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt class="py-docstring">        @param arg:  a collecting parameter: put here all you need to perform check  </tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-docstring">        @type arg: choose the appropriate type</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line">        <tt class="py-keyword">pass</tt> </tt>
</div></div><a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"> </tt>
<a name="Checker"></a><div id="Checker-def"><a name="L27"></a><tt class="py-lineno"> 27</tt> <a class="py-toggle" href="#" id="Checker-toggle" onclick="return toggle('Checker');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="commons.Checker.Checker-class.html">Checker</a> <tt class="py-op">(</tt><tt class="py-base-class">IChecker</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Checker-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Checker-expanded"><a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-docstring">    A concrete checker implementation with a logging.</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-docstring">    Logger instance is a singleton of logging module </tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="Checker._handle"></a><div id="Checker._handle-def"><a name="L32"></a><tt class="py-lineno"> 32</tt> <a class="py-toggle" href="#" id="Checker._handle-toggle" onclick="return toggle('Checker._handle');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="commons.Checker.Checker-class.html#_handle">_handle</a> <tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Checker._handle-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Checker._handle-expanded"><a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line">            <tt class="py-name">single</tt> <tt class="py-op">=</tt> <tt id="link-2" class="py-name" targets="Class commons.Checker._Logger=commons.Checker._Logger-class.html"><a title="commons.Checker._Logger" class="py-name" href="#" onclick="return doclink('link-2', '_Logger', 'link-2');">_Logger</a></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">except</tt> <tt id="link-3" class="py-name"><a title="commons.Checker._Logger" class="py-name" href="#" onclick="return doclink('link-3', '_Logger', 'link-2');">_Logger</a></tt><tt class="py-op">,</tt> <tt class="py-name">l</tt><tt class="py-op">:</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line">            <tt class="py-name">single</tt> <tt class="py-op">=</tt> <tt class="py-name">l</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">single</tt>     </tt>
</div><a name="L38"></a><tt class="py-lineno"> 38</tt>  <tt class="py-line">     </tt>
<a name="Checker.__init__"></a><div id="Checker.__init__-def"><a name="L39"></a><tt class="py-lineno"> 39</tt> <a class="py-toggle" href="#" id="Checker.__init__-toggle" onclick="return toggle('Checker.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="commons.Checker.Checker-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Checker.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Checker.__init__-expanded"><a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line">        <tt class="py-name">logger</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-4" class="py-name" targets="Method commons.Checker.Checker._handle()=commons.Checker.Checker-class.html#_handle"><a title="commons.Checker.Checker._handle" class="py-name" href="#" onclick="return doclink('link-4', '_handle', 'link-4');">_handle</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_log</tt> <tt class="py-op">=</tt> <tt class="py-name">logger</tt><tt class="py-op">.</tt><tt id="link-5" class="py-name" targets="Method commons.Checker.Checker.getLogger()=commons.Checker.Checker-class.html#getLogger,Method commons.Checker._Logger.getLogger()=commons.Checker._Logger-class.html#getLogger"><a title="commons.Checker.Checker.getLogger
commons.Checker._Logger.getLogger" class="py-name" href="#" onclick="return doclink('link-5', 'getLogger', 'link-5');">getLogger</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line">    </tt>
<a name="Checker.setLogger"></a><div id="Checker.setLogger-def"><a name="L43"></a><tt class="py-lineno"> 43</tt> <a class="py-toggle" href="#" id="Checker.setLogger-toggle" onclick="return toggle('Checker.setLogger');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="commons.Checker.Checker-class.html#setLogger">setLogger</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">logger</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Checker.setLogger-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Checker.setLogger-expanded"><a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line"><tt class="py-docstring">        set (change) default logger</tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line"><tt class="py-docstring">        </tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line"><tt class="py-docstring">        @param logger: a new logger</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line"><tt class="py-docstring">        @type logger: class Logger </tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_log</tt> <tt class="py-op">=</tt> <tt class="py-name">logger</tt> </tt>
</div><a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line"> </tt>
<a name="Checker.getLogger"></a><div id="Checker.getLogger-def"><a name="L52"></a><tt class="py-lineno"> 52</tt> <a class="py-toggle" href="#" id="Checker.getLogger-toggle" onclick="return toggle('Checker.getLogger');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="commons.Checker.Checker-class.html#getLogger">getLogger</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Checker.getLogger-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Checker.getLogger-expanded"><a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">        <tt class="py-docstring">"""</tt> </tt>
<a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line"><tt class="py-docstring">        returns the logger instance</tt> </tt>
<a name="L55"></a><tt class="py-lineno"> 55</tt>  <tt class="py-line"><tt class="py-docstring">        """</tt> </tt>
<a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_log</tt> </tt>
</div></div><a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line"> </tt>
<a name="CheckerException"></a><div id="CheckerException-def"><a name="L58"></a><tt class="py-lineno"> 58</tt> <a class="py-toggle" href="#" id="CheckerException-toggle" onclick="return toggle('CheckerException');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="commons.Checker.CheckerException-class.html">CheckerException</a><tt class="py-op">(</tt><tt class="py-base-class">Exception</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CheckerException-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="CheckerException-expanded"><a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line"><tt class="py-docstring">    Exception raised during check. </tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar msg : message embeded in Execption class   </tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line"><tt class="py-docstring">    @type msg: str</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="CheckerException.__init__"></a><div id="CheckerException.__init__-def"><a name="L66"></a><tt class="py-lineno"> 66</tt> <a class="py-toggle" href="#" id="CheckerException.__init__-toggle" onclick="return toggle('CheckerException.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="commons.Checker.CheckerException-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">msg</tt><tt class="py-op">=</tt><tt class="py-string">""</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="CheckerException.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="CheckerException.__init__-expanded"><a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">msg</tt> <tt class="py-op">=</tt> <tt class="py-name">msg</tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line">        <tt class="py-name">Exception</tt><tt class="py-op">.</tt><tt id="link-6" class="py-name" targets="Method commons.Checker.Checker.__init__()=commons.Checker.Checker-class.html#__init__,Method commons.Checker.CheckerException.__init__()=commons.Checker.CheckerException-class.html#__init__,Method commons.Checker.ConfigChecker.__init__()=commons.Checker.ConfigChecker-class.html#__init__,Method commons.Checker.ConfigException.__init__()=commons.Checker.ConfigException-class.html#__init__,Method commons.Checker._Logger.__init__()=commons.Checker._Logger-class.html#__init__"><a title="commons.Checker.Checker.__init__
commons.Checker.CheckerException.__init__
commons.Checker.ConfigChecker.__init__
commons.Checker.ConfigException.__init__
commons.Checker._Logger.__init__" class="py-name" href="#" onclick="return doclink('link-6', '__init__', 'link-6');">__init__</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt class="py-name">msg</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line"> </tt>
<a name="ConfigChecker"></a><div id="ConfigChecker-def"><a name="L70"></a><tt class="py-lineno"> 70</tt> <a class="py-toggle" href="#" id="ConfigChecker-toggle" onclick="return toggle('ConfigChecker');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="commons.Checker.ConfigChecker-class.html">ConfigChecker</a> <tt class="py-op">(</tt><tt class="py-base-class">IChecker</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="ConfigChecker-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="ConfigChecker-expanded"><a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line"><tt class="py-docstring">    A checker for config file. </tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar sectionName: section to check in config file</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line"><tt class="py-docstring">    @type sectionName: str</tt> </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar optionsDict: dict with option to check as keys and empty strings "" as values</tt> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line"><tt class="py-docstring">    @type optionsDict: class Dict</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line"> </tt>
<a name="ConfigChecker.__init__"></a><div id="ConfigChecker.__init__-def"><a name="L80"></a><tt class="py-lineno"> 80</tt> <a class="py-toggle" href="#" id="ConfigChecker.__init__-toggle" onclick="return toggle('ConfigChecker.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="commons.Checker.ConfigChecker-class.html#__init__">__init__</a> <tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">sectionName</tt><tt class="py-op">,</tt> <tt class="py-param">optionsDict</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="ConfigChecker.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ConfigChecker.__init__-expanded"><a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_sectionName</tt> <tt class="py-op">=</tt> <tt class="py-name">sectionName</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_optionsDict</tt> <tt class="py-op">=</tt> <tt class="py-name">optionsDict</tt> </tt>
</div><a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line">    <tt class="py-string">"""</tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line"><tt class="py-string">    Check options stored in optionsDict. 3 checks are performed:</tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line"><tt class="py-string">    (i) config file existence, (ii) section existence, (iii) options existences</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line"><tt class="py-string">    If a check fail, raise a ConfigException with a list of messages</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line"><tt class="py-string">    """</tt> </tt>
<a name="ConfigChecker.check"></a><div id="ConfigChecker.check-def"><a name="L88"></a><tt class="py-lineno"> 88</tt> <a class="py-toggle" href="#" id="ConfigChecker.check-toggle" onclick="return toggle('ConfigChecker.check');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="commons.Checker.ConfigChecker-class.html#check">check</a> <tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">configFile</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="ConfigChecker.check-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ConfigChecker.check-expanded"><a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">        <tt class="py-name">config</tt> <tt class="py-op">=</tt> <tt class="py-name">ConfigParser</tt><tt class="py-op">.</tt><tt class="py-name">ConfigParser</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">msg</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line">        <tt class="py-keyword">try</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">config</tt><tt class="py-op">.</tt><tt class="py-name">readfp</tt><tt class="py-op">(</tt> <tt class="py-name">open</tt><tt class="py-op">(</tt><tt class="py-name">configFile</tt><tt class="py-op">)</tt> <tt class="py-op">)</tt> </tt>
<a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">IOError</tt><tt class="py-op">,</tt> <tt class="py-name">e</tt><tt class="py-op">:</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line">            <tt class="py-name">msg</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-string">"CONFIG FILE not found - "</tt> <tt class="py-op">+</tt> <tt class="py-name">e</tt><tt class="py-op">.</tt><tt class="py-name">message</tt><tt class="py-op">)</tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-7" class="py-name" targets="Class commons.Checker.ConfigException=commons.Checker.ConfigException-class.html"><a title="commons.Checker.ConfigException" class="py-name" href="#" onclick="return doclink('link-7', 'ConfigException', 'link-7');">ConfigException</a></tt><tt class="py-op">(</tt><tt class="py-string">""</tt><tt class="py-op">,</tt> <tt class="py-name">msg</tt><tt class="py-op">)</tt>  </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line"> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-op">(</tt><tt class="py-name">config</tt><tt class="py-op">.</tt><tt class="py-name">has_section</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_sectionName</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line">            <tt class="py-name">msg</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-string">"["</tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_sectionName</tt> <tt class="py-op">+</tt> <tt class="py-string">"]"</tt> <tt class="py-op">+</tt> <tt class="py-string">" section not found - "</tt><tt class="py-op">)</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-8" class="py-name"><a title="commons.Checker.ConfigException" class="py-name" href="#" onclick="return doclink('link-8', 'ConfigException', 'link-7');">ConfigException</a></tt><tt class="py-op">(</tt><tt class="py-string">""</tt><tt class="py-op">,</tt> <tt class="py-name">msg</tt><tt class="py-op">)</tt> </tt>
<a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line">          </tt>
<a name="L101"></a><tt class="py-lineno">101</tt>  <tt class="py-line">        <tt class="py-name">isExceptionOccured</tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt>         </tt>
<a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">key</tt> <tt class="py-keyword">in</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_optionsDict</tt><tt class="py-op">.</tt><tt class="py-name">keys</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line">            <tt class="py-keyword">try</tt><tt class="py-op">:</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 class="py-name">_optionsDict</tt><tt class="py-op">[</tt><tt class="py-name">key</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-name">config</tt><tt class="py-op">.</tt><tt class="py-name">get</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_sectionName</tt><tt class="py-op">,</tt> <tt class="py-name">key</tt><tt class="py-op">)</tt>  </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">            <tt class="py-keyword">except</tt> <tt class="py-name">NoOptionError</tt><tt class="py-op">,</tt> <tt class="py-name">e</tt><tt class="py-op">:</tt> </tt>
<a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line">                <tt class="py-name">msg</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-string">"["</tt> <tt class="py-op">+</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">_sectionName</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 class="py-name">e</tt><tt class="py-op">.</tt><tt class="py-name">message</tt><tt class="py-op">)</tt> </tt>
<a name="L107"></a><tt class="py-lineno">107</tt>  <tt class="py-line">                <tt class="py-name">isExceptionOccured</tt> <tt class="py-op">=</tt> <tt class="py-name">True</tt> </tt>
<a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">         </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-op">(</tt><tt class="py-name">isExceptionOccured</tt><tt class="py-op">)</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">raise</tt> <tt id="link-9" class="py-name"><a title="commons.Checker.ConfigException" class="py-name" href="#" onclick="return doclink('link-9', 'ConfigException', 'link-7');">ConfigException</a></tt><tt class="py-op">(</tt><tt class="py-string">""</tt><tt class="py-op">,</tt> <tt class="py-name">msg</tt><tt class="py-op">)</tt>  </tt>
</div></div><a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line"> </tt>
<a name="ConfigException"></a><div id="ConfigException-def"><a name="L112"></a><tt class="py-lineno">112</tt> <a class="py-toggle" href="#" id="ConfigException-toggle" onclick="return toggle('ConfigException');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="commons.Checker.ConfigException-class.html">ConfigException</a><tt class="py-op">(</tt><tt class="py-base-class">Exception</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="ConfigException-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="ConfigException-expanded"><a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line">     </tt>
<a name="L114"></a><tt class="py-lineno">114</tt>  <tt class="py-line">    <tt class="py-docstring">"""</tt> </tt>
<a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line"><tt class="py-docstring">    A exception raised by check method class ConfigChecker</tt> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar msg : message embeded in Execption class   </tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line"><tt class="py-docstring">    @type msg: str</tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line"><tt class="py-docstring">    </tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar messages: list of messages</tt> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line"><tt class="py-docstring">    @type messages: Class list</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">    """</tt> </tt>
<a name="ConfigException.__init__"></a><div id="ConfigException.__init__-def"><a name="L124"></a><tt class="py-lineno">124</tt> <a class="py-toggle" href="#" id="ConfigException.__init__-toggle" onclick="return toggle('ConfigException.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="commons.Checker.ConfigException-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt><tt class="py-param">msg</tt><tt class="py-op">,</tt> <tt class="py-param">messages</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>
</div><div id="ConfigException.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="ConfigException.__init__-expanded"><a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">messages</tt> <tt class="py-op">=</tt> <tt class="py-name">messages</tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line">        <tt class="py-name">Exception</tt><tt class="py-op">.</tt><tt id="link-10" class="py-name"><a title="commons.Checker.Checker.__init__
commons.Checker.CheckerException.__init__
commons.Checker.ConfigChecker.__init__
commons.Checker.ConfigException.__init__
commons.Checker._Logger.__init__" class="py-name" href="#" onclick="return doclink('link-10', '__init__', 'link-6');">__init__</a></tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt class="py-name">msg</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line"> </tt>
<a name="_Logger"></a><div id="_Logger-def"><a name="L128"></a><tt class="py-lineno">128</tt> <a class="py-toggle" href="#" id="_Logger-toggle" onclick="return toggle('_Logger');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="commons.Checker._Logger-class.html">_Logger</a><tt class="py-op">:</tt> </tt>
</div><div id="_Logger-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_Logger-expanded"><a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line">     </tt>
<a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line">    <tt class="py-name">__single</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line">     </tt>
<a name="_Logger.__init__"></a><div id="_Logger.__init__-def"><a name="L132"></a><tt class="py-lineno">132</tt> <a class="py-toggle" href="#" id="_Logger.__init__-toggle" onclick="return toggle('_Logger.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="commons.Checker._Logger-class.html#__init__">__init__</a><tt class="py-op">(</tt> <tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">loggerName</tt> <tt class="py-op">=</tt><tt class="py-string">""</tt> <tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_Logger.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_Logger.__init__-expanded"><a name="L133"></a><tt class="py-lineno">133</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-11" class="py-name"><a title="commons.Checker._Logger" class="py-name" href="#" onclick="return doclink('link-11', '_Logger', 'link-2');">_Logger</a></tt><tt class="py-op">.</tt><tt class="py-name">__single</tt><tt class="py-op">:</tt> </tt>
<a name="L134"></a><tt class="py-lineno">134</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-12" class="py-name"><a title="commons.Checker._Logger" class="py-name" href="#" onclick="return doclink('link-12', '_Logger', 'link-2');">_Logger</a></tt><tt class="py-op">.</tt><tt class="py-name">__single</tt> </tt>
<a name="L135"></a><tt class="py-lineno">135</tt>  <tt class="py-line">        <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt class="py-name">config</tt><tt class="py-op">.</tt><tt class="py-name">fileConfig</tt><tt class="py-op">(</tt><tt id="link-13" class="py-name"><a title="commons.Checker.LOG_FILE" class="py-name" href="#" onclick="return doclink('link-13', 'LOG_FILE', 'link-0');">LOG_FILE</a></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">if</tt> <tt class="py-op">(</tt><tt class="py-name">loggerName</tt> <tt class="py-op">!=</tt> <tt class="py-string">""</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L137"></a><tt class="py-lineno">137</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__log</tt> <tt class="py-op">=</tt> <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name"><a title="commons.Checker.Checker.getLogger
commons.Checker._Logger.getLogger" class="py-name" href="#" onclick="return doclink('link-14', 'getLogger', 'link-5');">getLogger</a></tt><tt class="py-op">(</tt><tt class="py-name">loggerName</tt><tt class="py-op">)</tt> </tt>
<a name="L138"></a><tt class="py-lineno">138</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L139"></a><tt class="py-lineno">139</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__log</tt> <tt class="py-op">=</tt> <tt class="py-name">logging</tt><tt class="py-op">.</tt><tt id="link-15" class="py-name"><a title="commons.Checker.Checker.getLogger
commons.Checker._Logger.getLogger" class="py-name" href="#" onclick="return doclink('link-15', 'getLogger', 'link-5');">getLogger</a></tt><tt class="py-op">(</tt><tt id="link-16" class="py-name"><a title="commons.Checker.DEFAULT_LOGGER_NAME" class="py-name" href="#" onclick="return doclink('link-16', 'DEFAULT_LOGGER_NAME', 'link-1');">DEFAULT_LOGGER_NAME</a></tt><tt class="py-op">)</tt> </tt>
<a name="L140"></a><tt class="py-lineno">140</tt>  <tt class="py-line">        <tt id="link-17" class="py-name"><a title="commons.Checker._Logger" class="py-name" href="#" onclick="return doclink('link-17', '_Logger', 'link-2');">_Logger</a></tt><tt class="py-op">.</tt><tt class="py-name">__single</tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt> </tt>
</div><a name="L141"></a><tt class="py-lineno">141</tt>  <tt class="py-line"> </tt>
<a name="_Logger.getLogger"></a><div id="_Logger.getLogger-def"><a name="L142"></a><tt class="py-lineno">142</tt> <a class="py-toggle" href="#" id="_Logger.getLogger-toggle" onclick="return toggle('_Logger.getLogger');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="commons.Checker._Logger-class.html#getLogger">getLogger</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="_Logger.getLogger-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="_Logger.getLogger-expanded"><a name="L143"></a><tt class="py-lineno">143</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__log</tt> </tt>
</div></div><a name="L144"></a><tt class="py-lineno">144</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">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></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 Fri Apr 10 16:39:01 2009
    </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>