merge ReportLab_2_7
authorAndy Robinson <andy@reportlab.com>
Wed, 03 Apr 2013 22:25:01 +0100
changeset 3681 97456f60eb12
parent 3680 cbfd10f961b0 (current diff)
parent 3679 ffe8e4d1acab (diff)
child 3682 0a60388157ba
merge
--- a/README.txt	Wed Apr 03 22:18:16 2013 +0100
+++ b/README.txt	Wed Apr 03 22:25:01 2013 +0100
@@ -49,47 +49,20 @@
 ===============
 
 In most cases, ``easy_install reportlab`` or ``pip install reportlab`` will 
-do the job.  Full details follow below.
+do the job.  Full details follow below for each platform.
+
 
+2.1 General prerequisites
+--------------------------
 You need to have installed Python (versions 2.5 through 2.7),
 and ideally PIL with Freetype support; more notes on prerequisites
 follow below.  
 
-On Unix and Mac OS we assume a C compiler is available to compile the
-C extensions.  For Windows, we make binary versions available.
-
-On Ubuntu, you will need
-*build-essential*, *libfreetype6-dev*, *python-dev* and *python-imaging*.
-Most other Linux and xBSD distributions have packages with
-similar names.
-
-On Mac OS, you will need XCode with the Command Line Tools option.  On Lion
-or later, type ``clang`` at a prompt; if you get ``command not found`` or
-similar, the C compiler is not installed.  We then recommend the *brew* 
-installation tool to fetch open source packages. You should run::
-
-    brew install freetype
-    
-before instaling *reportlab* to ensure that the Python Imaging Library gets 
-compiled with JPEG support.    
+2.2. Where to get the code
+------------------------------------------
 
-On Windows, if you wish to compile the C extensions yourself, you need the correct 
-version of Visual Studio for the Python you are using. However most people will 
-simply use the .exe installer. 
-
-
-We aim to be compatible with several of the popular installation
-techniques - please pick your preferred one below...
-
-
-2.1. Source Distribution or Mercurial repo
-------------------------------------------
-From March 2013, the code is being hosted in Mercurial on BitBucket.
-You can obtain the latest code from our Mercurial repository with::
-
-    hg clone http://bitbucket.org/rptlab/reportlab
     
-Alternatively, daily and release builds are available from ReportLab's
+Daily and release builds are available from ReportLab's
 open download area::
 
     http://www.reportlab.org/ftp/
@@ -98,65 +71,25 @@
 ``reportlab-YYYYMMDD/`` but are otherwise structured just like the Mercurial
 repository and release builds.
 
+Releases are also available from the Python Package Index:
+
+    http://pypi.python.org/
+
+From March 2013, the code is being hosted in Mercurial on BitBucket.
+You can obtain the latest code from our Mercurial repository with::
+
+    hg clone http://bitbucket.org/rptlab/reportlab
+
+
 Users of our commercial libraries, and/or anyone who registers on our site,
 can also access our commercial area which has exactly the same packages,
 paired with the matching commercial ones (rlextra); it is important to keep
 both in sync.
 
-We strongly recommend using ``virtualenv`` for Python projects.
-
-Use::
-
-    python setup.py install   
-
-After this has completed you should be able to run::
-
-    python setup.py tests
-
-and see error-free output.  
-
-(Note 1: If you see a line of dots, and a small number of errors
-relating to renderPM, it's likely that your C compiler
-environment is incorrect and that the renderPM C extension
-could not be installed. However, it's only needed if you
-want to generate bitmap graphics - more on this below.)
-
-(Note 2: There is also an option ``python setup.py tests-preinstall``, 
-which will run the tests where you unpack the files; this is 
-expected to fail on one or two tests involving renderPM as 
-that extension has not been compiled yet.)
-
-(Note 3: with no internet connection, there may be issues downloading
-fonts, and also two tests which load images from a URL will fail)
 
 
 
-2.2 Manual Installation without C Compiler (e.g. Windows)
----------------------------------------------------------
-
-- Either place the ``src/`` folder on your path, or move
-  the ``reportlab`` package inside it to somewhere on your
-  path such as ``site-packages``.  
-
-- Optional: on Win32, get the DLLs for your Python version from
-  here and copy them into ``site-packages``.  The library can
-  make PDFs without these but will go slower and lack
-  bitmap image generation capabilities.
-  
-    http://www.reportlab.org/ftp/win32-dlls/
-
-
-2.3 easy-install / setuptools / pip
------------------------------------
-These are popular Python deployment tools.
-
-You should be able to install with 
-``easy_install reportlab``.   We do NOT use a setuptools-based
-script, but have modified our distribution to be compatible with 
-easy_install.  You can also do ``pip install reportlab``
-
-
-2.4 Windows .exe Installer
+2.3 Windows Installer
 --------------------------
 A binary ``.exe`` installer for Windows (built with distutils) is
 available on our website.  This will install the 'reportlab' package
@@ -167,24 +100,44 @@
 we suggest you also download a source copy, unzip it and work with the
 examples/tests within that directory.
 
+2.4 Mac OS
+-------------
+On Mac OS, you will need XCode with the Command Line Tools option installed
+in order to compile the C extensions.  On Lion
+or later, type ``clang`` at a prompt; if you get ``command not found`` or
+similar, the C compiler is not installed.  
 
-2.5 Ubuntu and other Debian-based Systems
------------------------------------------
-The latest releases are generally available in the Ubuntu repositories
-within 2-3 weeks.  At the time of writing (20th Jan 2010) the basic
-reportlab installer does not include the C extensions, so we recommend
-installing these THREE packages for a full-speed, full-features installation::
+We then recommend the *brew* installation tool to fetch open source packages. 
+You should run::
+
+    brew install freetype
+    
+before instaling *reportlab* to ensure that the Python Imaging Library gets 
+compiled with JPEG support.    
+
+Thereafter, you can install with  ``easy_install reportlab`` or by fetching
+the source and using ``python setup.py install``
+    
 
-    sudo apt-get install python-reportlab python-reportlab-accel python-renderpm  
-    
-There is also a package python-reportlab-doc including the built PDF manuals,
-which are also available on our website.
+2.5 Unix / Linux
+-----------------
+
+On Unix and Mac OS we assume a C compiler is available to compile the
+C extensions.  
 
-Alternatively, if you would rather compile from source
-you will need compilers and other dependencies as follows, and can then
-follow the instructions in 2.1 above::
+On Ubuntu, you will need
+*build-essential*, *libfreetype6-dev*, *python-dev* and *python-imaging*.
+Most other Linux and xBSD distributions have packages with
+similar names.
+
 
-    sudo apt-get install build-essential libfreetype6-dev python-dev python-imaging
+Thereafter, you can use ``easy_install reportlab``, ``pip install reportlab``,
+or fetch the source and use ``python setup.py install``.
+
+From Ubuntu 12.04 desktop onwards, a copy of reportlab is already installed.
+Take care not to confuse it with any releases you download. 
+
+
 
 
 3. Prerequisites / Dependencies
@@ -236,7 +189,9 @@
 .pdf.  It is worth reviewing the list of test scripts as they provide valuable 'how
 to' information.
 
-
+If you have no internet connection, one or two tests may fail where we try to load images
+from URLs.  This is normal.  The next release of this package will silently skip 
+such tests using features only available in Python 2.7.
 
 6. Demos
 ========
--- a/docs/userguide/ch1_intro.py	Wed Apr 03 22:18:16 2013 +0100
+++ b/docs/userguide/ch1_intro.py	Wed Apr 03 22:25:01 2013 +0100
@@ -242,118 +242,15 @@
 
 heading2("Installation and Setup")
 
-heading3("A note on available versions")
-disc("""Our website ^http://www.reportlab.com/^ will always have up-to-date
-information on setups and installations. The latest version of the ReportLab library can be found at
-^http://www.reportlab.com/software/opensource/rl-toolkit/download/^.
-Older versions can be found at ^http://www.reportlab.com/ftp/^.
-""")
-disc("""Each successive version is stored in both zip
-and tgz format, but the contents are identical apart from line endings.
-Versions are numbered:  $ReportLab_<major_version>_<minor_version>.zip$, 
-$ReportLab_<major_version>_<minor_version>.tgz$ and so on.
-""")
-disc("""
-The latest stable version is $reportlab2.6$ (.zip or .tgz). 
-Daily snapshots of the trunk are available as
-$reportlab-daily-unix.tar.gz$ or $reportlab-daily-win32.zip$.
-""")
-disc("""Finally, from version 2.4 onwards, there is also a Windows installer
-available for Python versions 2.5 - 2.7, named $ReportLab-2.x.win32-py2.x.exe$
-""")
-
-pencilnote()
-disc("""We plan to drop the support of Python 2.5 in our next release.
-We advise you to move to Python 2.6 or 2.7.
-""")
+disc("""To avoid duplication, the installation instructions are kept in the README file
+in our distribution, which can be viewed online at ^http://bitbucket.org/rptlab/reportlab/^""")
 
-heading3("Installation on Windows")
-
-restartList()
-
-list("""First, install Python from $http://www.python.org/.$
-Reportlab 2.x works with Python 2.5 upwards but we recommend to use
-the latest stable version of Python 2.7.  
-After installing, you should be able to run the
-'Python (command line)' option from the Start Menu.
-""")
-
-list("""We strongly recommend installing the Python Windows
-Extensions, which gives you access to Windows data sources, COM support, WinAPI calls, and the PythonWin IDE.  This
-can be found at ^http://sourceforge.net/projects/pywin32/^.
-Once this is installed, you can start
-Pythonwin from the Start Menu and get a GUI application.
-""")
-
-list("""Install the Python Imaging Library ($PIL$) from $http://www.pythonware.com/products/pil/$.  This
-step is optional but allows you to include images in your reports.
-""")
-
-list("""Now you are ready to install reportlab itself.  
-The easiest way to do this is to use the .exe installer for Windows, which
-installs both the ReportLab source code and the precompiled DLLs for you.
+disc("""This release (2.7) of ReportLab requires Python versions 2.5, 2.6 or 2.7.   We will
+be maintaining a 2.7.x branch for essential bug fixes, but after this release the focus of
+our development will shift to dual support for Python 2.7 and 3.3+.  We advise everyone who
+can to move to Python 2.7.
 """)
 
-list("""
-If, however, you wish to install from source, download and unzip the archive
-from from the downloads page on ^http://www.reportlab.com/^ and copy the $reportlab$ directory
-onto your PythonPath;  You should now be able to go to a Python
-command line interpreter and type $import reportlab$ without getting
-an error message.
-""")
-
-list("""Next, Download the zip file of precompiled DLLs for your Python version from
-the bottom of the downloads page on ^http://www.reportlab.com/^, and unzip
-them into ^C:\Python2x\lib\site-packages^ (or its equivalent for other Python versions
-""")
-
-list("""Open up a $MS-DOS$ command prompt and CD to
-"$reportlab\\..\\tests$".  Enter "$runAll.py$". You should see lots of dots
-and no error messages.  This will also create many PDF files and generate
-the manuals in ^reportlab/docs^ (including this one). """)
-
-list("""
-Finally, we recommend you download and run the script ^rl_check.py^ from
-^http://www.reportlab.com/ftp/^. This will health-check all the above
-steps and warn you if anything is missing or mismatched.""")
-
-heading3("Installation instructions for Unix")
-disc("""
-Many Linux distributions already include or can deliver a ReportLab distribution, although this may be a few months behind our own releases.  On Ubuntu, simply use ^sudo apt-get install python-reportlab^.   In addition, we support the Python packaging mechanisms so you can use ^easy_install reportlab^ in most Python environments.
-""")
-disc("""
-If you want to install the latest version of our code, or to install your own reportlab to go with our commercial distribution, you can install from source as follows:""")
-
-restartList()
-list("""First, install Python.  On a large number of Unix and Linux distributions, Python is already installed,
-or is available as a standard package you can install with the relevant package manager.""")
-
-list("""
-    You will also need to install the Freetype 2 Font Engine, Python Imaging Library, and the gzip library,
-    along with a C compiler.
-""")
-
-list("""You will also need the source code or relevant dev packages for Python and the FreeType 2 Font engine.
-""")
-
-list("""
-Download the latest ReportLab.tgz from the download page on http://www.reportlab.com.
-""")
-
-list("""
-Unpack the archive and follow the instructions in INSTALL.txt.
-""")
-
-list("""You should now be able to run python and execute the python statement
-$import reportlab$ without errors.
-""")
-
-heading3("Instructions for Python novices: Mac")
-disc("""
-This is much, much easier with Mac OS X since Python is installed on your
-system as standard.   Just follow the instructions for installing the ReportLab archive
-above.
-""")
 
 
 heading2("Getting Involved")
@@ -390,6 +287,12 @@
 and contributions.  The mailing list is
 the place to report bugs and get support. """)
 
+disc("""The code now lives on BitBucket ($http://bitbucket.org/rptlab/reportlab/$)
+in a Mercurial repository, along with an issue tracker and wiki.  Everyone should
+feel free to contribute, but if you are working actively on some improvements
+or want to draw attention to an issue, please use the mailing list to let us know.""")
+
+
 
 heading2("Site Configuration")
 disc("""There are a number of options which most likely need to be configured globally for a site.
@@ -442,11 +345,6 @@
 """)
 
 
-bullet("""<b>How to think like a computer scientist</b> (Python version)</b>.
-$http://www.ibiblio.org/obp/thinkCSpy/$
-""")
-
-
 bullet("""<b>Instant Python</b>.
 A 6-page minimal crash course by Magnus Lie Hetland.
 $http://www.hetland.org/python/instant-python.php$
@@ -465,65 +363,25 @@
 indent0_style = styles['Indent0']
 indent1_style = styles['Indent1']
 
-heading2("Goals for the 2.x series")
+heading2("Goals for the 2.x and 3.x release series")
 disc("""The main rationale for 2.0 was an incompatible change at the character level:
-to properly support Unicode input. Now that it's out we will maintain compatibility
-with 2.0. There are no pressing feature wishlists and new features will be driven,
-as always, by contributions and the demands of projects.""")
+to properly support Unicode input. Since then, we have tried to maintain backward
+compatibility up to this version 2.7""")
 
-disc("""One area where we do want to make progress from release to release is with documentation
-and installability. We'll be looking into better support for distutils, setuptools,
-eggs and so on; and into better examples and tools to help people learn what's in the
-(substantial) code base.""")
+disc("""One main area where we have tried to make progress from release to release is with documentation
+and installability. We now offer full support for distutils, setuptools, pip and so on. """)
 
 disc("""
-Bigger ideas and more substantial rewrites are deferred to Version 3.0, with no particular
-target dates.
+Immediately after this release, we will be shifting focus to work on compatibility with both
+Python 2.7 and 3.3+, and starting to make larger changes to the ReportLab Toolkit to bring it
+up to date - using more modern Python libraries, supporting newer PDF features and more.  The
+next ReportLab release is likely to be numbered 3.0.  Inevitability this modernisation will need
+some changes to applications, although we do not plan to needlessly change APIs.
 """)
 
-heading2("What's New in ReportLab 2.6")
-disc("""This is a minor release focusing mainly on improved documentation. There are a 
-number of minor enhancements, and a larger number of previous-undocumented
-enhancements which we have documented better.""")
-
-disc("""A big thanks goes to the community for their help in reporting bugs and providing patches. 
-Thanks to everybody who has contributed to the open-source toolkit in the run-up to the 2.6 release, 
-whether by reporting bugs, sending patches, or contributing to the reportlab-users mailing list. 
-Thanks especially to the following people: Alex Buck, Felix Labrecque,
-Peter Johnson, James Martin-Collar and Guillaume Francois.
-This page documents what has changed since version 2.5.""")
-
-disc('Reportlab 2.6 is installable with easy_install. You must have installed a compatible C compiler and the dependencies such as Freetype and PIL.')
-
-heading4('General changes')
-bullet("""Manuals have been reformatted with more pleasing code snippets and tables of 
-contents, and reviewed and expanded.""")
+heading2("What's New in ReportLab 2.7")
+disc("""This is a minor release to collect a small number of bug fixes since the last release
+at end of September 2012.   Detailed release notes are available at 
+$http://www.reportlab.com/software/documentation/relnotes/27/$""")
 
-heading4('Flowing documents (Platypus)')
-bullet("""Added support for HTML-style list objects.""")
-bullet("""Added flexible mechanism for drawing bullets.""")
-bullet("""Allowed XPreformatted objects to use Asian line wrapping.""")
-bullet("""Added an 'autoNextPageTemplate' attribute to PageTemplates. For example you 
-can now set up a 'chapter first page template' which will always be followed
-by a 'continuation template' on the next page break, saving the programmer from
-having to issue control flow commands in the story.""")
-bullet("""Added a TopPadder flowable, which will 'wrap' another Flowable and move it 
-to the bottom of the current page.""")
-bullet("""More helpful error messages when large tables cannot be rendered.""")
-bullet("""Documentation for images within text (test_032_images).""")
-bullet("""Trailing dots for use on contents pages.""")
 
-heading4('Charts and graphics')
-bullet("""Support for UPCA bar codes.""")
-bullet("""We now have a semi-intelligent system for labelling pie charts with 
-callout lines.  Thanks to James Martin-Collar, a maths student at Warwick 
-University, who did this as his summer internship.""")
-bullet("""Axes - added startOffset and endOffset properties; allowed for axis 
-background annotations.""")
-bullet("""Bar charts - allow more control of z Index (i.e. drawing order of axes and
-lines)""")
-bullet("""Pie charts - fixed bugs in 3d appearance.""")
-bullet("""SVG output back end has seen some bugs fixed and now outputs resizeable SVG.""")
-
-# Noteworthy bug fixes Section #######################
-#heading3("Noteworthy bug fixes")
--- a/docs/userguide/ch2_graphics.py	Wed Apr 03 22:18:16 2013 +0100
+++ b/docs/userguide/ch2_graphics.py	Wed Apr 03 22:25:01 2013 +0100
@@ -774,6 +774,8 @@
 
 illust(examples.fonts, "the 14 standard fonts")
 
+disc("""The Symbol and ZapfDingbats fonts cannot display properly because the required glyphs are not present in those fonts.""")
+
 disc("""
 For information on how to use arbitrary fonts, see the next chapter.
 """)
--- a/docs/userguide/graph_charts.py	Wed Apr 03 22:18:16 2013 +0100
+++ b/docs/userguide/graph_charts.py	Wed Apr 03 22:25:01 2013 +0100
@@ -106,8 +106,8 @@
        contributed by a user; we'd like to make it easy to create such
        drawings, hook the building blocks up to their legends, and feed that
        data in a consistent way.""")
-disc("""<para lindent=+36>(If you want to see the image, it is available on our website at
-<font color=blue>http://www.reportlab.com/demos/provencio.pdf</font>)""")
+disc("""<para lindent=+36>(If you want to see the image, it is available on our website
+<font color="blue"><a href="https://www.reportlab.com/media/imadj/data/RLIMG_e5e5cb85cc0a555f5433528ac38c5884.PDF">here</a></font>)""")
 
 
 ##heading3("Key Concepts and Components")
--- a/src/reportlab/__init__.py	Wed Apr 03 22:18:16 2013 +0100
+++ b/src/reportlab/__init__.py	Wed Apr 03 22:25:01 2013 +0100
@@ -3,7 +3,7 @@
 #history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/__init__.py
 __version__=''' $Id$ '''
 __doc__="""The Reportlab PDF generation library."""
-Version = "2.6"
+Version = "2.7"
 
 import sys
 
--- a/src/reportlab/graphics/barcode/__init__.py	Wed Apr 03 22:18:16 2013 +0100
+++ b/src/reportlab/graphics/barcode/__init__.py	Wed Apr 03 22:25:01 2013 +0100
@@ -125,8 +125,12 @@
     d.add(bc, "_bc")
     return d
 
-def createBarcodeImageInMemory(codeName, **options):
+def createBarcodeImageInMemory(codeName,**options):
     """This creates and returns barcode as an image in memory.
-    """    
+    Takes same arguments as createBarcodeDrawing and also an
+    optional format keyword which can be anything acceptable
+    to Drawing.asString eg gif, pdf, tiff, py ......
+    """
+    format = options.pop('format','png')
     d = createBarcodeDrawing(codeName, **options)
     return d.asString(format)
--- a/src/reportlab/graphics/barcode/test.py	Wed Apr 03 22:18:16 2013 +0100
+++ b/src/reportlab/graphics/barcode/test.py	Wed Apr 03 22:25:01 2013 +0100
@@ -21,7 +21,7 @@
 from reportlab.platypus.flowables import XBox, KeepTogether
 from reportlab.graphics.shapes import Drawing
 
-from reportlab.graphics.barcode import getCodes, getCodeNames, createBarcodeDrawing
+from reportlab.graphics.barcode import getCodes, getCodeNames, createBarcodeDrawing, createBarcodeImageInMemory
 def run():
     styles = getSampleStyleSheet()
     styleN = styles['Normal']
@@ -190,3 +190,11 @@
 if __name__=='__main__':
     run()
     fullTest()
+    def createSample(name,memory):
+        f = open(name,'wb')
+        f.write(memory)
+        f.close()
+    createSample('test_cbcim.png',createBarcodeImageInMemory('EAN13', value='123456789012'))
+    createSample('test_cbcim.gif',createBarcodeImageInMemory('EAN8', value='1234567', format='gif'))
+    createSample('test_cbcim.pdf',createBarcodeImageInMemory('UPCA', value='03600029145',format='pdf'))
+    createSample('test_cbcim.tiff',createBarcodeImageInMemory('USPS_4State', value='01234567094987654321',routing='01234567891',format='tiff'))
--- a/src/reportlab/graphics/charts/piecharts.py	Wed Apr 03 22:18:16 2013 +0100
+++ b/src/reportlab/graphics/charts/piecharts.py	Wed Apr 03 22:25:01 2013 +0100
@@ -515,6 +515,7 @@
         orderMode = AttrMapValue(OneOf('fixed','alternate'),advancedUsage=1),
         xradius = AttrMapValue(isNumberOrNone, desc="X direction Radius"),
         yradius = AttrMapValue(isNumberOrNone, desc="Y direction Radius"),
+        innerRadiusFraction = AttrMapValue(isNumberOrNone, desc="fraction of radii to start wedges at"),
         wedgeRecord = AttrMapValue(None, desc="callable(wedge,*args,**kwds)",advancedUsage=1),
         sideLabels = AttrMapValue(isBoolean, desc="If true attempt to make piechart with labels along side and pointers"),
         sideLabelsOffset = AttrMapValue(isNumber, desc="The fraction of the pie width that the labels are situated at from the edges of the pie"),
@@ -536,7 +537,7 @@
         self.pointerLabelMode = None
         self.sameRadii = False
         self.orderMode = 'fixed'
-        self.xradius = self.yradius = None
+        self.xradius = self.yradius = self.innerRadiusFraction = None
         self.sideLabels = 0
         self.sideLabelsOffset = 0.1
 
@@ -753,6 +754,8 @@
         L = []
         L_add = L.append
 
+        innerRadiusFraction = self.innerRadiusFraction
+
         for i,(a1,a2) in angles:
             if a2 is None: continue
             #if we didn't use %stylecount here we'd end up with the later wedges
@@ -775,10 +778,15 @@
                     cx = centerx + popout*cosAA
                     cy = centery + popout*sinAA
 
-            if aa>=_ANGLEHI:
-                theWedge = Ellipse(cx, cy, xradius, yradius)
+            if innerRadiusFraction:
+                theWedge = Wedge(cx, cy, xradius, a1, a2, yradius=yradius,
+                        radius1=xradius*innerRadiusFraction,yradius1=yradius*innerRadiusFraction)
             else:
-                theWedge = Wedge(cx, cy, xradius, a1, a2, yradius=yradius)
+                if aa>=_ANGLEHI:
+                    theWedge = Ellipse(cx, cy, xradius, yradius)
+                else:
+                    theWedge = Wedge(cx, cy, xradius, a1, a2, yradius=yradius)
+
 
             theWedge.fillColor = wedgeStyle.fillColor
             theWedge.strokeColor = wedgeStyle.strokeColor
--- a/src/reportlab/lib/utils.py	Wed Apr 03 22:18:16 2013 +0100
+++ b/src/reportlab/lib/utils.py	Wed Apr 03 22:25:01 2013 +0100
@@ -291,11 +291,16 @@
         return m
     except ImportError:
         sys.path = opath
-        msg = "recursiveimport(%s,baseDir=%s) failed" % (modulename,baseDir)
+        msg = "Could not import '%s'" % modulename
         if baseDir:
-            msg = msg + " under paths '%s'" % repr(path)
+            msg = msg + " under %s" % baseDir
         raise ImportError, msg
 
+    except Exception, e:
+        msg = "Exception raised while importing '%s': %s" % (modulename, e.message)
+        raise ImportError, msg
+        
+
 def recursiveGetAttr(obj, name):
     "Can call down into e.g. object1.object2[4].attr"
     return eval(name, obj.__dict__)
--- a/tests/test_lib_utils.py	Wed Apr 03 22:18:16 2013 +0100
+++ b/tests/test_lib_utils.py	Wed Apr 03 22:25:01 2013 +0100
@@ -119,6 +119,32 @@
         b = getStringIO(_rel_open_and_read('../docs/images/Edit_Prefs.gif'))
         b = open_and_read(b)
 
+
+    def testRecursiveImportErrors(self):
+        "check we get useful error messages"
+        try:
+            m1 = recursiveImport('reportlab.pdfgen.brush')
+            self.fail("Imported a nonexistent module")
+        except ImportError, e:
+            self.assertEquals(e.message, "Could not import 'reportlab.pdfgen.brush'")
+            
+        try:
+            m1 = recursiveImport('totally.non.existent')
+            self.fail("Imported a nonexistent module")
+        except ImportError, e:
+            self.assertEquals(e.message, "Could not import 'totally.non.existent'")
+
+        try:
+            #import a module in the 'tests' directory with a bug
+            m1 = recursiveImport('unimportable')
+            self.fail("Imported a buggy module")
+        except ImportError, e:
+            self.assert_('integer division or modulo by zero' in e.message)
+
+
+
+
+
 def makeSuite():
     return makeSuiteForClasses(ImporterTestCase)
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/unimportable.py	Wed Apr 03 22:25:01 2013 +0100
@@ -0,0 +1,10 @@
+#module you cannot import
+"""
+This is a fixture used for testing a dynamic import function.
+
+It is supposed to produce an error when imported.
+"""
+
+value = 100 / 0
+
+