1. John Mulligan
  2. vanity

Commits

John Mulligan  committed 5fe3e45

clean up version fallback stuff from configreader

also remove junk (testing) main section

  • Participants
  • Parent commits 1233336
  • Branches default

Comments (0)

Files changed (1)

File vanity/configreader.py

View file
  • Ignore whitespace
         raise ParsingError('invalid configuration line', lnum)
 
 
-def _lstrip(txt):
-    if hasattr(txt, 'lstrip'):
+if hasattr(str, 'lstrip'):
+    def _lstrip(txt):
         return txt.lstrip()
-    while (txt[0] in ' \t'):
-        txt = txt[1:]
-    return txt
+else:
+    def _lstrip(txt):
+        while (txt[0] in ' \t'):
+            txt = txt[1:]
+        return txt
 
 
 def _combine(nodes):
             if key is not None:
                 yield (section, key, self._get(section, key))
 
-        
-
-if __name__ == '__main__':
-    #fh = open('sample.cfg')
-    #print list(parseini(fh))
-    cf = ConfigReader()
-    cf.read('sample.cfg')
-    print list(cf.sections())
-    print dict(cf.items('tag'))
-
 
 # eof
-