<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 02/25/2014 11:02 PM, Aline Manera
      wrote:<br>
    </div>
    <blockquote cite="mid:530CB085.1090906@linux.vnet.ibm.com"
      type="cite">On 02/25/2014 11:56 AM, Sheldon wrote:
      <br>
      <blockquote type="cite">On 02/25/2014 10:47 PM, Aline Manera
        wrote:
        <br>
        <blockquote type="cite">
          <blockquote type="cite">
            <blockquote type="cite">
              <br>
              The exception instance was being used as the missing
              parameter what is
              <br>
              causing errors like below:
              <br>
            </blockquote>
            is KeyError?
            <br>
            <br>
            dic = {"a": "a"}
            <br>
            In [124]: dic['b']
            <br>
            ---------------------------------------------------------------------------
            <br>
            KeyError: 'b'
            <br>
            <br>
            <br>
            or TypeError?
            <br>
            <blockquote type="cite">
              <br>
              TypeError: coercing to Unicode: need string or buffer,
              exceptions.KeyError found
              <br>
            </blockquote>
          </blockquote>
          <br>
          As you can see the TypeError is caused by an KeyError
          <br>
        </blockquote>
        as I comment as follow:
        <br>
        except KeyError, item:
        <br>
        key is better than item?
        <br>
      </blockquote>
      <br>
      why? it is a reference to the exception
      <br>
      But I am OK with both
      <br>
      <br>
    </blockquote>
    sure. it is a reference. and agree it is not the scope of this
    patch.<br>
    item is just some confused.  Though it is OK.<br>
    <br>
    For example:<br>
    In [168]: dog_owned_by = {'Peter': 'Furry', 'Sally': 'Fluffy'}<br>
    <br>
    In [169]: dog_owned_by['NoExit']<br>
    KeyError: 'NoExit'<br>
    <br>
    <b>which are keys:</b><br>
    In [170]: dog_owned_by.keys()<br>
    Out[170]: ['Peter', 'Sally']<br>
    <br>
    <b>what are items:</b><br>
    In [171]: dog_owned_by.items()<br>
    Out[171]: [('Peter', 'Furry'), ('Sally', 'Fluffy')]<br>
    <br>
    <blockquote cite="mid:530CB085.1090906@linux.vnet.ibm.com"
      type="cite">Anyway, this is not the scope of this patch
      <br>
      <br>
      <blockquote type="cite">
        <blockquote type="cite">
          <br>
          <blockquote type="cite">
            <blockquote type="cite">
              <br>
              To fix use the string representation for the exception
              instance.
              <br>
              <br>
              Signed-off-by: Aline Manera <a class="moz-txt-link-rfc2396E" href="mailto:alinefm@br.ibm.com">&lt;alinefm@br.ibm.com&gt;</a>
              <br>
              ---
              <br>
                src/kimchi/mockmodel.py            |    4 ++--
              <br>
                src/kimchi/model/storagepools.py   |    2 +-
              <br>
                src/kimchi/model/storagevolumes.py |    2 +-
              <br>
                src/kimchi/root.py                 |    2 +-
              <br>
                4 files changed, 5 insertions(+), 5 deletions(-)
              <br>
              <br>
              diff --git a/src/kimchi/mockmodel.py
              b/src/kimchi/mockmodel.py
              <br>
              index b50bf31..b23a024 100644
              <br>
              --- a/src/kimchi/mockmodel.py
              <br>
              +++ b/src/kimchi/mockmodel.py
              <br>
              @@ -367,7 +367,7 @@ class MockModel(object):
              <br>
                                pool.info['autostart'] = False
              <br>
                        except KeyError, item:
              <br>
                            raise MissingParameter("KCHPOOL0004E",
              <br>
              -                                   {'item': item, 'name':
              name})
              <br>
              +                                   {'item': str(item),
              'name': name})
              <br>
            </blockquote>
            except KeyError, key:
            <br>
            key is right than item
            <br>
          </blockquote>
        </blockquote>
        here.
        <br>
        <blockquote type="cite">
          <blockquote type="cite">
            <br>
            <blockquote type="cite">
              <br>
                        if name in self._mock_storagepools or name in
              (ISO_POOL_NAME,):
              <br>
                            raise InvalidOperation("KCHPOOL0001E",
              {'name': name}) </blockquote>
          </blockquote>
        </blockquote>
        <br>
        <br>
      </blockquote>
      <br>
      <br>
      <br>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Thanks and best regards!

Sheldon Feng(冯少合)<a class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com">&lt;shaohef@linux.vnet.ibm.com&gt;</a>
IBM Linux Technology Center</pre>
  </body>
</html>