##// END OF EJS Templates
docs: fix broken references
Andrew Shadura -
r6705:84d8cff4 default
parent child Browse files
Show More
@@ -1,314 +1,314 b''
1 .. _contributing:
1 .. _contributing:
2
2
3 =========================
3 =========================
4 Contributing to Kallithea
4 Contributing to Kallithea
5 =========================
5 =========================
6
6
7 Kallithea is developed and maintained by its users. Please join us and scratch
7 Kallithea is developed and maintained by its users. Please join us and scratch
8 your own itch.
8 your own itch.
9
9
10
10
11 Infrastructure
11 Infrastructure
12 --------------
12 --------------
13
13
14 The main repository is hosted on Our Own Kallithea (aka OOK) at
14 The main repository is hosted on Our Own Kallithea (aka OOK) at
15 https://kallithea-scm.org/repos/kallithea/, our self-hosted instance
15 https://kallithea-scm.org/repos/kallithea/, our self-hosted instance
16 of Kallithea.
16 of Kallithea.
17
17
18 For now, we use Bitbucket_ for `pull requests`_ and `issue tracking`_. The
18 For now, we use Bitbucket_ for `pull requests`_ and `issue tracking`_. The
19 issue tracker is for tracking bugs, not for support, discussion, or ideas --
19 issue tracker is for tracking bugs, not for support, discussion, or ideas --
20 please use the `mailing list`_ or :ref:`IRC <readme>` to reach the community.
20 please use the `mailing list`_ or :ref:`IRC <readme>` to reach the community.
21
21
22 We use Weblate_ to translate the user interface messages into languages other
22 We use Weblate_ to translate the user interface messages into languages other
23 than English. Join our project on `Hosted Weblate`_ to help us.
23 than English. Join our project on `Hosted Weblate`_ to help us.
24 To register, you can use your Bitbucket or GitHub account. See :ref:`translations`
24 To register, you can use your Bitbucket or GitHub account. See :ref:`translations`
25 for more details.
25 for more details.
26
26
27
27
28 Getting started
28 Getting started
29 ---------------
29 ---------------
30
30
31 To get started with Kallithea development::
31 To get started with Kallithea development::
32
32
33 hg clone https://kallithea-scm.org/repos/kallithea
33 hg clone https://kallithea-scm.org/repos/kallithea
34 cd kallithea
34 cd kallithea
35 virtualenv ../kallithea-venv
35 virtualenv ../kallithea-venv
36 source ../kallithea-venv/bin/activate
36 source ../kallithea-venv/bin/activate
37 pip install --upgrade pip setuptools
37 pip install --upgrade pip setuptools
38 pip install --upgrade -e .
38 pip install --upgrade -e .
39 pip install --upgrade -r dev_requirements.txt
39 pip install --upgrade -r dev_requirements.txt
40 gearbox make-config my.ini
40 gearbox make-config my.ini
41 gearbox setup-db -c my.ini --user=user --email=user@example.com --password=password --repos=/tmp
41 gearbox setup-db -c my.ini --user=user --email=user@example.com --password=password --repos=/tmp
42 gearbox serve -c my.ini --reload &
42 gearbox serve -c my.ini --reload &
43 firefox http://127.0.0.1:5000/
43 firefox http://127.0.0.1:5000/
44
44
45 If you plan to use Bitbucket_ for sending contributions, you can also fork
45 If you plan to use Bitbucket_ for sending contributions, you can also fork
46 Kallithea on Bitbucket_ first (https://bitbucket.org/conservancy/kallithea) and
46 Kallithea on Bitbucket_ first (https://bitbucket.org/conservancy/kallithea) and
47 then replace the clone step above by a clone of your fork. In this case, please
47 then replace the clone step above by a clone of your fork. In this case, please
48 see :ref:`contributing-guidelies` below for configuring your fork correctly.
48 see :ref:`contributing-guidelines` below for configuring your fork correctly.
49
49
50
50
51 Contribution flow
51 Contribution flow
52 -----------------
52 -----------------
53
53
54 Starting from an existing Kallithea clone, make sure it is up to date with the
54 Starting from an existing Kallithea clone, make sure it is up to date with the
55 latest upstream changes::
55 latest upstream changes::
56
56
57 hg pull
57 hg pull
58 hg update
58 hg update
59
59
60 Review the :ref:`contributing-guidelines` and :ref:`coding-guidelines`.
60 Review the :ref:`contributing-guidelines` and :ref:`coding-guidelines`.
61
61
62 If you are new to Mercurial, refer to Mercurial `Quick Start`_ and `Beginners
62 If you are new to Mercurial, refer to Mercurial `Quick Start`_ and `Beginners
63 Guide`_ on the Mercurial wiki.
63 Guide`_ on the Mercurial wiki.
64
64
65 Now, make some changes and test them (see :ref:`contributing-tests`). Don't
65 Now, make some changes and test them (see :ref:`contributing-tests`). Don't
66 forget to add new tests to cover new functionality or bug fixes.
66 forget to add new tests to cover new functionality or bug fixes.
67
67
68 For documentation changes, run ``make html`` from the ``docs`` directory to
68 For documentation changes, run ``make html`` from the ``docs`` directory to
69 generate the HTML result, then review them in your browser.
69 generate the HTML result, then review them in your browser.
70
70
71 Before submitting any changes, run the cleanup script::
71 Before submitting any changes, run the cleanup script::
72
72
73 ./scripts/run-all-cleanup
73 ./scripts/run-all-cleanup
74
74
75 When you are completely ready, you can send your changes to the community for
75 When you are completely ready, you can send your changes to the community for
76 review and inclusion. Most commonly used methods are sending patches to the
76 review and inclusion. Most commonly used methods are sending patches to the
77 mailing list (via ``hg email``) or by creating a pull request on Bitbucket_.
77 mailing list (via ``hg email``) or by creating a pull request on Bitbucket_.
78
78
79 .. _contributing-tests:
79 .. _contributing-tests:
80
80
81
81
82 Running tests
82 Running tests
83 -------------
83 -------------
84
84
85 After finishing your changes make sure all tests pass cleanly. Run the testsuite
85 After finishing your changes make sure all tests pass cleanly. Run the testsuite
86 by invoking ``py.test`` from the project root::
86 by invoking ``py.test`` from the project root::
87
87
88 py.test
88 py.test
89
89
90 Note that testing on Python 2.6 also requires ``unittest2``.
90 Note that testing on Python 2.6 also requires ``unittest2``.
91
91
92 Note that on unix systems, the temporary directory (``/tmp`` or where
92 Note that on unix systems, the temporary directory (``/tmp`` or where
93 ``$TMPDIR`` points) must allow executable files; Git hooks must be executable,
93 ``$TMPDIR`` points) must allow executable files; Git hooks must be executable,
94 and the test suite creates repositories in the temporary directory. Linux
94 and the test suite creates repositories in the temporary directory. Linux
95 systems with /tmp mounted noexec will thus fail.
95 systems with /tmp mounted noexec will thus fail.
96
96
97 You can also use ``tox`` to run the tests with all supported Python versions
97 You can also use ``tox`` to run the tests with all supported Python versions
98 (currently Python 2.6--2.7).
98 (currently Python 2.6--2.7).
99
99
100 When running tests, Kallithea uses `kallithea/tests/test.ini` and populates the
100 When running tests, Kallithea uses `kallithea/tests/test.ini` and populates the
101 SQLite database specified there.
101 SQLite database specified there.
102
102
103 It is possible to avoid recreating the full test database on each invocation of
103 It is possible to avoid recreating the full test database on each invocation of
104 the tests, thus eliminating the initial delay. To achieve this, run the tests as::
104 the tests, thus eliminating the initial delay. To achieve this, run the tests as::
105
105
106 gearbox serve -c kallithea/tests/test.ini --pid-file=test.pid --daemon
106 gearbox serve -c kallithea/tests/test.ini --pid-file=test.pid --daemon
107 KALLITHEA_WHOOSH_TEST_DISABLE=1 KALLITHEA_NO_TMP_PATH=1 py.test
107 KALLITHEA_WHOOSH_TEST_DISABLE=1 KALLITHEA_NO_TMP_PATH=1 py.test
108 kill -9 $(cat test.pid)
108 kill -9 $(cat test.pid)
109
109
110 In these commands, the following variables are used::
110 In these commands, the following variables are used::
111
111
112 KALLITHEA_WHOOSH_TEST_DISABLE=1 - skip whoosh index building and tests
112 KALLITHEA_WHOOSH_TEST_DISABLE=1 - skip whoosh index building and tests
113 KALLITHEA_NO_TMP_PATH=1 - disable new temp path for tests, used mostly for testing_vcs_operations
113 KALLITHEA_NO_TMP_PATH=1 - disable new temp path for tests, used mostly for testing_vcs_operations
114
114
115 You can run individual tests by specifying their path as argument to py.test.
115 You can run individual tests by specifying their path as argument to py.test.
116 py.test also has many more options, see `py.test -h`. Some useful options
116 py.test also has many more options, see `py.test -h`. Some useful options
117 are::
117 are::
118
118
119 -k EXPRESSION only run tests which match the given substring
119 -k EXPRESSION only run tests which match the given substring
120 expression. An expression is a python evaluable
120 expression. An expression is a python evaluable
121 expression where all names are substring-matched
121 expression where all names are substring-matched
122 against test names and their parent classes. Example:
122 against test names and their parent classes. Example:
123 -x, --exitfirst exit instantly on first error or failed test.
123 -x, --exitfirst exit instantly on first error or failed test.
124 --lf rerun only the tests that failed at the last run (or
124 --lf rerun only the tests that failed at the last run (or
125 all if none failed)
125 all if none failed)
126 --ff run all tests but run the last failures first. This
126 --ff run all tests but run the last failures first. This
127 may re-order tests and thus lead to repeated fixture
127 may re-order tests and thus lead to repeated fixture
128 setup/teardown
128 setup/teardown
129 --pdb start the interactive Python debugger on errors.
129 --pdb start the interactive Python debugger on errors.
130 -s, --capture=no don't capture stdout (any stdout output will be
130 -s, --capture=no don't capture stdout (any stdout output will be
131 printed immediately)
131 printed immediately)
132
132
133 Performance tests
133 Performance tests
134 ^^^^^^^^^^^^^^^^^
134 ^^^^^^^^^^^^^^^^^
135
135
136 A number of performance tests are present in the test suite, but they are
136 A number of performance tests are present in the test suite, but they are
137 not run in a standard test run. These tests are useful to
137 not run in a standard test run. These tests are useful to
138 evaluate the impact of certain code changes with respect to performance.
138 evaluate the impact of certain code changes with respect to performance.
139
139
140 To run these tests::
140 To run these tests::
141
141
142 env TEST_PERFORMANCE=1 py.test kallithea/tests/performance
142 env TEST_PERFORMANCE=1 py.test kallithea/tests/performance
143
143
144 To analyze performance, you could install pytest-profiling_, which enables the
144 To analyze performance, you could install pytest-profiling_, which enables the
145 --profile and --profile-svg options to py.test.
145 --profile and --profile-svg options to py.test.
146
146
147 .. _pytest-profiling: https://github.com/manahl/pytest-plugins/tree/master/pytest-profiling
147 .. _pytest-profiling: https://github.com/manahl/pytest-plugins/tree/master/pytest-profiling
148
148
149 .. _contributing-guidelines:
149 .. _contributing-guidelines:
150
150
151
151
152 Contribution guidelines
152 Contribution guidelines
153 -----------------------
153 -----------------------
154
154
155 Kallithea is GPLv3 and we assume all contributions are made by the
155 Kallithea is GPLv3 and we assume all contributions are made by the
156 committer/contributor and under GPLv3 unless explicitly stated. We do care a
156 committer/contributor and under GPLv3 unless explicitly stated. We do care a
157 lot about preservation of copyright and license information for existing code
157 lot about preservation of copyright and license information for existing code
158 that is brought into the project.
158 that is brought into the project.
159
159
160 Contributions will be accepted in most formats -- such as pull requests on
160 Contributions will be accepted in most formats -- such as pull requests on
161 Bitbucket, something hosted on your own Kallithea instance, or patches sent by
161 Bitbucket, something hosted on your own Kallithea instance, or patches sent by
162 email to the `kallithea-general`_ mailing list.
162 email to the `kallithea-general`_ mailing list.
163
163
164 When contributing via Bitbucket, please make your fork of
164 When contributing via Bitbucket, please make your fork of
165 https://bitbucket.org/conservancy/kallithea/ `non-publishing`_ -- it is one of
165 https://bitbucket.org/conservancy/kallithea/ `non-publishing`_ -- it is one of
166 the settings on "Repository details" page. This ensures your commits are in
166 the settings on "Repository details" page. This ensures your commits are in
167 "draft" phase and makes it easier for you to address feedback and for project
167 "draft" phase and makes it easier for you to address feedback and for project
168 maintainers to integrate your changes.
168 maintainers to integrate your changes.
169
169
170 .. _non-publishing: https://www.mercurial-scm.org/wiki/Phases#Publishing_Repository
170 .. _non-publishing: https://www.mercurial-scm.org/wiki/Phases#Publishing_Repository
171
171
172 Make sure to test your changes both manually and with the automatic tests
172 Make sure to test your changes both manually and with the automatic tests
173 before posting.
173 before posting.
174
174
175 We care about quality and review and keeping a clean repository history. We
175 We care about quality and review and keeping a clean repository history. We
176 might give feedback that requests polishing contributions until they are
176 might give feedback that requests polishing contributions until they are
177 "perfect". We might also rebase and collapse and make minor adjustments to your
177 "perfect". We might also rebase and collapse and make minor adjustments to your
178 changes when we apply them.
178 changes when we apply them.
179
179
180 We try to make sure we have consensus on the direction the project is taking.
180 We try to make sure we have consensus on the direction the project is taking.
181 Everything non-sensitive should be discussed in public -- preferably on the
181 Everything non-sensitive should be discussed in public -- preferably on the
182 mailing list. We aim at having all non-trivial changes reviewed by at least
182 mailing list. We aim at having all non-trivial changes reviewed by at least
183 one other core developer before pushing. Obvious non-controversial changes will
183 one other core developer before pushing. Obvious non-controversial changes will
184 be handled more casually.
184 be handled more casually.
185
185
186 There is a main development branch ("default") which is generally stable so that
186 There is a main development branch ("default") which is generally stable so that
187 it can be (and is) used in production. There is also a "stable" branch that is
187 it can be (and is) used in production. There is also a "stable" branch that is
188 almost exclusively reserved for bug fixes or trivial changes. Experimental
188 almost exclusively reserved for bug fixes or trivial changes. Experimental
189 changes should live elsewhere (for example in a pull request) until they are
189 changes should live elsewhere (for example in a pull request) until they are
190 ready.
190 ready.
191
191
192 .. _coding-guidelines:
192 .. _coding-guidelines:
193
193
194
194
195 Coding guidelines
195 Coding guidelines
196 -----------------
196 -----------------
197
197
198 We don't have a formal coding/formatting standard. We are currently using a mix
198 We don't have a formal coding/formatting standard. We are currently using a mix
199 of Mercurial's (https://www.mercurial-scm.org/wiki/CodingStyle), pep8, and
199 of Mercurial's (https://www.mercurial-scm.org/wiki/CodingStyle), pep8, and
200 consistency with existing code. Run ``scripts/run-all-cleanup`` before
200 consistency with existing code. Run ``scripts/run-all-cleanup`` before
201 committing to ensure some basic code formatting consistency.
201 committing to ensure some basic code formatting consistency.
202
202
203 We support both Python 2.6.x and 2.7.x and nothing else. For now we don't care
203 We support both Python 2.6.x and 2.7.x and nothing else. For now we don't care
204 about Python 3 compatibility.
204 about Python 3 compatibility.
205
205
206 We try to support the most common modern web browsers. IE9 is still supported
206 We try to support the most common modern web browsers. IE9 is still supported
207 to the extent it is feasible, IE8 is not.
207 to the extent it is feasible, IE8 is not.
208
208
209 We primarily support Linux and OS X on the server side but Windows should also work.
209 We primarily support Linux and OS X on the server side but Windows should also work.
210
210
211 HTML templates should use 2 spaces for indentation ... but be pragmatic. We
211 HTML templates should use 2 spaces for indentation ... but be pragmatic. We
212 should use templates cleverly and avoid duplication. We should use reasonable
212 should use templates cleverly and avoid duplication. We should use reasonable
213 semantic markup with element classes and IDs that can be used for styling and testing.
213 semantic markup with element classes and IDs that can be used for styling and testing.
214 We should only use inline styles in places where it really is semantic (such as
214 We should only use inline styles in places where it really is semantic (such as
215 ``display: none``).
215 ``display: none``).
216
216
217 JavaScript must use ``;`` between/after statements. Indentation 4 spaces. Inline
217 JavaScript must use ``;`` between/after statements. Indentation 4 spaces. Inline
218 multiline functions should be indented two levels -- one for the ``()`` and one for
218 multiline functions should be indented two levels -- one for the ``()`` and one for
219 ``{}``.
219 ``{}``.
220 Variables holding jQuery objects should be named with a leading ``$``.
220 Variables holding jQuery objects should be named with a leading ``$``.
221
221
222 Commit messages should have a leading short line summarizing the changes. For
222 Commit messages should have a leading short line summarizing the changes. For
223 bug fixes, put ``(Issue #123)`` at the end of this line.
223 bug fixes, put ``(Issue #123)`` at the end of this line.
224
224
225 Use American English grammar and spelling overall. Use `English title case`_ for
225 Use American English grammar and spelling overall. Use `English title case`_ for
226 page titles, button labels, headers, and 'labels' for fields in forms.
226 page titles, button labels, headers, and 'labels' for fields in forms.
227
227
228 .. _English title case: https://en.wikipedia.org/wiki/Capitalization#Title_case
228 .. _English title case: https://en.wikipedia.org/wiki/Capitalization#Title_case
229
229
230 Template helpers (that is, everything in ``kallithea.lib.helpers``)
230 Template helpers (that is, everything in ``kallithea.lib.helpers``)
231 should only be referenced from templates. If you need to call a
231 should only be referenced from templates. If you need to call a
232 helper from the Python code, consider moving the function somewhere
232 helper from the Python code, consider moving the function somewhere
233 else (e.g. to the model).
233 else (e.g. to the model).
234
234
235 Notes on the SQLAlchemy session
235 Notes on the SQLAlchemy session
236 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
236 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
237
237
238 Each HTTP request runs inside an independent SQLAlchemy session (as well
238 Each HTTP request runs inside an independent SQLAlchemy session (as well
239 as in an independent database transaction). ``Session`` is the session manager
239 as in an independent database transaction). ``Session`` is the session manager
240 and factory. ``Session()`` will create a new session on-demand or return the
240 and factory. ``Session()`` will create a new session on-demand or return the
241 current session for the active thread. Many database operations are methods on
241 current session for the active thread. Many database operations are methods on
242 such session instances - only ``Session.remove()`` should be called directly on
242 such session instances - only ``Session.remove()`` should be called directly on
243 the manager.
243 the manager.
244
244
245 Database model objects
245 Database model objects
246 (almost) always belong to a particular SQLAlchemy session, which means
246 (almost) always belong to a particular SQLAlchemy session, which means
247 that SQLAlchemy will ensure that they're kept in sync with the database
247 that SQLAlchemy will ensure that they're kept in sync with the database
248 (but also means that they cannot be shared across requests).
248 (but also means that they cannot be shared across requests).
249
249
250 Objects can be added to the session using ``Session().add``, but this is
250 Objects can be added to the session using ``Session().add``, but this is
251 rarely needed:
251 rarely needed:
252
252
253 * When creating a database object by calling the constructor directly,
253 * When creating a database object by calling the constructor directly,
254 it must explicitly be added to the session.
254 it must explicitly be added to the session.
255
255
256 * When creating an object using a factory function (like
256 * When creating an object using a factory function (like
257 ``create_repo``), the returned object has already (by convention)
257 ``create_repo``), the returned object has already (by convention)
258 been added to the session, and should not be added again.
258 been added to the session, and should not be added again.
259
259
260 * When getting an object from the session (via ``Session().query`` or
260 * When getting an object from the session (via ``Session().query`` or
261 any of the utility functions that look up objects in the database),
261 any of the utility functions that look up objects in the database),
262 it's already part of the session, and should not be added again.
262 it's already part of the session, and should not be added again.
263 SQLAlchemy monitors attribute modifications automatically for all
263 SQLAlchemy monitors attribute modifications automatically for all
264 objects it knows about and syncs them to the database.
264 objects it knows about and syncs them to the database.
265
265
266 SQLAlchemy also flushes changes to the database automatically; manually
266 SQLAlchemy also flushes changes to the database automatically; manually
267 calling ``Session().flush`` is usually only necessary when the Python
267 calling ``Session().flush`` is usually only necessary when the Python
268 code needs the database to assign an "auto-increment" primary key ID to
268 code needs the database to assign an "auto-increment" primary key ID to
269 a freshly created model object (before flushing, the ID attribute will
269 a freshly created model object (before flushing, the ID attribute will
270 be ``None``).
270 be ``None``).
271
271
272 TurboGears2 DebugBar
272 TurboGears2 DebugBar
273 ^^^^^^^^^^^^^^^^^^^^
273 ^^^^^^^^^^^^^^^^^^^^
274
274
275 It is possible to enable the TurboGears2-provided DebugBar_, a toolbar overlayed
275 It is possible to enable the TurboGears2-provided DebugBar_, a toolbar overlayed
276 over the Kallithea web interface, allowing you to see:
276 over the Kallithea web interface, allowing you to see:
277
277
278 * timing information of the current request, including profiling information
278 * timing information of the current request, including profiling information
279 * request data, including GET data, POST data, cookies, headers and environment
279 * request data, including GET data, POST data, cookies, headers and environment
280 variables
280 variables
281 * a list of executed database queries, including timing and result values
281 * a list of executed database queries, including timing and result values
282
282
283 DebugBar is only activated when ``debug = true`` is set in the configuration
283 DebugBar is only activated when ``debug = true`` is set in the configuration
284 file. This is important, because the DebugBar toolbar will be visible for all
284 file. This is important, because the DebugBar toolbar will be visible for all
285 users, and allow them to see information they should not be allowed to see. Like
285 users, and allow them to see information they should not be allowed to see. Like
286 is anyway the case for ``debug = true``, do not use this in production!
286 is anyway the case for ``debug = true``, do not use this in production!
287
287
288 To enable DebugBar, install ``tgext.debugbar`` and ``kajiki`` (typically via
288 To enable DebugBar, install ``tgext.debugbar`` and ``kajiki`` (typically via
289 ``pip``) and restart Kallithea (in debug mode).
289 ``pip``) and restart Kallithea (in debug mode).
290
290
291
291
292 "Roadmap"
292 "Roadmap"
293 ---------
293 ---------
294
294
295 We do not have a road map but are waiting for your contributions. Refer to the
295 We do not have a road map but are waiting for your contributions. Refer to the
296 wiki_ for some ideas of places we might want to go -- contributions in these
296 wiki_ for some ideas of places we might want to go -- contributions in these
297 areas are very welcome.
297 areas are very welcome.
298
298
299
299
300 Thank you for your contribution!
300 Thank you for your contribution!
301 --------------------------------
301 --------------------------------
302
302
303
303
304 .. _Weblate: http://weblate.org/
304 .. _Weblate: http://weblate.org/
305 .. _issue tracking: https://bitbucket.org/conservancy/kallithea/issues?status=new&status=open
305 .. _issue tracking: https://bitbucket.org/conservancy/kallithea/issues?status=new&status=open
306 .. _pull requests: https://bitbucket.org/conservancy/kallithea/pull-requests
306 .. _pull requests: https://bitbucket.org/conservancy/kallithea/pull-requests
307 .. _bitbucket: http://bitbucket.org/
307 .. _bitbucket: http://bitbucket.org/
308 .. _mailing list: http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
308 .. _mailing list: http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
309 .. _kallithea-general: http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
309 .. _kallithea-general: http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
310 .. _Hosted Weblate: https://hosted.weblate.org/projects/kallithea/kallithea/
310 .. _Hosted Weblate: https://hosted.weblate.org/projects/kallithea/kallithea/
311 .. _wiki: https://bitbucket.org/conservancy/kallithea/wiki/Home
311 .. _wiki: https://bitbucket.org/conservancy/kallithea/wiki/Home
312 .. _DebugBar: https://github.com/TurboGears/tgext.debugbar
312 .. _DebugBar: https://github.com/TurboGears/tgext.debugbar
313 .. _Quick Start: https://www.mercurial-scm.org/wiki/QuickStart
313 .. _Quick Start: https://www.mercurial-scm.org/wiki/QuickStart
314 .. _Beginners Guide: https://www.mercurial-scm.org/wiki/BeginnersGuides
314 .. _Beginners Guide: https://www.mercurial-scm.org/wiki/BeginnersGuides
@@ -1,96 +1,96 b''
1 .. _email:
1 .. _email:
2
2
3 ==============
3 ==============
4 Email settings
4 Email settings
5 ==============
5 ==============
6
6
7 The Kallithea configuration file has several email related settings. When
7 The Kallithea configuration file has several email related settings. When
8 these contain correct values, Kallithea will send email in the situations
8 these contain correct values, Kallithea will send email in the situations
9 described below. If the email configuration is not correct so that emails
9 described below. If the email configuration is not correct so that emails
10 cannot be sent, all mails will show up in the log output.
10 cannot be sent, all mails will show up in the log output.
11
11
12 Before any email can be sent, an SMTP server has to be configured using the
12 Before any email can be sent, an SMTP server has to be configured using the
13 configuration file setting ``smtp_server``. If required for that server, specify
13 configuration file setting ``smtp_server``. If required for that server, specify
14 a username (``smtp_username``) and password (``smtp_password``), a non-standard
14 a username (``smtp_username``) and password (``smtp_password``), a non-standard
15 port (``smtp_port``), whether to use "SSL" when connecting (``smtp_use_ssl``)
15 port (``smtp_port``), whether to use "SSL" when connecting (``smtp_use_ssl``)
16 or use STARTTLS (``smtp_use_tls``), and/or specify special ESMTP "auth" features
16 or use STARTTLS (``smtp_use_tls``), and/or specify special ESMTP "auth" features
17 (``smtp_auth``).
17 (``smtp_auth``).
18
18
19 For example, for sending through gmail, use::
19 For example, for sending through gmail, use::
20
20
21 smtp_server = smtp.gmail.com
21 smtp_server = smtp.gmail.com
22 smtp_username = username
22 smtp_username = username
23 smtp_password = password
23 smtp_password = password
24 smtp_port = 465
24 smtp_port = 465
25 smtp_use_ssl = true
25 smtp_use_ssl = true
26
26
27
27
28 Application emails
28 Application emails
29 ------------------
29 ------------------
30
30
31 Kallithea sends an email to `users` on several occasions:
31 Kallithea sends an email to `users` on several occasions:
32
32
33 - when comments are given on one of their changesets
33 - when comments are given on one of their changesets
34 - when comments are given on changesets they are reviewer on or on which they
34 - when comments are given on changesets they are reviewer on or on which they
35 commented regardless
35 commented regardless
36 - when they are invited as reviewer in pull requests
36 - when they are invited as reviewer in pull requests
37 - when they request a password reset
37 - when they request a password reset
38
38
39 Kallithea sends an email to all `administrators` upon new account registration.
39 Kallithea sends an email to all `administrators` upon new account registration.
40 Administrators are users with the ``Admin`` flag set on the *Admin > Users*
40 Administrators are users with the ``Admin`` flag set on the *Admin > Users*
41 page.
41 page.
42
42
43 When Kallithea wants to send an email but due to an error cannot correctly
43 When Kallithea wants to send an email but due to an error cannot correctly
44 determine the intended recipients, the administrators and the addresses
44 determine the intended recipients, the administrators and the addresses
45 specified in ``email_to`` in the configuration file are used as fallback.
45 specified in ``email_to`` in the configuration file are used as fallback.
46
46
47 Recipients will see these emails originating from the sender specified in the
47 Recipients will see these emails originating from the sender specified in the
48 ``app_email_from`` setting in the configuration file. This setting can either
48 ``app_email_from`` setting in the configuration file. This setting can either
49 contain only an email address, like `kallithea-noreply@example.com`, or both
49 contain only an email address, like `kallithea-noreply@example.com`, or both
50 a name and an address in the following format: `Kallithea
50 a name and an address in the following format: `Kallithea
51 <kallithea-noreply@example.com>`. However, if the email is sent due to an
51 <kallithea-noreply@example.com>`. However, if the email is sent due to an
52 action of a particular user, for example when a comment is given or a pull
52 action of a particular user, for example when a comment is given or a pull
53 request created, the name of that user will be combined with the email address
53 request created, the name of that user will be combined with the email address
54 specified in ``app_email_from`` to form the sender (and any name part in that
54 specified in ``app_email_from`` to form the sender (and any name part in that
55 configuration setting disregarded).
55 configuration setting disregarded).
56
56
57 The subject of these emails can optionally be prefixed with the value of
57 The subject of these emails can optionally be prefixed with the value of
58 ``email_prefix`` in the configuration file.
58 ``email_prefix`` in the configuration file.
59
59
60 A Kallithea-specific header indicating the email type will be added to each
60 A Kallithea-specific header indicating the email type will be added to each
61 email. This header can be used for email filtering. The header is of the form:
61 email. This header can be used for email filtering. The header is of the form:
62
62
63 X-Kallithea-Notification-Type: <type>
63 X-Kallithea-Notification-Type: <type>
64
64
65 where ``<type>`` is one of:
65 where ``<type>`` is one of:
66
66
67 - ``pull_request``: you are invited as reviewer in a pull request
67 - ``pull_request``: you are invited as reviewer in a pull request
68 - ``pull_request_comment``: a comment was given on a pull request
68 - ``pull_request_comment``: a comment was given on a pull request
69 - ``cs_comment``: a comment was given on a changeset
69 - ``cs_comment``: a comment was given on a changeset
70 - ``registration``: a new user was registered
70 - ``registration``: a new user was registered
71 - ``message``: another type of email
71 - ``message``: another type of email
72
72
73
73
74 Error emails
74 Error emails
75 ------------
75 ------------
76
76
77 When an exception occurs in Kallithea -- and unless interactive debugging is
77 When an exception occurs in Kallithea -- and unless interactive debugging is
78 enabled using ``set debug = true`` in the ``[app:main]`` section of the
78 enabled using ``set debug = true`` in the ``[app:main]`` section of the
79 configuration file -- an email with exception details is sent by backlash_
79 configuration file -- an email with exception details is sent by backlash_
80 to the addresses specified in ``email_to`` in the configuration file.
80 to the addresses specified in ``email_to`` in the configuration file.
81
81
82 Recipients will see these emails originating from the sender specified in the
82 Recipients will see these emails originating from the sender specified in the
83 ``error_email_from`` setting in the configuration file. This setting can either
83 ``error_email_from`` setting in the configuration file. This setting can either
84 contain only an email address, like `kallithea-noreply@example.com`, or both
84 contain only an email address, like `kallithea-noreply@example.com`, or both
85 a name and an address in the following format: `Kallithea Errors
85 a name and an address in the following format: `Kallithea Errors
86 <kallithea-noreply@example.com>`.
86 <kallithea-noreply@example.com>`.
87
87
88
88
89 References
89 References
90 ----------
90 ----------
91
91
92 - `Error Middleware (Pylons documentation) <http://pylons-webframework.readthedocs.org/en/latest/debugging.html#error-middleware>`_
92 - `Error Middleware (Pylons documentation) <http://pylons-webframework.readthedocs.org/en/latest/debugging.html#error-middleware>`_
93 - `ErrorHandler (Pylons modules documentation) <http://pylons-webframework.readthedocs.org/en/latest/modules/middleware.html#pylons.middleware.ErrorHandler>`_
93 - `ErrorHandler (Pylons modules documentation) <http://pylons-webframework.readthedocs.org/en/latest/modules/middleware.html#pylons.middleware.ErrorHandler>`_
94
94
95
95
96 .. _WebError: https://pypi.python.org/pypi/WebError
96 .. _backlash: https://github.com/TurboGears/backlash
General Comments 0
You need to be logged in to leave comments. Login now