[PATCH 1/5] Re: Remove ui.detector class

Nicolas Sebrecht nicolas.s-dev at laposte.net
Wed Jan 5 18:10:22 GMT 2011


On Wed, Jan 05, 2011 at 05:00:54PM +0100, Sebastian Spaeth wrote:

> diff --git a/offlineimap/init.py b/offlineimap/init.py
> index 4a7c67a..4f8490b 100644
> --- a/offlineimap/init.py
> +++ b/offlineimap/init.py

<...>

> @@ -187,10 +186,19 @@ class OfflineImap:
>                      section = "general"
>                  config.set(section, key, value)
>  
> -        #init the ui, and set up additional log files
> -        ui = offlineimap.ui.detector.findUI(config, options.interface)
> +        #init the ui, cmd line option overrides config file
> +        ui_type = config.getdefault('general','ui', 'TTY.TTYUI')
> +        if options.interface != None:
> +            ui_type = options.interface
> +        try:
> +            ui = offlineimap.ui.UI_LIST[ui_type](config)
> +        except KeyError:
> +            logging.error("UI '%s' does not exist, choose one of: %s" % \
> +                              (ui_type,', '.join(offlineimap.ui.UI_LIST.keys())))
> +            sys.exit(1)

I think we should have relevant exit codes. It is really useful to get
uniq values to know what happened in scripts. It may not be very smart
to give a dedicated value to this error but it would be nice to keep it
in mind for further changes.

> diff --git a/offlineimap/ui/__init__.py b/offlineimap/ui/__init__.py
> index 0206ab4..83d81c6 100644
> --- a/offlineimap/ui/__init__.py
> +++ b/offlineimap/ui/__init__.py
> @@ -1,6 +1,5 @@
> -# UI module directory
> -# Copyright (C) 2002 John Goerzen
> -# <jgoerzen at complete.org>
> +# UI module
> +# Copyright (C) 2010 Sebastian Spaeth <Sebastian at SSpaeth.de>

This isn't fair to remove previous Copyright statements, so I can't
merge this patch as is.

That said, I don't think it worth to keep this information in per file
basis which will grow indefinitely.  FMHO, it would be better to simply
remove the Copyright marks from all these files and maintain one file at
the root of the project dedicated for this purpose.

We need the approval from John, added in cc.

-- 
Nicolas Sebrecht




More information about the OfflineIMAP-project mailing list