On 23.10.2007, at 23:06, Stephen Deasey wrote:
> If you have:
>
>     ns_getconfig section theint 42
>
> and somewhere else you have:
>
>     ns_getconfig section theint 13
>
> and you set it up so that on the first access, if the value does not
> exist in the global config you seed it with the default (as you must
> if you want introspection to work), then the value seeded depends on
> which code runs first.
>
> I don't think this is necessarily an error. By design it's a
> read/write config, so if the value started at 42, maybe someone reset
> it to 13?  It's the same effect.

Not exactly as the second on will ignore the
default, because the first one have set it allright.
But I agree that this may not be considered as
error. The deault is only used to seed the config
if nothing found.
As it is now. it doesn't. It simply parrots the
default back to user w/o setting it in the store.
This is how ns_config works. Not necesarily the
correct way, though.

>
> However, I think this would be an error:
>
>     ns_getconfig -bool section key yes
>     ...
>     ns_getconfig -int section key 1
>
> The two pieces of code share a config key but they have conflicting
> ideas about the type. One of them is wrong.

But we can't recover from that.

>
> The alternative is to always store the string value and do conversion
> on every access. I don't think this is the way to go: it's slow and
> it's just not logically correct.

Storing the string is not going to be very sexy because of
permanent string/type conversions.

I can live with "first default sets the value" in the
config. This is how it was yesterday and I changed it
today to be on-pair with ns_config. Not necessarily a
good idea. I will revert the code again.

Now that we "solved" that one.... do you have any
idea about persistence?



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to