Skip to content

Instantly share code, notes, and snippets.

@EntityReborn
Created May 14, 2011 00:33
Show Gist options
  • Save EntityReborn/971545 to your computer and use it in GitHub Desktop.
Save EntityReborn/971545 to your computer and use it in GitHub Desktop.
# HACK-n-PATCH! Allow dotted syntax access.
def monkeypatch1(self, name):
if self.has_key(name):
return self[name]
super(ConfigObj, self).__getattr__(name)
ConfigObj.__getattr__ = monkeypatch1
def monkeypatch2(self, name):
if self.has_key(name):
return self[name]
super(Section, self).__getattr__(name)
Section.__getattr__ = monkeypatch2
# END HACK-n-PATCH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment