<%doc>
- Copyright (C) 2015, 2018 The Meme Factory, Inc. http://www.meme.com/
+ Copyright (C) 2015, 2018, 2020 The Meme Factory, Inc.
+ http://www.karlpinc.com/
This file is part of PGWUI_Upload.
Template for generic upload page.
- Karl O. Pinc <kop@meme.com>
+ Karl O. Pinc <kop@karlpinc.com>
This template uses the following variables in it's context:
-# Copyright (C) 2015, 2018 The Meme Factory, Inc. http://www.meme.com/
+# Copyright (C) 2015, 2018, 2020 The Meme Factory, Inc.
+# http://www.karlpinc.com/
# This file is part of PGWUI_Upload.
#
# <http://www.gnu.org/licenses/>.
#
-# Karl O. Pinc <kop@meme.com>
+# Karl O. Pinc <kop@karlpinc.com>
#
# Bugs:
# All data is presented to the db as a string, which could result
'''Return boolean -- whether to take column names literally
'''
settings = self.request.registry.settings
- quoter_setting = settings.get('pgwui.literal_column_headings')
+ quoter_setting = settings['pgwui'].get('literal_column_headings')
if quoter_setting == 'on':
return True
elif quoter_setting == 'ask':
return SaveLine(ue, self, insert_stmt)
-@view_config(route_name='upload',
+@view_config(route_name='pgwui_upload',
renderer='pgwui_upload:templates/upload.mak')
@auth_base_view
def upload_view(request):
response = UploadEngine(TableUploadHandler(request)).run()
settings = request.registry.settings
- quoter_setting = settings.get('pgwui.literal_column_headings')
+ quoter_setting = settings['pgwui'].get('literal_column_headings')
response['ask_about_literal_cols'] = quoter_setting == 'ask'
+ response.setdefault('pgwui', dict())
+ response['pgwui']['pgwui_upload'] = settings['pgwui']['pgwui_upload']
if response['db_changed']:
if is_checked(response['csv_checked']):
-# Copyright (C) 2018, 2019 The Meme Factory, Inc. http://www.karlpinc.com/
+# Copyright (C) 2018, 2019, 2020 The Meme Factory, Inc.
+# http://www.karlpinc.com/
# This file is part of PGWUI_Upload.
#
True
'''
result = get_quote_columns(UPLOAD_FORM_W_LIT_CHECKED,
- {'pgwui.literal_column_headings': 'on'})
+ {'pgwui': {'literal_column_headings': 'on'}})
assert result is True
False
'''
result = get_quote_columns(UPLOAD_FORM_W_LIT_CHECKED,
- {'pgwui.literal_column_headings': 'off'})
+ {'pgwui': {'literal_column_headings': 'off'}})
assert result is False
'''When the settings literal_column_headings is not present return
False (as default)
'''
- result = get_quote_columns(UPLOAD_FORM_W_LIT_CHECKED, {})
+ result = get_quote_columns(UPLOAD_FORM_W_LIT_CHECKED, {'pgwui': {}})
assert result is False
'''When the form asks for literal column headings return True
'''
result = get_quote_columns(UPLOAD_FORM_W_LIT_CHECKED,
- {'pgwui.literal_column_headings': 'ask'})
+ {'pgwui': {'literal_column_headings': 'ask'}})
assert result is True
'''When the form does not ask for literal column headings return False
'''
result = get_quote_columns({'literal_col_headings': False},
- {'pgwui.literal_column_headings': 'ask'})
+ {'pgwui': {'literal_column_headings': 'ask'}})
assert result is False
response = UNCHANGED_RESPONSE
settings = get_current_registry().settings
- settings['pgwui.literal_column_headings'] = 'ask'
+ settings['pgwui'] = {'literal_column_headings': 'ask'}
isolate_upload_view(response)
result = upload.upload_view(get_current_request())
response = UNCHANGED_RESPONSE
settings = get_current_registry().settings
- settings['pgwui.literal_column_headings'] = 'no'
+ settings['pgwui'] = {'literal_column_headings': 'no'}
isolate_upload_view(response)
result = upload.upload_view(get_current_request())