Mercurial > p > roundup > code
comparison roundup/configuration.py @ 5774:765f8c0e99ef
Sanity checking improvements. All IntegerNumberOption really have to
be positive integers or zero. Replace type with new
IntegerNumberGeqZeroOption class definition to enforce this range.
Use update_option to test now unused IntegerNumberOption and
never used FloatNumberOption.
Test save function, make sure it creates .bak file.
Test a few more configuration option classes.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Fri, 07 Jun 2019 21:53:55 -0400 |
| parents | 1151a2b31f1d |
| children | 936275dfe1fa |
comparison
equal
deleted
inserted
replaced
| 5773:1151a2b31f1d | 5774:765f8c0e99ef |
|---|---|
| 720 "Additional stop-words for the full-text indexer specific to\n" | 720 "Additional stop-words for the full-text indexer specific to\n" |
| 721 "your tracker. See the indexer source for the default list of\n" | 721 "your tracker. See the indexer source for the default list of\n" |
| 722 "stop-words (eg. A,AND,ARE,AS,AT,BE,BUT,BY, ...)"), | 722 "stop-words (eg. A,AND,ARE,AS,AT,BE,BUT,BY, ...)"), |
| 723 (OctalNumberOption, "umask", "0o002", | 723 (OctalNumberOption, "umask", "0o002", |
| 724 "Defines the file creation mode mask."), | 724 "Defines the file creation mode mask."), |
| 725 (IntegerNumberOption, 'csv_field_size', '131072', | 725 (IntegerNumberGeqZeroOption, 'csv_field_size', '131072', |
| 726 "Maximum size of a csv-field during import. Roundups export\n" | 726 "Maximum size of a csv-field during import. Roundups export\n" |
| 727 "format is a csv (comma separated values) variant. The csv\n" | 727 "format is a csv (comma separated values) variant. The csv\n" |
| 728 "reader has a limit on the size of individual fields\n" | 728 "reader has a limit on the size of individual fields\n" |
| 729 "starting with python 2.5. Set this to a higher value if you\n" | 729 "starting with python 2.5. Set this to a higher value if you\n" |
| 730 "get the error 'Error: field larger than field limit' during\n" | 730 "get the error 'Error: field larger than field limit' during\n" |
| 731 "import."), | 731 "import."), |
| 732 (IntegerNumberOption, 'password_pbkdf2_default_rounds', '10000', | 732 (IntegerNumberGeqZeroOption, 'password_pbkdf2_default_rounds', '10000', |
| 733 "Sets the default number of rounds used when encoding passwords\n" | 733 "Sets the default number of rounds used when encoding passwords\n" |
| 734 "using the PBKDF2 scheme. Set this to a higher value on faster\n" | 734 "using the PBKDF2 scheme. Set this to a higher value on faster\n" |
| 735 "systems which want more security.\n" | 735 "systems which want more security.\n" |
| 736 "PBKDF2 (Password-Based Key Derivation Function) is a\n" | 736 "PBKDF2 (Password-Based Key Derivation Function) is a\n" |
| 737 "password hashing mechanism that derives hash from the\n" | 737 "password hashing mechanism that derives hash from the\n" |
| 817 """Whether to enable the REST API in the roundup web | 817 """Whether to enable the REST API in the roundup web |
| 818 interface. By default the REST endpoint is the string 'rest' plus any | 818 interface. By default the REST endpoint is the string 'rest' plus any |
| 819 additional REST-API parameters after the roundup web url configured in | 819 additional REST-API parameters after the roundup web url configured in |
| 820 the tracker section. If this variable is set to 'no', the rest path has | 820 the tracker section. If this variable is set to 'no', the rest path has |
| 821 no special meaning and will yield an error message."""), | 821 no special meaning and will yield an error message."""), |
| 822 (IntegerNumberOption, 'api_calls_per_interval', "0", | 822 (IntegerNumberGeqZeroOption, 'api_calls_per_interval', "0", |
| 823 "Limit API calls per api_interval_in_sec seconds to\n" | 823 "Limit API calls per api_interval_in_sec seconds to\n" |
| 824 "this number.\n" | 824 "this number.\n" |
| 825 "Determines the burst rate and the rate that new api\n" | 825 "Determines the burst rate and the rate that new api\n" |
| 826 "calls will be made available. If set to 360 and\n" | 826 "calls will be made available. If set to 360 and\n" |
| 827 "api_intervals_in_sec is set to 3600, the 361st call in\n" | 827 "api_intervals_in_sec is set to 3600, the 361st call in\n" |
| 828 "10 seconds results in a 429 error to the caller. It\n" | 828 "10 seconds results in a 429 error to the caller. It\n" |
| 829 "tells them to wait 10 seconds (360/3600) before making\n" | 829 "tells them to wait 10 seconds (360/3600) before making\n" |
| 830 "another api request. A value of 0 turns off rate\n" | 830 "another api request. A value of 0 turns off rate\n" |
| 831 "limiting in the API. Tune this as needed. See rest\n" | 831 "limiting in the API. Tune this as needed. See rest\n" |
| 832 "documentation for more info.\n"), | 832 "documentation for more info.\n"), |
| 833 (IntegerNumberOption, 'api_interval_in_sec', "3600", | 833 (IntegerNumberGeqZeroOption, 'api_interval_in_sec', "3600", |
| 834 "Defines the interval in seconds over which an api client can\n" | 834 "Defines the interval in seconds over which an api client can\n" |
| 835 "make api_calls_per_interval api calls. Tune this as needed.\n"), | 835 "make api_calls_per_interval api calls. Tune this as needed.\n"), |
| 836 (CsrfSettingOption, 'csrf_enforce_token', "yes", | 836 (CsrfSettingOption, 'csrf_enforce_token', "yes", |
| 837 """How do we deal with @csrf fields in posted forms. | 837 """How do we deal with @csrf fields in posted forms. |
| 838 Set this to 'required' to block the post and notify | 838 Set this to 'required' to block the post and notify |
| 843 Set this to 'logfailure' to log a notice to the roundup | 843 Set this to 'logfailure' to log a notice to the roundup |
| 844 log if the field is invalid or missing, but accept | 844 log if the field is invalid or missing, but accept |
| 845 the post. | 845 the post. |
| 846 Set this to 'no' to ignore the field and accept the post. | 846 Set this to 'no' to ignore the field and accept the post. |
| 847 """), | 847 """), |
| 848 (IntegerNumberOption, 'csrf_token_lifetime', "20160", | 848 (IntegerNumberGeqZeroOption, 'csrf_token_lifetime', "20160", |
| 849 """csrf_tokens have a limited lifetime. If they are not | 849 """csrf_tokens have a limited lifetime. If they are not |
| 850 used they are purged from the database after this | 850 used they are purged from the database after this |
| 851 number of minutes. Default (20160) is 2 weeks."""), | 851 number of minutes. Default (20160) is 2 weeks."""), |
| 852 (CsrfSettingOption, 'csrf_enforce_token', "yes", | 852 (CsrfSettingOption, 'csrf_enforce_token', "yes", |
| 853 """How do we deal with @csrf fields in posted forms. | 853 """How do we deal with @csrf fields in posted forms. |
| 918 the field is missing. | 918 the field is missing. |
| 919 Set this to 'logfailure' to log a notice to the roundup | 919 Set this to 'logfailure' to log a notice to the roundup |
| 920 log if the header is invalid or missing, but accept | 920 log if the header is invalid or missing, but accept |
| 921 the post. | 921 the post. |
| 922 Set this to 'no' to ignore the header and accept the post."""), | 922 Set this to 'no' to ignore the header and accept the post."""), |
| 923 (IntegerNumberOption, 'csrf_header_min_count', "1", | 923 (IntegerNumberGeqZeroOption, 'csrf_header_min_count', "1", |
| 924 """Minimum number of header checks that must pass | 924 """Minimum number of header checks that must pass |
| 925 to accept the request. Set to 0 to accept post | 925 to accept the request. Set to 0 to accept post |
| 926 even if no header checks pass. Usually the Host header check | 926 even if no header checks pass. Usually the Host header check |
| 927 always passes, so setting it less than 1 is not recommended."""), | 927 always passes, so setting it less than 1 is not recommended."""), |
| 928 (BooleanOption, 'use_browser_language', "yes", | 928 (BooleanOption, 'use_browser_language', "yes", |
| 976 "Name of the MySQL defaults file.\n" | 976 "Name of the MySQL defaults file.\n" |
| 977 "Only used in MySQL connections."), | 977 "Only used in MySQL connections."), |
| 978 (NullableOption, 'read_default_group', 'roundup', | 978 (NullableOption, 'read_default_group', 'roundup', |
| 979 "Name of the group to use in the MySQL defaults file (.my.cnf).\n" | 979 "Name of the group to use in the MySQL defaults file (.my.cnf).\n" |
| 980 "Only used in MySQL connections."), | 980 "Only used in MySQL connections."), |
| 981 (IntegerNumberOption, 'sqlite_timeout', '30', | 981 (IntegerNumberGeqZeroOption, 'sqlite_timeout', '30', |
| 982 "Number of seconds to wait when the SQLite database is locked\n" | 982 "Number of seconds to wait when the SQLite database is locked\n" |
| 983 "Default: use a 30 second timeout (extraordinarily generous)\n" | 983 "Default: use a 30 second timeout (extraordinarily generous)\n" |
| 984 "Only used in SQLite connections."), | 984 "Only used in SQLite connections."), |
| 985 (IntegerNumberOption, 'cache_size', '100', | 985 (IntegerNumberGeqZeroOption, 'cache_size', '100', |
| 986 "Size of the node cache (in elements)"), | 986 "Size of the node cache (in elements)"), |
| 987 (BooleanOption, "allow_create", "yes", | 987 (BooleanOption, "allow_create", "yes", |
| 988 "Setting this option to 'no' protects the database against table creations."), | 988 "Setting this option to 'no' protects the database against table creations."), |
| 989 (BooleanOption, "allow_alter", "yes", | 989 (BooleanOption, "allow_alter", "yes", |
| 990 "Setting this option to 'no' protects the database against table alterations."), | 990 "Setting this option to 'no' protects the database against table alterations."), |
| 1037 (Option, "username", "", "SMTP login name.\n" | 1037 (Option, "username", "", "SMTP login name.\n" |
| 1038 "Set this if your mail host requires authenticated access.\n" | 1038 "Set this if your mail host requires authenticated access.\n" |
| 1039 "If username is not empty, password (below) MUST be set!"), | 1039 "If username is not empty, password (below) MUST be set!"), |
| 1040 (Option, "password", NODEFAULT, "SMTP login password.\n" | 1040 (Option, "password", NODEFAULT, "SMTP login password.\n" |
| 1041 "Set this if your mail host requires authenticated access."), | 1041 "Set this if your mail host requires authenticated access."), |
| 1042 (IntegerNumberOption, "port", smtplib.SMTP_PORT, | 1042 (IntegerNumberGeqZeroOption, "port", smtplib.SMTP_PORT, |
| 1043 "Default port to send SMTP on.\n" | 1043 "Default port to send SMTP on.\n" |
| 1044 "Set this if your mail server runs on a different port."), | 1044 "Set this if your mail server runs on a different port."), |
| 1045 (NullableOption, "local_hostname", '', | 1045 (NullableOption, "local_hostname", '', |
| 1046 "The local hostname to use during SMTP transmission.\n" | 1046 "The local hostname to use during SMTP transmission.\n" |
| 1047 "Set this if your mail server requires something specific."), | 1047 "Set this if your mail server requires something specific."), |
| 1234 (Option, "email_sending", "single", | 1234 (Option, "email_sending", "single", |
| 1235 "Controls the email sending from the nosy reactor. If\n" | 1235 "Controls the email sending from the nosy reactor. If\n" |
| 1236 "\"multiple\" then a separate email is sent to each\n" | 1236 "\"multiple\" then a separate email is sent to each\n" |
| 1237 "recipient. If \"single\" then a single email is sent with\n" | 1237 "recipient. If \"single\" then a single email is sent with\n" |
| 1238 "each recipient as a CC address."), | 1238 "each recipient as a CC address."), |
| 1239 (IntegerNumberOption, "max_attachment_size", sys.maxsize, | 1239 (IntegerNumberGeqZeroOption, "max_attachment_size", sys.maxsize, |
| 1240 "Attachments larger than the given number of bytes\n" | 1240 "Attachments larger than the given number of bytes\n" |
| 1241 "won't be attached to nosy mails. They will be replaced by\n" | 1241 "won't be attached to nosy mails. They will be replaced by\n" |
| 1242 "a link to the tracker's download page for the file.") | 1242 "a link to the tracker's download page for the file.") |
| 1243 ), "Nosy messages sending"), | 1243 ), "Nosy messages sending"), |
| 1244 ) | 1244 ) |
