[melbourne-pug] config files? pfft!

Rory Hart hartror at gmail.com
Thu Feb 28 23:33:03 CET 2013


1. Syntax errors are just like any exception, they can be caught, handled
and reported to the user.
2. Yes but they can do that in other ways just as easily.
3. Yes, for example in one of my projects I load a settings file/module and
do a getattr on it which allows easily defined defaults no imports
required*. Similar things apply to the rest of #3

* not 100% true we need absolute paths in that project and I decided
explicitly using os.path etc in settings was better than hiding the pathing
magic elsewhere.

On 1 March 2013 00:39, Jonathan Morgan <jonmmorgan at gmail.com> wrote:

> Hi Sam,
>
> Interesting point (and probably good for internal config).  Just a few
> questions (from what I use config files for - user accessible
> configuration):
> 1. How do you deal with syntax errors when the user modifies this file?
> (yes, you have to deal with file format errors with flat files, but at
> least it is not a syntax error at load time).
>
> 2. Can a user inject undesirable code into the system and break my code /
> security / something?
>
> 3. Can you have a system with defaults and only set config that isn't the
> default value? (I think Django has this with local settings where you will
> do a "from settings import *" - but is this easily maintainable?  Will it
> always get the order right?  Will you be able to change e.g. just one entry
> in a dictionary property?)
>
> These reasons would all drive me towards using a "standard" config file,
> but I would be interested to hear if anyone has better options for them.
>
> Thanks,
> Jon
>
>
> On Thu, Feb 28, 2013 at 6:09 PM, Sam Watkins <sam at nipl.net> wrote:
>
>> config files?  pfft!
>>
>> In python, one may put a program's settings in a separate python file,
>> and simply import it (or from it import *).
>>
>> And if you just use numbers and quoted strings,
>> those files can be used for shell config and perhaps make config.
>>
>> Killer Feature.  Works nice with python's excellent syntax and module
>> system :)
>>
>> A bit of a boring post, but hey...
>>
>> Sam
>> _______________________________________________
>> melbourne-pug mailing list
>> melbourne-pug at python.org
>> http://mail.python.org/mailman/listinfo/melbourne-pug
>>
>
>
> _______________________________________________
> melbourne-pug mailing list
> melbourne-pug at python.org
> http://mail.python.org/mailman/listinfo/melbourne-pug
>
>


-- 
Rory Hart
http://www.roryhart.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/melbourne-pug/attachments/20130301/9e11f545/attachment.html>


More information about the melbourne-pug mailing list