Skip to main content

An easy solution to design reports using OpenOffice

Project description

Introduction
============

py3o is an elegant and scalable solution to design
reports using LibreOffice or OpenOffice.
py3o.template is the templating component that takes care of
merging your data sets with a corresponding templated OpenOffice document.

It is plateform independent and does not require LibreOffice/OpenOffice itself
to generate an ODF file.

If you want to generate a PDF or any other supported output format you will then
need to have a server with either LibreOffice or OpenOffice and to install
the `py3o.renderserver`_ on it. We also provide a docker image on
the `docker hub`_

If you want to have templating fusion & document conversion in one
single web service usable from any language with just HTTP/POST you can install
`py3o.fusion`_ server. Which also exists as a `docker image`_

Python 3 support
================

py3o.fusion is python3 ready. But, yes there is a but... alas!,
you'll need to install a trunk version of Genshi::

$ # activate your python env...
$ svn checkout http://svn.edgewall.org/repos/genshi/trunk genshi_trunk
$ cd genshi_trunk
$ python setup.py build
$ python setup.py install

We tested this with revision 1271.
When genshi 0.8 is released we can officially say we support Python3 out of
the box.

Full Documentation
==================

We `provide a documentation`_ for this package. If anything is not correctly
explained, please! create a ticket `in our ticketing system`_

Example Usage
=============

Below is an example that you can find in the source code inside the examples
directory.

::

from py3o.template import Template

t = Template("py3o_example_template.odt", "py3o_example_output.odt")

t.set_image_path('staticimage.logo', 'images/new_logo.png')


class Item(object):
pass

items = list()

item1 = Item()
item1.val1 = 'Item1 Value1'
item1.val2 = 'Item1 Value2'
item1.val3 = 'Item1 Value3'
item1.Currency = 'EUR'
item1.Amount = '12345.35'
item1.InvoiceRef = '#1234'
items.append(item1)

for i in xrange(1000):
item = Item()
item.val1 = 'Item%s Value1' % i
item.val2 = 'Item%s Value2' % i
item.val3 = 'Item%s Value3' % i
item.Currency = 'EUR'
item.Amount = '6666.77'
item.InvoiceRef = 'Reference #%04d' % i
items.append(item)

document = Item()
document.total = '9999999999999.999'

data = dict(items=items, document=document)
t.render(data)

Changelog
=========

0.9.2 Jun. 26 2015
~~~~~~~~~~~~~~~~~~

- WARNING: if you used the old image replacement system, you
need to update your code to set static image from this::

# old way
t.set_image_path('logo', 'images/new_logo.png')

# You should now set it like this instead

# new way. Note the 'staticimage.' prefix added just before 'logo'
t.set_image_path('staticimage.logo', 'images/new_logo.png')

- WARNING: after updating your code you must also update your template
to prefix your static images names with the 'staticimage.' prefix.

- Added dynamic images support. You can now add images instructions inside
for loops or anywhere in your templates and pass the image data
inside your objects attributes.
- Added support for image data (dynamic ones) being passed-in as base64
data. This is useful for some clients like `Odoo's report_py3o`_ because
they store image data as base64 encoded fields.

.. _Odoo's report_py3o: https://bitbucket.org/xcg/report_py3o

0.9.1 Jun. 3 2015
~~~~~~~~~~~~~~~~~

- Fixed parser to read from the var name instead of its description,
if you dont use the helper tool to introspect your reports this release
is of no importance to you as it only fixes this particular point.

0.9 Jan. 8 2015
~~~~~~~~~~~~~~~~

- Added support for soft page breaks


0.8 Nov. 19 2014
~~~~~~~~~~~~~~~~

- Added better unit tests
- Fixed corner cases in the variable introspection mechanism
- Better handling of "ignore_undefined" that now also allows undefined images

0.7 Oct. 15 2014
~~~~~~~~~~~~~~~~

- Added Python3 support
- Fixed a problem with validity of output in case the template contains
a text:list inside a for loop
- Added new public methods to help report servers introspect the template
data dictionary
- Added real unit tests (96% coverage ATM, way to go test team!)

Contributors
============

By order of contribution date:

- `Florent Aide`_
- `Emmanuel Cazenave`_
- `jon1012`_
- `Eugene Morozov`_
- `Houzéfa Abbasbay`_
- `Torsten Irländer`_
- `Sergey Fedoseev`_
- `Vincent Lhote-Hatakeyama`_
- `Anael Lorimier`_
- `Björn Ricks`_

.. _Florent Aide: https://bitbucket.org/faide
.. _Emmanuel Cazenave: https://bitbucket.org/cazino
.. _jon1012: https://bitbucket.org/jon1012
.. _Eugene Morozov: https://bitbucket.org/mojo
.. _Houzéfa Abbasbay: https://bitbucket.org/houzefa-abba
.. _Torsten Irländer: https://bitbucket.org/ti
.. _Sergey Fedoseev: https://bitbucket.org/sir_sigurd
.. _Vincent Lhote-Hatakeyama: https://bitbucket.org/vincent_lhote
.. _Anael Lorimier: https://bitbucket.org/alorimier
.. _Björn Ricks: https://bitbucket.org/bjoernricks

.. _py3o.renderserver: https://bitbucket.org/faide/py3o.renderserver/
.. _provide a documentation: http://py3otemplate.readthedocs.org
.. _in our ticketing system: https://bitbucket.org/faide/py3o.template/issues?status=new&status=open
.. _docker hub: https://registry.hub.docker.com/u/xcgd/py3oserver-docker/
.. _py3o.fusion: https://bitbucket.org/faide/py3o.fusion
.. _docker image: https://registry.hub.docker.com/u/xcgd/py3o.fusion

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

py3o.template-0.9.3.zip (772.3 kB view details)

Uploaded Source

py3o.template-0.9.3.tar.gz (726.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

py3o.template-0.9.3-py3.4.egg (381.4 kB view details)

Uploaded Egg

py3o.template-0.9.3-py3-none-any.whl (357.1 kB view details)

Uploaded Python 3

py3o.template-0.9.3-py2.7.egg (379.7 kB view details)

Uploaded Egg

py3o.template-0.9.3-py2-none-any.whl (356.9 kB view details)

Uploaded Python 2

File details

Details for the file py3o.template-0.9.3.zip.

File metadata

  • Download URL: py3o.template-0.9.3.zip
  • Upload date:
  • Size: 772.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for py3o.template-0.9.3.zip
Algorithm Hash digest
SHA256 0ef118ff01fb61c637e03205a15a2a4cc5c47ef2639bc4e03814203767b93431
MD5 abd82a815348d760722452123fb0a1a5
BLAKE2b-256 57e6d37022ad3e4857ef1a7eb83ad40751ff817b3c639a12654208f30faf051c

See more details on using hashes here.

File details

Details for the file py3o.template-0.9.3.tar.gz.

File metadata

  • Download URL: py3o.template-0.9.3.tar.gz
  • Upload date:
  • Size: 726.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for py3o.template-0.9.3.tar.gz
Algorithm Hash digest
SHA256 c8ecb8ee7ddfbdbe522fe7e5afa78ff9ef6b9742a83da43677d67dbdf7710e6e
MD5 eafa87f94cdcfcc5befc30e20f9f9c02
BLAKE2b-256 922ee97cc3415935cb5d62618a850683335d0e3b94c624bc9adb170905d7ae26

See more details on using hashes here.

File details

Details for the file py3o.template-0.9.3-py3.4.egg.

File metadata

File hashes

Hashes for py3o.template-0.9.3-py3.4.egg
Algorithm Hash digest
SHA256 2f88f42810540eac7b2836166a0dcef8e6ace011f02a47f24ea8deeea24aec73
MD5 7e4d08740aae39cfd55a12bde7095b12
BLAKE2b-256 06a204aac97402b638aa6bb03519c8e96b5bb0d8555182a6f3c55b4a9f589595

See more details on using hashes here.

File details

Details for the file py3o.template-0.9.3-py3-none-any.whl.

File metadata

File hashes

Hashes for py3o.template-0.9.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2332fa8a095f3ed8ad78b30454da22f1d8c2f95ea7642817a465b0de1ed4a37a
MD5 69a1246223c26438132cfab8177115bc
BLAKE2b-256 f523cf05d10dfa62b6024cf7103e4d1cda60ab710ccff24081b9961241ccfbbc

See more details on using hashes here.

File details

Details for the file py3o.template-0.9.3-py2.7.egg.

File metadata

File hashes

Hashes for py3o.template-0.9.3-py2.7.egg
Algorithm Hash digest
SHA256 b2d1d8700f3364f1e5ca5659b57bf3447d22a611d1f2e2c20c71880e3517d4e2
MD5 31964bc24fdf60e27085e9dfa3b8aa8a
BLAKE2b-256 b17b46fb5665cf9971b98cc4cdc8ad571b6e3f21d6821543f71ed1e7499a2275

See more details on using hashes here.

File details

Details for the file py3o.template-0.9.3-py2-none-any.whl.

File metadata

File hashes

Hashes for py3o.template-0.9.3-py2-none-any.whl
Algorithm Hash digest
SHA256 570c5a681367af11b9aa04ffcc9e242da29a31132b143b0ca2559feba0ad1fcb
MD5 819677233732516b8fe639b35ca7f9ce
BLAKE2b-256 785283ab4b8669f57a7c4818e3c9297a55183b91422c9f16bbb73930e63eeca4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page