bugGNU Health - Bugs: bug #39053, Demo script is not idempotent

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #39053: Demo script is not idempotent

Submitter:  Emilien Klein <e2jk>
Submitted:  Thu 23 May 2013 06:53:36 PM UTC
   
 
Category:  Demo environment Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  smarro
Open/Closed:  Closed Release:  1.9.0
Module:  demo Component:  None

Mon 27 May 2013 11:17:00 PM UTC, comment #1: 

Emilien, now the script checks if the health module was not previously installed before creating the Betz Family data.

Also added command line options: passwords, modules to install and database name.

Features taken from Tryton Demo Script. Thanks Cédric Krier!

changeset 777:5b032a984550

Sebastián Marró <smarro>
Thu 23 May 2013 06:53:36 PM UTC, original submission:  

If the demo script is run multiple times, it will:
- create multiple "GNU SOLIDARIO Hospital" parties
- create multiple "Insurator" parties
- end up crashing (Traceback copied below)

In the process of creating the Debian package for GNU Health, I plan to create a gnuhealth-demo package which will create the demo database for the user. The creation script will be run each time the package is updated.

My suggestion is to add a check as the first thing in the script, to see if the gnuhealth-demo database already exists. If that's the case, then don't go further and stop the script.



Traceback (most recent call last):
  File "../health_demo_server.py", line 192, in <module>
    LoadBetzFamilyInfo()
  File "../health_demo_server.py", line 82, in LoadBetzFamilyInfo
    party.save()
  File "/usr/lib/python2.7/dist-packages/proteus/__init__.py", line 649, in save
    self.__id = self._proxy.create(values, context)
  File "/usr/lib/python2.7/dist-packages/proteus/config.py", line 144, in _call_
    result = rpc.result(meth(args, *kwargs))
  File "/usr/lib/python2.7/dist-packages/trytond/modules/health/health.py", line 578, in create
    return super(PartyPatient, cls).create(values)
  File "/usr/lib/python2.7/dist-packages/trytond/modules/party/party.py", line 165, in create
    return super(Party, cls).create(values)
  File "/usr/lib/python2.7/dist-packages/trytond/model/modelsql.py", line 371, in create
    cls.raise_user_error(error)
  File "/usr/lib/python2.7/dist-packages/trytond/error.py", line 70, in raise_user_error
    raise UserError(error)
trytond.exceptions.UserError: ('UserError', ('This health professional is already assigned to a party', ''))

Emilien Klein <e2jk>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by smarro (Updated the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-05-27 smarro StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2013-05-23 smarro StatusNone Confirmed
        Assigned toNone smarro
        ReleaseNone 1.9.0
    2013-05-23 e2jk Carbon-Copy- Added e2jk

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code