Skip to content

Commit b3bf1b8

Browse files
committed
Incomplete work to generate config doc from config.ini
This is an incomplete attempt to allow generation of the config.ini documentation in reference.txt. It reformats the output of 'roundup_admin.py genconfig'. So it now includes all of the settings. Using a Makefile rule like: tracker_config.txt: ../roundup/configuration.py python3 ../roundup/scripts/roundup_admin.py \ genconfig _temp_config.txt sed -e '1,8d' \ -e 's/^\[\([a-z]*\)\]/\n.. index:: config.ini; sections \1\n\n.. code:: ini\n\n [\1]/' \ -e 's/^\([^[]\)/ \1/' \ _temp_config.txt > tracker_config.txt rm -f _temp_config.txt results in the config.ini split by section and index links being put in place. However some sections have a comment before the [section] marker. This comment is orphaned at the end of the prior section rather than starting the new section. A simple sed won't allow the lookahead needed to target the [section] marker and include the prior comment block. Also there are still have some long lines generated (> 65 characters). Maybe a python script can import configuration.py and output proper restructured text output? reference.txt: add a commented out include:: tracker_config.txt directive roundup/admin.py: don't require a tracker home for genconfig. So user can generate a clean config.ini on demand. Tracker home is still required for updateconfig. roundup/configuration.py: wrap lines better. A number of them are generating comments > 65 characters which is the targeted line length. This cleans up config.ini too, so is a good thing. website/www/conf.py: ignore doc/tracker_config.ini when processing.
1 parent 5b688e9 commit b3bf1b8

File tree

4 files changed

+53
-38
lines changed

4 files changed

+53
-38
lines changed

doc/reference.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ Example configuration settings are below. This is a partial
116116
list. Documentation on all the settings is included in the
117117
``config.ini`` file.
118118

119+
.. .comment out. file generation needs more work include:: tracker_config.txt
120+
119121
.. index:: config.ini; sections main
120122

121123
Section **main**

roundup/admin.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,6 +1934,10 @@ def run_command(self, args):
19341934
return 0
19351935
if command == 'templates':
19361936
return self.do_templates(args[1:])
1937+
return 0
1938+
if command == 'genconfig':
1939+
return self.do_genconfig(args[1:])
1940+
return 0
19371941

19381942
# figure what the command is
19391943
try:

roundup/configuration.py

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ class OriginHeadersListOption(Option):
565565
"""List of space seperated origin header values.
566566
"""
567567

568-
class_description = "A list of space separated case sensitive origin headers 'scheme://host'."
568+
class_description = "A list of space separated case sensitive\norigin headers 'scheme://host'."
569569

570570
def set(self, _val):
571571
pathlist = self._value = []
@@ -1021,14 +1021,14 @@ def str2value(self, value):
10211021
"the EMAIL_FROM_TAG goes inside the \"Foo Bar\" quotes like so:\n"
10221022
"\"Foo Bar EMAIL_FROM_TAG\" <[email protected]>"),
10231023
(Option, "new_web_user_roles", "User",
1024-
"Roles that a user gets when they register"
1025-
" with Web User Interface.\n"
1026-
"This is a comma-separated string of role names"
1024+
"Roles that a user gets when they register\n"
1025+
"with Web User Interface.\n"
1026+
"This is a comma-separated string of role names\n"
10271027
" (e.g. 'Admin,User')."),
10281028
(Option, "new_email_user_roles", "User",
1029-
"Roles that a user gets when they register"
1030-
" with Email Gateway.\n"
1031-
"This is a comma-separated string of role names"
1029+
"Roles that a user gets when they register\n"
1030+
"with Email Gateway.\n"
1031+
"This is a comma-separated string of role names\n"
10321032
" (e.g. 'Admin,User')."),
10331033
(Option, "obsolete_history_roles", "Admin",
10341034
"On schema changes, properties or classes in the history may\n"
@@ -1039,24 +1039,26 @@ def str2value(self, value):
10391039
"admin role may see these history entries, you can make them\n"
10401040
"visible to all users by adding, e.g., the 'User' role here."),
10411041
(Option, "error_messages_to", "user",
1042-
'Send error message emails to the "dispatcher", "user", '
1042+
'Send error message emails to the "dispatcher", "user", \n'
10431043
'or "both" (these are the three allowed values).\n'
1044-
'The dispatcher is configured using the DISPATCHER_EMAIL'
1044+
'The dispatcher is configured using the DISPATCHER_EMAIL\n'
10451045
' setting.'),
10461046
(Option, "html_version", "html4",
10471047
"HTML version to generate. The templates are html4 by default.\n"
1048-
"If you wish to make them xhtml, then you'll need to change this\n"
1049-
"var to 'xhtml' too so all auto-generated HTML is compliant.\n"
1048+
"If you wish to make them xhtml, then you'll need to change\n"
1049+
"this setting to 'xhtml' too so all auto-generated HTML\n"
1050+
"is compliant.\n"
10501051
"Allowed values: html4, xhtml"),
10511052
(TimezoneOption, "timezone", TimezoneOption.defaulttz,
1052-
"Default timezone offset,"
1053-
" applied when user's timezone is not set.",
1053+
"Default timezone offset,\n"
1054+
"applied when user's timezone is not set.",
10541055
["DEFAULT_TIMEZONE"]),
10551056
(BooleanOption, "instant_registration", "no",
10561057
"Register new users instantly, or require confirmation via\n"
10571058
"email?"),
10581059
(BooleanOption, "email_registration_confirmation", "yes",
1059-
"Offer registration confirmation by email or only through the web?"),
1060+
"Offer registration confirmation by email or only\n"
1061+
"through the web?"),
10601062
(IndexerOption, "indexer", "",
10611063
"Force Roundup to use a particular text indexer.\n"
10621064
"If no indexer is supplied, the first available indexer\n"
@@ -1108,8 +1110,8 @@ def str2value(self, value):
11081110
"A descriptive name for your roundup instance."),
11091111
(WebUrlOption, "web", NODEFAULT,
11101112
"The web address that the tracker is viewable at.\n"
1111-
"This will be included in information"
1112-
" sent to users of the tracker.\n"
1113+
"This will be included in information\n"
1114+
"sent to users of the tracker.\n"
11131115
"The URL MUST include the cgi-bin part or anything else\n"
11141116
"that is required to get to the home page of the tracker.\n"
11151117
"URL MUST start with http/https scheme and end with '/'"),
@@ -1216,24 +1218,26 @@ def str2value(self, value):
12161218
email)."""),
12171219
(BooleanOption, 'enable_xmlrpc', "yes",
12181220
"""Whether to enable the XMLRPC API in the roundup web
1219-
interface. By default the XMLRPC endpoint is the string 'xmlrpc'
1220-
after the roundup web url configured in the 'tracker' section.
1221-
If this variable is set to 'no', the xmlrpc path has no special meaning
1222-
and will yield an error message."""),
1221+
interface. By default the XMLRPC endpoint is the string
1222+
'xmlrpc' after the roundup web url configured in the
1223+
'tracker' section. If this variable is set to 'no', the
1224+
xmlrpc path has no special meaning and will yield an
1225+
error message."""),
12231226
(BooleanOption, 'translate_xmlrpc', 'no',
12241227
"""Whether to enable i18n for the xmlrpc endpoint. Enable it if
1225-
you want to enable translation based on browsers lang (if enabled), trackers
1226-
lang (if set) or environment."""),
1228+
you want to enable translation based on browsers lang
1229+
(if enabled), trackers lang (if set) or environment."""),
12271230
(BooleanOption, 'enable_rest', "yes",
12281231
"""Whether to enable the REST API in the roundup web
1229-
interface. By default the REST endpoint is the string 'rest' plus any
1230-
additional REST-API parameters after the roundup web url configured in
1231-
the tracker section. If this variable is set to 'no', the rest path has
1232-
no special meaning and will yield an error message."""),
1232+
interface. By default the REST endpoint is the string
1233+
'rest' plus any additional REST-API parameters after the
1234+
roundup web url configured in the tracker section. If this
1235+
variable is set to 'no', the rest path has no special meaning
1236+
and will yield an error message."""),
12331237
(BooleanOption, 'translate_rest', 'no',
12341238
"""Whether to enable i18n for the rest endpoint. Enable it if
1235-
you want to enable translation based on browsers lang (if enabled), trackers
1236-
lang (if set) or environment."""),
1239+
you want to enable translation based on browsers lang
1240+
(if enabled), trackers lang (if set) or environment."""),
12371241
(IntegerNumberGeqZeroOption, 'api_calls_per_interval', "0",
12381242
"Limit API calls per api_interval_in_sec seconds to\n"
12391243
"this number.\n"
@@ -1370,8 +1374,9 @@ def str2value(self, value):
13701374
"in the user's browser rather than emailing them to the\n"
13711375
"tracker admin."),
13721376
(BooleanOption, "login_empty_passwords", "no",
1373-
"Setting this option to yes/true allows users with an empty/blank\n"
1374-
"password to login to the web/http interfaces."),
1377+
"Setting this option to yes/true allows users with\n"
1378+
"an empty/blank password to login to the\n"
1379+
"web/http interfaces."),
13751380
(BooleanOption, "migrate_passwords", "yes",
13761381
"Setting this option makes Roundup migrate passwords with\n"
13771382
"an insecure password-scheme to a more secure scheme\n"
@@ -1436,11 +1441,14 @@ def str2value(self, value):
14361441
(IntegerNumberGeqZeroOption, 'cache_size', '100',
14371442
"Size of the node cache (in elements)"),
14381443
(BooleanOption, "allow_create", "yes",
1439-
"Setting this option to 'no' protects the database against table creations."),
1444+
"Setting this option to 'no' protects the database against\n"
1445+
"table creations."),
14401446
(BooleanOption, "allow_alter", "yes",
1441-
"Setting this option to 'no' protects the database against table alterations."),
1447+
"Setting this option to 'no' protects the database against\n"
1448+
"table alterations."),
14421449
(BooleanOption, "allow_drop", "yes",
1443-
"Setting this option to 'no' protects the database against table drops."),
1450+
"Setting this option to 'no' protects the database against\n"
1451+
"table drops."),
14441452
(NullableOption, 'template', '',
14451453
"Name of the PostgreSQL template for database creation.\n"
14461454
"For database creation the template used has to match\n"
@@ -1461,7 +1469,7 @@ def str2value(self, value):
14611469
"Set the database cursor for filter queries to serverside\n"
14621470
"cursor, this avoids caching large amounts of data in the\n"
14631471
"client. This option only applies for the postgresql backend."),
1464-
), "Settings in this section (except for backend) are used"
1472+
), "Settings in this section (except for backend) are used\n"
14651473
" by RDBMS backends only."
14661474
),
14671475
("sessiondb", (
@@ -1538,14 +1546,14 @@ def str2value(self, value):
15381546
(FilePathOption, "debug", "",
15391547
"Setting this option makes Roundup write all outgoing email\n"
15401548
"messages to this file *instead* of sending them.\n"
1541-
"This option has the same effect as environment variable"
1542-
" SENDMAILDEBUG.\nEnvironment variable takes precedence."),
1549+
"This option has the same effect as the environment variable\n"
1550+
"SENDMAILDEBUG.\nEnvironment variable takes precedence."),
15431551
(BooleanOption, "add_authorinfo", "yes",
15441552
"Add a line with author information at top of all messages\n"
15451553
"sent by roundup"),
15461554
(BooleanOption, "add_authoremail", "yes",
1547-
"Add the mail address of the author to the author information at\n"
1548-
"the top of all messages.\n"
1555+
"Add the mail address of the author to the author information\n"
1556+
"at the top of all messages.\n"
15491557
"If this is false but add_authorinfo is true, only the name\n"
15501558
"of the actor is added which protects the mail address of the\n"
15511559
"actor from being exposed at mail archives, etc."),

website/www/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
'docs/whatsnew-0.7.txt',
7575
'docs/whatsnew-0.8.txt',
7676
'robots.txt',
77+
'docs/tracker_config.txt',
7778
'_tmp']
7879

7980
# The reST default role (used for this markup: `text`) to use for all documents.

0 commit comments

Comments
 (0)