Revision: 23260
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 2, 2010 15:50 by manatlan
Initial Code
from xdg import BaseDirectory import os import ConfigParser class Config(object): def __init__(self): self._dir=os.path.join(BaseDirectory.xdg_config_home,"freetp") if not os.path.isdir(self._dir): os.mkdir(self._dir) self._file=os.path.join(self._dir,"freetp.conf") self._cfg = ConfigParser.RawConfigParser() if not os.path.isfile(self._file): self._cfg.add_section('Config') self._setMail("") else: self._cfg.read(self._file) def _getMail(self): return self._cfg.get('Config', 'mail') def _setMail(self,v): self._cfg.set('Config', 'mail',v) self._save() mail=property(_getMail,_setMail) def _save(self): fid=open(self._file, 'wb') if fid: self._cfg.write(fid) fid.close()
Initial URL
Initial Description
Initial Title
python, simplest ini/config container (with folder in xdg_config_home)
Initial Tags
python
Initial Language
Python