# Whether or not to change the db content. (required)
pgwui.dry_run = False
-# Menu presentation
-
-# The PGWUI_Menu component automaticaly constructs a menu for the
-# PGWUI components in use. The display value of the menu items can
-# be overridden.
-#pgwui.pgwui_upload =
-# menu_label = upload -- Upload File Into Database
-
# Routing
# Routes are what call up specific pages. They are the
# vulnerabilties. Validation is on by default.
# pgwui.validate_hmac = True
+# PGWUI Component Settings
+
+# Menu presentation
+
+# The PGWUI_Menu component automaticaly constructs a menu for the
+# PGWUI components in use. The display value of the menu items can
+# be overridden using a "menu_label" setting for each component.
+# CAUTION: Do not uncomment the below, instead change the component's
+# "menu_label" setting.
+#pgwui.pgwui_upload =
+# menu_label = upload -- Upload File Into Database
+
+# pgwui_upload
+
# Take uploaded column headings literally?
# The available choices are:
# on The file's column headings, as typed, are the table's column names.
#
# Caution: Non-ASCII column names, particularly in the Turkish locale,
# are not guaranteed to be case-insensitive.
-pgwui.literal_column_headings = off
-
+pgwui.pgwui_upload =
+ literal_column_headings = off
+ # menu_label = upload -- Upload File Into Database
#
# Pyramid configuration
# vulnerabilties. Validation is on by default.
pgwui.validate_hmac = False
+# PGWUI Component Settings
+
+# Menu presentation
+
+# The PGWUI_Menu component automaticaly constructs a menu for the
+# PGWUI components in use. The display value of the menu items can
+# be overridden using a "menu_label" setting for each component.
+# CAUTION: Do not uncomment the below, instead change the component's
+# "menu_label" setting.
+#pgwui.pgwui_upload =
+# menu_label = upload -- Upload File Into Database
+
+# pgwui_upload
+
# Take uploaded column headings literally?
# The available choices are:
# on The file's column headings, as typed, are the table's column names.
#
# Caution: Non-ASCII column names, particularly in the Turkish locale,
# are not guaranteed to be case-insensitive.
-pgwui.literal_column_headings = off
+pgwui.pgwui_upload =
+ literal_column_headings = off
+ # menu_label = upload -- Upload File Into Database
#
'routes',
'validate_hmac',
'autoconfigure',
- 'literal_column_headings',
])
# validate_hmac
boolean_setting(errors, 'pgwui.validate_hmac', settings)
- # literal_column_headings
- validate_literal_column_headings(errors, settings)
-
def do_validate_hmac(settings):
'''True unless the user has specificly rejected hmac validation
return
-def validate_literal_column_headings(errors, settings):
- '''Make sure the values are those allowed
- '''
- value = settings.get('pgwui.literal_column_headings')
- if value is None:
- return
- if value not in ('on', 'off', 'ask'):
- errors.append(server_ex.BadLiteralColumnHeadingsError(value))
-
-
def parse_assignments(lines):
'''Return a list of key/value tuples from the lines of a setting
'''
super().__init__('Aborting due to bad setting(s)')
-class BadLiteralColumnHeadingsError(ServerError):
- def __init__(self, value):
- super().__init__(
- 'The "pgwui.literal_column_headings" PGWUI setting must be'
- '"on", "off", "ask", or not present')
-
-
class BadHMACError(ServerError):
pass
pgwui_server_init, 'validate_hmac')
-# validate_literal_column_headings()
-
-def test_validate_literal_column_headings_nosetting():
- '''No error is delivered when there's no setting'''
- errors = []
- pgwui_server_init.validate_literal_column_headings(errors, {})
-
- assert errors == []
-
-
-def test_validate_literal_column_headings_on():
- '''No error is delivered when the setting is "on"'''
- errors = []
- pgwui_server_init.validate_literal_column_headings(
- errors, {'pgwui.literal_column_headings': 'on'})
-
- assert errors == []
-
-
-def test_validate_literal_column_headings_off():
- '''No error is delivered when the setting is "off"'''
- errors = []
- pgwui_server_init.validate_literal_column_headings(
- errors, {'pgwui.literal_column_headings': 'off'})
-
- assert errors == []
-
-
-def test_validate_literal_column_headings_ask():
- '''No error is delivered when the setting is "ask"'''
- errors = []
- pgwui_server_init.validate_literal_column_headings(
- errors, {'pgwui.literal_column_headings': 'ask'})
-
- assert errors == []
-
-
-def test_validate_literal_column_headings_bad():
- '''delivers an error when given a bad value'''
- errors = []
- pgwui_server_init.validate_literal_column_headings(
- errors, {'pgwui.literal_column_headings': 'bad'})
-
- assert errors
- assert isinstance(
- errors[0], server_ex.BadLiteralColumnHeadingsError)
-
-
-mock_validate_literal_column_headings = testing.make_mock_fixture(
- pgwui_server_init, 'validate_literal_column_headings')
-
-
# parse_assignments()
def test_parse_assignments_str():