On Tue, Feb 24, 2009 at 11:12 AM, Christoph Zwerschke <[email protected]> wrote: > > Another thing that I find really, really ugly in the current config > system is that if you set something to 'false' in a *.ini file, its > value will be 'false' (as a string), which will be interpreted as true > in a normal Python condition. So you're required to use a helper > function such as 'asbool' from paste.deploy to evaluate such settings, > and to change your code if you move the setting from *.cfg.py to *.ini. > now that is a "bug" , lets document it somewhere, at least a trac ticket will do.
> I'm not sure that everybody is aware of this problem and that asbool() > is used in the TG2 code in all cases where it is necessary. > I believe this is an anti-feature of paste's ini stuff. Since the ini is supposed to be 'human' written it accepts yes,no,true,false,y,n,0,1, (don't remember what else) which is why you need asbool() Now keep in mind that the INI format has no notion of boolean types, and the only reason TG1 did this is because CP's ini stuff had this extra feature. > Any ideas how we can improve this? If we can't, this should at least be > properly documented with a big caution sign. Also, asbool() should then > be available as a standard template variable - you may want to check > config flags in py:if directives inside Genshi templates. -1 we should either a- add some kind of layer to automatically transform ini values into their guesses types or b- provide docs on how to call asbool > > -- Christoph > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en -~----------~----~----~----~------~----~------~--~---
