gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] Circular dependecy: help


From: Karsten Hilbert
Subject: Re: [Gnumed-devel] Circular dependecy: help
Date: Sun, 16 May 2004 16:10:32 +0200
User-agent: Mutt/1.3.22.1i

> I have set up a circular dependency in the business objects
> gmPatient depends on gmClinicalRecord, fine.
One workaround is to lazy import on demand:

gmPatient = None

def send_referral:
    global gmPatient
    if gmPatient is None:
        from ... import gmPatient as _gmPatient
        gmPatient = _gmPatient
    ...

sorta ugly but works

> But, to write gmClinicalRecord.send_referral () I need gmPatient, to grab the 
> demographics 
> object of the patient (for their name and address on the letter). Python, 
> surprisingly, doesn't
> let me do this.
Surprised me, too.

> What's the solution? Is there a better place to put the referral-letter code? 
> where?
This *may* warrant a business/gmReferral.py, perhaps. Which
would handle all the referral related business logic in
various classes and methods.

def instantiate_referral_form()
send_referral(a_referral_instance)

etc

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346




reply via email to

[Prev in Thread] Current Thread [Next in Thread]