Skip to content

Instantly share code, notes, and snippets.

@mtomwing
Created September 2, 2013 06:42
Show Gist options
  • Save mtomwing/6409837 to your computer and use it in GitHub Desktop.
Save mtomwing/6409837 to your computer and use it in GitHub Desktop.
from freeseer.framework.config.options import StringOption, IntegerOption
from freeseer.framework.config.persist import ParserConfig
class FreeseerConfig(ParserConfig):
name = StringOption('Michael Tom-Wing')
age = IntegerOption(0)
if __name__ == '__main__':
config = FreeseerConfig('/tmp/freeseer.conf', 'Global')
config.load_if_possible()
print 'Name:', config.name, type(config.name)
print 'Age:', config.age, type(config.age)
config.age += 20
print 'Name:', config.name, type(config.name)
print 'Age:', config.age, type(config.age)
config.save()
@mtomwing
Copy link
Author

mtomwing commented Sep 2, 2013

The file it generated:

thinkpad[~] cat /tmp/freeseer.conf 
[Global]
age = 100
name = Michael Tom-Wing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment