Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

config.py:

  backup = [{
        'name': '/media/programming',
        'exclude': ['log_files', 'temp_files'],
    }, {
        'name': '/media/documents',
        'exclude': ['archive'],
    }]
of the top of my head.

*editted for formatting



  jeff:disqus devin$ wc settings.py settings.xml
       1      15     142 settings.py
      16      19     461 settings.xml
      17      34     603 total
30% of the words. and, in my opinion, just as readable if not more.


Or with a little less clutter :-)

  <backup>
    <dir name="/media/programming" exclude="log_files temp_files" />
    <dir name="/media/documents" exclude="archive" />
  </backup>


i'd probably define some helper functions to check argument values and such:

  config = backup(
    directory('/media/programming', exclude=['log_files', 'temp_files']),
    directory('/media/documents', exclude='archive')
  )


Yeah, I've done that as well.

Are there any security considerations to think about if using that approach?


well. it's mutable. your code can change it. don't do it (often). then you're just programming with lots of global state.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: