[reportlab-users] drawToFile and drawToString docstrings

Peter peter at maubp.freeserve.co.uk
Fri Jan 30 07:24:02 EST 2009


Hi,

This is suggestion for how to improve a couple of the docstrings for
the render back ends,
reportlab/graphics/renderPDF.py
reportlab/graphics/renderPS.py
reportlab/graphics/renderSVG.py
reportlab/graphics/renderPM.py

In particular, for the drawToFile and drawToString methods (which to
my mind are the most important methods), some of these files don't
even define a docstring.

For drawToFile, it would be nice to say that the fn argument can be a
filename (I guess that's what fn stands for) OR a handle object for
output (e.g. from opening a file in write mode, or a StringIO handle).
Otherwise you have to work this out by trial and error, or reading
the code and working it out. I was pleasantly surprised to discover
this for myself, as I had needed to do this.

For drawToString, I personally would find it informative to know this
works by using a cStringIO or StringIO handle internally - but
otherwise the current phasing is fine (when there is a docstring at
all).

Thanks,

Peter


More information about the reportlab-users mailing list