gnumed-devel
[Top][All Lists]
Advanced

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

Re: [Gnumed-devel] proposal for dbapi base class


From: Karsten Hilbert
Subject: Re: [Gnumed-devel] proposal for dbapi base class
Date: Mon, 20 Jan 2003 15:41:49 +0100
User-agent: Mutt/1.3.22.1i

>> What I mean is that this suggests that the entire record is
>> fetched at every invocation (subject to caching, of course).
>> No way to specify fields, no way to specify conditions apart
>> from the primary key. But that may be intentional.
> Ah, now I understand what you mean.
> No, not a problem, since all attribute access is implemented "lazy". Lazy 
> attributes in combination with backend messenging is a good caching strategy 
> anyway.
So, given the example below, where does fetch() come in ?  A
synonym (or helper method) for fetch_from_backend() ?

> Example:
> 
>       class lazytable:
>               def __getattr__(self, key):
>                       try:
>                               return self.__dict__[key]
>                       #except:
                        except KeyError:
>                               value = fetch_from_backend(key)
>                               self.__dict__[key]= value
>                               return value
                        except:
                            _log.LogException(...)

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]