[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnumed-devel] Gnumed status
From: |
Hilmar Berger |
Subject: |
Re: [Gnumed-devel] Gnumed status |
Date: |
Mon, 24 Mar 2003 21:48:25 +0100 (CET) |
On Sun, 23 Mar 2003, Karsten Hilbert wrote:
> > I have not checked in the changes yet. The problems are related to setting
> > parameters with {user,machine,cookie}=None and the different handling of
> > None in set and get (cfgDB).
> Ah. I see. That's one area where more thought needs to be put
> into. I TRIED to make the behaviour least surprising (which
> isn't the same as "consistent across set/get") but that's just
> me. Good to see that reviewed by others.
Problem was that set() calls get() to find out if the entry is already
there. If machine or cookie were passed as None to set(), set() will pass
those to get() which will try to find an entry for None (parameter
defaults don't work if None is actually passed !). That way a
set(...,(default machine=None),...) will always result in a newly created
entry. I just inserted those lines:
# standard modules
@@ -106,16 +108,9 @@
return None
where_option = "cfg_template.name like '%s'" % option
- # fallback for machine - we need this for set(), which might
call
- # with machine = None. We must fix this either here or in set()
- if machine is None:
- machine = '__default__'
# if no machine given: any machine
where_machine = " and cfg_item.machine like '%s'" % machine
- # fallback for cookie
- if cookie is None:
- cookie = '__default__'
# if no cookie given: standard cookie
where_cookie = " and cfg_item.cookie like '%s'" % cookie
but maybe you have a better idea.
Hilmar