lib/diffs: mark trailing tabs similar to trailing spaces
So far, spaces have not been marked up, but trailing spaces are followed by '<i></i>' (newline symbol). Tabs have been marked up as '<u>\t</u>' (underlined with icon), but trailing tabs didn't get the same "trailing whitespace" markup as trailing spaces got.
Fix this unfairness by handling trailing tabs explicitly as '<u>\t</u><i></i>' so they get both kinds of markup.
notifications: explicitly add author of pull request in invitation mail
When an author of a pull request does not get feedback from any of the reviewers, he is left wondering whether they got the invitation mail at all. By explicitly sending the invitation also to the author, he can at least know if e-mail works at the server side and how reviewers see it. The mail can also be forwarded as a 'reminder'.
logging: try to avoid using ANSI color codes when not logging to a terminal
Color on the console is nice, but it is annoying to get these codes when for example redirecting to a file.
The formatter doesn't know exactly where the message will be used - it is fully configurable. In the default configuration, the messages are passed to a StreamHandler to sys.stderr .
As an approximate optmization, hardcode the color formatters to only emit color formatting if logging to something that isatty.
permissions: drop hg.create.write_on_repogroup "Repository creation with group write access" setting
Simplify permissions system and get rid of some confusing tech debt.
Before, the global 'write_on_repogroup' setting controlled what write permission on a repo group meant.
With this change, users can create repositories in a repo group if and only if they have write access. Write access to a repo group will now mean the permission to create repositories in it.
Write access to repo groups must be granted explicitly. There should not be any other reason to grant write access than to allow users to create repos. There is thus no upgrade concerns for this change.
An admin that doesn't want users to create repos in a repogroup should just not give them write access.
These global settings might still exist in the database, but is ignored and no longer used and do no harm.
inifile: make it possible for expand() to comment out settings without assigning new value
For completeness, when we already can create and update values, also make it possible to delete. This fits nicely into the implementation. Potentiallly "nice to have" but not used yet.
The ini file is a text file and it only really makes sense to set string values. Intuitively, it makes sense that setting something to None means that the old value should be commented out but no new value should be set. If we want to set a value of "None", then specify "None" - not None.
lib: drop own asbool implementation and consistently use tg.support.converters as utils2.asbool
str2bool never reported error on odd input such as '' or '-1', but the tg asbool behaviour of raising ValueError("String is not true/false: %r" % obj) in that case seems fine.
setup: exclude celery 4.4.4 which is broken due to unexpressed dependency
Celery 4.4.4 introduced the use of the 'future' package but forgot to express it in its dependencies.
We could add the missing dependency on 'future' in Kallithea, but since the problem is already fixed upstream shortly after 4.4.4 was released [1], we can be sure that the next release (presumably 4.4.5) will contain the fix.
The kallithea-config sources were removed in commit 213085032127e941a3bd93d0e510828a9d87bf32 but an entry point was still created by setup.py. Moreover, the ini file still referenced this, instead of kallithea-cli (config-create).
tests: actually test something useful in test_edit for gists (Issue #376)
Even though there was a test for editing gists, it did not catch the basic loading problem reported in issue #376. In fact, the test just loaded the edit page, but since no user was actually logged in, it just loaded the login screen. As a result, no real gist editing code was tested at all.
Instead, explicitly check the redirection to a login screen, then proceed with logging in and check that the edit page can be loaded.
Additionally, don't rely on the magic gist id '1' but create an actual gist first.
docs: clarify the installation steps and how things fit together
Hint that create-db user information is for creating the initial local user and that the database connection (which also might use some kind of user) is something else.
feeds: fix failure getting feed for Git repos (Issue #372)
GitChangeset.diff() did return ''.join(self.repository.get_diff(...)) even though get_diff returned a string. It worked, but was unnecessary and inefficient.
That fails in py3: get_diff returns bytes ... and iterating doesn't give characters but integers and we would get: TypeError: sequence item 0: expected a bytes-like object, int found
Fixed by dropping the unnecessary iteration and joining.
issue: log error if still using issue_pat_XXX configuration after it was removed in d24051ce961c
Show a helpful: found unsupported issue_prefix_pr = 'PR' - use issue_sub_pr instead before bailing out with: skipping incomplete issue pattern 'issue_pat_pr': '(?:PR\\s*)(\\d+)' -> 'https://kallithea-scm.org/repos/kallithea/pull-request/{id}' None
scripts/i18n: update i18n howto with recipe for use of scripts/i18n tooling
For now, just adding a new section. It should be integrated with the existing documentation. Some steps can perhaps be simplified or automated so we need less words.
uwsgi: slim down and tweak the default '[uwsgi]' configuration section
The goal is to have a basic working setup that show how and why to use uWSGI. System administrators should check uWSGI documentation for further information and general advice about operations.
uwsgi: drop unnecessary dependency of http module - just use http-socket directly
The http plugin has more advanced http functionality like https and load balancing, duplicating what in many setups is handled by separate front-end servers. In this simple template, just use the basic http-socket.
i18n: fix dead code in Accept-Language workaround from 7c7d6b5c07c7
AppConfig is just providing defaults, and the .ini file has not been read yet. There is thus no point in checking if i18n.lang has been set, and the code would thus *always* set i18n.lang=en ... but that was fine, as it just is a default.
email templates: fix missing translation of titles and buttons
The buttons and titles of email templates were not correctly translated. The corresponding strings were not part of the i18n files because they were not recognized by the extraction logic.