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

Submitted by:  Emilien Klein <e2jk>
Submitted on:  Thu 23 May 2013 06:53:36 PM UTC  
 
Category: Demo environmentSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Sebastián Marró <smarro>
Open/Closed: ClosedRelease: 1.9.0
Module: demo

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>In charge of this item.
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>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 27 May 2013 11:17:00 PM UTCsmarroStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Thu 23 May 2013 07:01:36 PM UTCsmarroStatusNone=>Confirmed
      Assigned toNone=>smarro
      ReleaseNone=>1.9.0
    Thu 23 May 2013 06:53:36 PM UTCe2jkCarbon-Copy-=>Added e2jk

    Back to the top


    Powered by Savane 3.1-cleanup1