comparison roundup/configuration.py @ 7692:8fb42f41ef10 issue2550923_computed_property

merge in default branch to see if ti clears a travis-ci build error on 2.7 python; default branch builds fine
author John Rouillard <rouilj@ieee.org>
date Mon, 11 Sep 2023 00:10:29 -0400
parents 5e118944ef75
children d30e534b078a
comparison
equal deleted inserted replaced
7528:14a8e11f3a87 7692:8fb42f41ef10
644 try: 644 try:
645 v = int(value) 645 v = int(value)
646 if v < 0: 646 if v < 0:
647 raise OptionValueError(self, value, 647 raise OptionValueError(self, value,
648 "Integer number greater than or equal to zero required") 648 "Integer number greater than or equal to zero required")
649 return v
650 except OptionValueError:
651 raise # pass through subclass
652 except ValueError:
653 raise OptionValueError(self, value, "Integer number required")
654
655
656 class IntegerNumberGtZeroOption(Option):
657
658 """Integer numbers greater than zero."""
659
660 def str2value(self, value):
661 try:
662 v = int(value)
663 if v < 1:
664 raise OptionValueError(self, value,
665 "Integer number greater than zero required")
649 return v 666 return v
650 except OptionValueError: 667 except OptionValueError:
651 raise # pass through subclass 668 raise # pass through subclass
652 except ValueError: 669 except ValueError:
653 raise OptionValueError(self, value, "Integer number required") 670 raise OptionValueError(self, value, "Integer number required")
1245 "this number.\n" 1262 "this number.\n"
1246 "Determines the burst rate and the rate that new api\n" 1263 "Determines the burst rate and the rate that new api\n"
1247 "calls will be made available. If set to 360 and\n" 1264 "calls will be made available. If set to 360 and\n"
1248 "api_intervals_in_sec is set to 3600, the 361st call in\n" 1265 "api_intervals_in_sec is set to 3600, the 361st call in\n"
1249 "10 seconds results in a 429 error to the caller. It\n" 1266 "10 seconds results in a 429 error to the caller. It\n"
1250 "tells them to wait 10 seconds (360/3600) before making\n" 1267 "tells them to wait 10 seconds (3600/360) before making\n"
1251 "another api request. A value of 0 turns off rate\n" 1268 "another api request. A value of 0 turns off rate\n"
1252 "limiting in the API. Tune this as needed. See rest\n" 1269 "limiting in the API. Tune this as needed. See rest\n"
1253 "documentation for more info.\n"), 1270 "documentation for more info.\n"),
1254 (IntegerNumberGeqZeroOption, 'api_interval_in_sec', "3600", 1271 (IntegerNumberGtZeroOption, 'api_interval_in_sec', "3600",
1255 "Defines the interval in seconds over which an api client can\n" 1272 "Defines the interval in seconds over which an api client can\n"
1256 "make api_calls_per_interval api calls. Tune this as needed.\n"), 1273 "make api_calls_per_interval api calls. Tune this as needed.\n"),
1274 (IntegerNumberGeqZeroOption, 'api_failed_login_limit', "4",
1275 "Limit login failure to the API per api_failed_login_interval_in_sec\n"
1276 "seconds.\n"
1277 "A value of 0 turns off failed login rate\n"
1278 "limiting in the API. You should not disable this. See rest\n"
1279 "documentation for more info.\n"),
1280 (IntegerNumberGtZeroOption, 'api_failed_login_interval_in_sec', "600",
1281 "Defines the interval in seconds over which api login failures\n"
1282 "are recorded. It allows api_failed_login_limit login failures\n"
1283 "in this time interval. Tune this as needed.\n"),
1257 (CsrfSettingOption, 'csrf_enforce_token', "yes", 1284 (CsrfSettingOption, 'csrf_enforce_token', "yes",
1258 """How do we deal with @csrf fields in posted forms. 1285 """How do we deal with @csrf fields in posted forms.
1259 Set this to 'required' to block the post and notify 1286 Set this to 'required' to block the post and notify
1260 the user if the field is missing or invalid. 1287 the user if the field is missing or invalid.
1261 Set this to 'yes' to block the post and notify the user 1288 Set this to 'yes' to block the post and notify the user

Roundup Issue Tracker: http://roundup-tracker.org/