[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#499930: [Patch] make offlineimap tollerant of man's capitalization

I too fell into the trap of copying the man-page's headline. This
is especially confusing, since the setting I was using (TTY.TTYUI)
is-all caps (so I figured they all were supposed to be all-caps).

Since it is not possible/reasonable to fix the man page, please
make offlineimap accept all-caps arguments for the ui setting.

Attached is a patch to do just that.

I hope you will include it in future releases.

Thank you,     - Jason
diff --git a/offlineimap/ui/detector.py b/offlineimap/ui/detector.py
index 4ec7503..99db613 100644
--- a/offlineimap/ui/detector.py
+++ b/offlineimap/ui/detector.py
@@ -25,6 +25,9 @@ DEFAULT_UI_LIST = ('Curses.Blinkenlights', 'TTY.TTYUI',
 def findUI(config, chosenUI=None):
     uistrlist = list(DEFAULT_UI_LIST)
+    uistrfixcase = {}
+    for correct in uistrlist:
+        uistrfixcase[correct.lower()] = correct;
     for ui in dir(offlineimap.ui):
         if ui.startswith('_') or ui in ('detector', 'UIBase'):
@@ -37,6 +40,8 @@ def findUI(config, chosenUI=None):
         uistrlist = config.get("general", "ui").replace(" ", "").split(",")
     for uistr in uistrlist:
+        if uistrfixcase.has_key(uistr.lower()):
+            uistr = uistrfixcase[uistr.lower()]
         uimod = getUImod(uistr, config.getlocaleval(), namespace)
         if uimod:
             uiinstance = uimod(config)

Reply to: