libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject svn commit: r864801 - in /websites/staging/libcloud/trunk/content: ./ contributing.html
Date Sat, 08 Jun 2013 04:26:05 GMT
Author: buildbot
Date: Sat Jun  8 04:26:05 2013
New Revision: 864801

Staging update by buildbot for libcloud

    websites/staging/libcloud/trunk/content/   (props changed)

Propchange: websites/staging/libcloud/trunk/content/
--- cms:source-revision (original)
+++ cms:source-revision Sat Jun  8 04:26:05 2013
@@ -1 +1 @@

Modified: websites/staging/libcloud/trunk/content/contributing.html
--- websites/staging/libcloud/trunk/content/contributing.html (original)
+++ websites/staging/libcloud/trunk/content/contributing.html Sat Jun  8 04:26:05 2013
@@ -127,6 +127,31 @@
 <li>Any non-trivial change must contain tests</li>
 <li>All the functions and methods must contain <a href="">pydoc</a>
docstrings which are used to generate API documentation. You can find a lot of examples of
docstrings in the existing code e.g. - <code>libcloud/compute/</code></li>
+<h3 id="multiple_python_version">Supporting Multiple Python Versions</h3>
+<p>Libcloud supports a variety of Python versions so your code also needs to work
+with all the supported versions. This means that in some cases you will need to
+include extra code to make sure it works in all the supported versions.</p>
+<p>Some examples:</p>
+<h4 id="context-managers">Context Managers</h4>
+<p>Context managers aren't available in Python 2.5 by default. If you want to use
+them make sure to put <code>from __future__ import with_statement</code> on top
of the file where you use them.</p>
+<h4 id="exception-handling">Exception Handling</h4>
+<p>There is no unified way to handle exceptions and extract the exception object
+in Python 2.5 and Python 3.x. This means you need to use a
+<code>sys.exc_info()[1]</code> approach to extract the raised exception object.</p>
+<p>For example:</p>
+<div class="codehilite"><pre><span class="k">try</span><span class="p">:</span>
+    <span class="n">some</span> <span class="n">code</span>
+<span class="k">except</span> <span class="ne">Exception</span><span
+    <span class="n">e</span> <span class="o">=</span> <span class="n">sys</span><span
class="o">.</span><span class="n">exc_info</span><span class="p">()[</span><span
class="mi">1</span><span class="p">]</span>
+    <span class="k">print</span> <span class="n">e</span>
+<h4 id="python-3">Python 3</h4>
+<p>You can find a lot of utility functions which make code easier to work with 2.x
+and 3.x in <code>libcloud.utils.py3</code> module.</p>
 <p><em>Note: If you want you can also use SVN repository, but git and github
make branching and contributing a bit easier.</em></p>
 <h3 id="style_guide">Style Guide</h3>

View raw message