summaryrefslogtreecommitdiff
path: root/alot/settings
Commit message (Collapse)AuthorAge
* Merge branch 'master' into py3kDylan Baker2018-05-15
|\
| * better message on hook loading failureMatthieu Coudron2018-05-14
| | | | | | | | | | | | | | | | | | The typical current message looks like: unable to load hooks file:/home/teto/.config/alot/hooks.py without telling why python couldn't load the hook. This commit prints the exception, thus helping users to solve the issue (in my case encoding + wrong imports).
* | settings/manager: fix managerDylan Baker2018-03-01
| |
* | fix rebasing errorsDylan Baker2018-03-01
| |
* | py3k: use a concrete list when modifying dict.Dylan Baker2018-03-01
| |
* | py3k: dict.keys() doesn't return a list anymoreDylan Baker2018-03-01
|/
* Remove blank lines and fix docstrings.Julian Mehne2018-01-24
|
* Put expand_environment_and_home inside _expand_config_values.Julian Mehne2018-01-23
|
* Expand environment variables when reading the config file.Julian Mehne2018-01-23
|
* Rename get_env to get_xdg_env and clarify docstring.Julian Mehne2018-01-23
|
* Store settings in alot.rc.spec.Julian Mehne2018-01-21
| | | | | - allows users to use $XDG_CONFIG_HOME, as well - stores information in single places.
* Improve logging messages.Julian Mehne2018-01-21
|
* Fix empty XDG_* environment variables.Julian Mehne2018-01-21
| | | | | | | | | | | | Use fallback, if an enviroment variable is unset *or* empty. Bug: - XDG_CONFIG_HOME='' alot Problem: Does not find the configuration file (among others), because os.environ.get('XDG_CONFIG_HOME', '~/.config') returns '', instead of '~/.config'.
* De-duplicate code with helper function.Julian Mehne2018-01-21
|
* Move processing of setting to the right place.Julian Mehne2018-01-21
|
* Log unknown settings in configuration and theme files.Julian Mehne2018-01-08
|
* Clean up theme finder logic.Julian Mehne2018-01-07
| | | | | | | | | | - Replace directory check with file check - we only check for a single file, no need to check for existende of the directory separately. Also, this way we can distinguish between file validation error and file not found. - Be consistent: we stop iterating, if we find a file and it can be parsed. If we can't parse it, stop iterating as well, don't keep looking for the file.
* Give more context if reading of config file fails.Julian Mehne2017-12-06
|
* Allow regex special characters in tagstrings.Julian Mehne2017-12-02
| | | | | | | | | | | | | | | Fixes the following crashes: 1. tag completion with regex special chars :search tag:[<tab> 2. Changing tag representation of an (existing) tag with regex special chars: [tags] [[my**tag]] normal = '','', 'white','light red', 'white','#d66' 3. Contact completion with regex special chars and no external command: To:**foo<tab>
* Merge branch 'master' into fix/spellingPatrick Totzke2017-09-02
|\
| * pep8 fixesPatrick Totzke2017-09-01
| | | | | | | | | | This mostly shortens lines down to <=79 chars and fixes some other small things I found using the pep8 tool.
* | Fix some spelling mistakesLucas Hoffmann2017-09-02
|/
* Replace Exception.message with str(Exception)Dylan Baker2017-08-19
| | | | | | In python3 Exception doesn't have a message attribute, the only way to get the string output is to call str() on the Exception. This also works in python 2.7, so go ahead and make that change.
* Merge pull request #1095 from dcbaker/submit/use-default-theme-if-no-configDylan Baker2017-08-17
|\ | | | | Load default settings even if a user config doesn't exist
| * settings: Load spec file even if config file is undefined.Dylan Baker2017-08-16
| | | | | | | | | | | | | | | | | | | | This is necessary even if the config file is None to ensure that the spec file is loaded Also mock out the setting.const module in the docs, otherwise they'll fail to generate. Fixes #1094
| * settings/manager: remove duplicate _config from constructorDylan Baker2017-08-16
| | | | | | | | | | SettingsManager sets it's _config attribute to the exact same value twice in the constructor. This is wrong.
* | ignore realname part in get_account_by_addressPatrick Totzke2017-08-15
|/ | | | | This allows to simply pass the content of a messages' From-header value when determining an account to send/save/encrypt from.
* settings: do not store SettingsManager instance in __init__.pyDylan Baker2017-08-03
| | | | | | | This can create circular imports in unittests, which causes difficult to debug errors. Fixes #1076
* Merge pull request #1089 from dcbaker/submit/sign-without-hintDylan Baker2017-07-27
|\ | | | | commands/envelope: Fall back to account for signing key
| * settings/manager: Extend the get_account_by_address with return_defaultDylan Baker2017-07-27
| | | | | | | | | | | | This new return_default flag (which is an optional and default to False) will try to return the default account if it cannot find an account matching the address hint.
* | settings: Allow loading themes from system locationsDylan Baker2017-07-19
|/ | | | | | | | | | | | | This adds additional system locations to search for theme files, which are either defined as the environment variable XDG_DATA_DIRS, or the generic fallback (per the xdg base directories spec) as /usr/local/share and /usr/share. We then add alot/themees to those paths to search for themes in. This allows a package manager to install the theme files system wide along with alot, and for alot to load them from the system wide directories. The Archlinux alot-git package is already installing the packages like this.
* settings: Add a reload methodDylan Baker2017-07-10
| | | | | | | | | | | This patch does a bit of refactoring to the Settings class for it's setup, and adds a reload method. The refactoring encapsulates the handling of NoneType for the read_*config methods, and reworks the constructor just a bit so that it doesn't rely on calling methods to create instance variables. The end result is slightly cleaner, and will be useful for adding a reload command to alot itself.
* Extend docs for settings.utils.read_configLucas Hoffmann2017-06-06
| | | | | The argument is handed to ConfigObj directly and allowing lines of text to be passed here makes future tests much easier.
* Merge pull request #1000 from dcbaker/pr/argument-validatorLucas Hoffmann2017-01-27
|\ | | | | argparse validators
| * move alot/settings/checks to alot/utils/configobjDylan Baker2017-01-25
| | | | | | | | This is just more reorganization.
* | settings/manager: Use getattrDylan Baker2017-01-26
|/
* Use absolute_imports from __future__Lucas Hoffmann2017-01-18
|
* Merge pull request #975 from lucc/tests/doctestsPatrick Totzke2017-01-18
|\ | | | | Porting old doctests to unittest
| * Port old doctests to unittest: alot.settings.checksLucas Hoffmann2017-01-18
| |
* | settings/manager: fix typo in docstringDylan Baker2017-01-17
|/
* fix odd continuation and indentationDylan Baker2016-12-27
| | | | This is just whitespace changes.
* settings/manager: remove list comprehension for clarityDylan Baker2016-12-21
| | | | | | | The use of a list comprehension here saves one line of code, but doesn't make the code clearer, a simple loop is more obvious. This also replaces ``if not v or v == ''`` with simply ``if not v``, since they're equivalent.
* Replace map() and filter() with comprehensionsDylan Baker2016-12-21
| | | | | | | | This had the advantage of being more readable to people without a functional programming background, and it avoids the need to use lambdas which are both slow and have many corners in python. In a few cases it also allows us to use a generator expression instead of a materialized list, which save some memory.
* Use raw strings with backslashesDylan Baker2016-12-21
| | | | This just adds the `r` prefix to a few strings.
* Turn methods with no `self` usage into staticmethodsLucas Hoffmann2016-12-18
|
* fix interpolation in config files #902.Patrick Totzke2016-12-16
| | | | | | | | | Configobj's string interpolation feature does not work as expected in account sections of alot configuration files. The reason is that interpolation is done in ConfigObj.__getitem__ which alot does not use directly for account sections. This patch causes all values to be read via ConfigObj.__getitem__ explicitly.
* Replace mutable keyword argumentsDylan Baker2016-12-13
| | | | | | | | | | | | | | | | | | | | | | | There are a number of cases of mutable keyword arguments (list and dict in this case). Mutable keyword arguments are rather dangerous, since any mutation of the default value is persistent, which will inevitably lead to bugs. For example, imagine this code: def func(def=[]): def.append('foo') return def >>> func() ['foo'] >>> func() ['foo', 'foo'] This is almost certainly not what was intended. This code generally uses the idiom of setting the default value to None, and then assigning with or `value = value or []` which will replace value with the empty list (or dict) when value is falsey, like None or another empty list.
* settings/manager.py: Compare addresses using == instead of inDylan Baker2016-12-13
| | | | | | | I don't think this was correct from the start, since "foo@bar.com" would match "bfoo@bar.com", even if there was a "bfoo@bar.com" in the accountmap, depending on the order that they happened to be sorted in accountmap.
* Further minor style fixesLucas Hoffmann2016-12-09
|
* Fix except syntaxLucas Hoffmann2016-12-09
|