How to use the PyBonita lib

First, initialize a BonitaServer. Each commands then rely on the BonitaServer.

Examples

Creating a Process instance (opening a new case)

BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')

process = BonitaProcess('Demande_de_genotypage--1.0')

variables = {'demandeur':'julien.seiler@igbmc.fr', 'titre':'Au secours', 'demande_initiale':'Plein de soucis'}
case = process.instanciate(variables=variables)

case.delete()

Adding a user

BonitaServer.use('localhost', 9090, 'restuser', 'restbpm')

user = BonitaUser(username="john",password="onepass")
user.save()

Exception thrown

Each exception has its own error message. When catching an Exception, you can retrieve additional information in the err_info instance variable.

For example

try:
    # Some code raising a BonitaException or subclass
except BonitaException as be:
    print 'additional info : %s' % (str(be.err_info))