This is an automated email from the ASF dual-hosted git repository.
dill0wn pushed a commit to branch dw/8495
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/dw/8495 by this push:
new 6b78cb4c7 [#8495] fix DeprecationWarning c.form_errors/form_values ->
request.validation.errors/values
6b78cb4c7 is described below
commit 6b78cb4c7cc8121f75af4de0013d2c9ba7e7e29d
Author: Dillon Walls <[email protected]>
AuthorDate: Thu Jan 26 21:19:09 2023 +0000
[#8495] fix DeprecationWarning c.form_errors/form_values ->
request.validation.errors/values
---
Allura/allura/controllers/auth.py | 8 +++----
Allura/allura/controllers/project.py | 4 ++--
Allura/allura/controllers/site_admin.py | 20 ++++++++---------
.../templates/admin_widgets/metadata_admin.html | 8 +++----
.../ext/personal_dashboard/dashboard_main.py | 6 ++---
Allura/allura/lib/decorators.py | 2 +-
Allura/allura/lib/repository.py | 4 ++--
Allura/allura/templates/login_multifactor.html | 4 ++--
Allura/allura/templates/reconfirm_auth.html | 4 ++--
Allura/allura/templates/user_totp.html | 4 ++--
Allura/allura/templates/webhooks/create_form.html | 12 +++++-----
.../widgets/neighborhood_add_project.html | 2 +-
.../templates/widgets/sortable_repeated_field.html | 8 +++----
.../templates/admin_widgets/metadata_admin.html | 8 +++----
Allura/allura/webhooks.py | 10 ++++-----
ForgeImporters/forgeimporters/base.py | 2 +-
.../github/templates/code/index.html | 4 ++--
.../forgeimporters/github/templates/project.html | 26 +++++++++++-----------
.../github/templates/tracker/index.html | 4 ++--
.../github/templates/wiki/index.html | 6 ++---
.../forgeimporters/templates/importer_base.html | 8 +++----
.../forgeimporters/templates/project_base.html | 22 +++++++++---------
.../forgeimporters/trac/templates/project.html | 12 +++++-----
.../trac/templates/tickets/index.html | 2 +-
ForgeSVN/forgesvn/svn_main.py | 4 ++--
ForgeShortUrl/forgeshorturl/main.py | 6 ++---
26 files changed, 100 insertions(+), 100 deletions(-)
diff --git a/Allura/allura/controllers/auth.py
b/Allura/allura/controllers/auth.py
index 21b3fc346..10371c9e6 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -412,11 +412,11 @@ class AuthController(BaseController):
recovery.verify_and_remove_code(user, code)
h.auditlog_user('Logged in using a multifactor recovery code',
user=user)
except (InvalidToken, InvalidRecoveryCode):
- c.form_errors['code'] = 'Invalid code, please try again.'
+ request.validation.errors['code'] = 'Invalid code, please try
again.'
h.auditlog_user('Multifactor login - invalid code', user=user)
return self.multifactor(mode=mode, **kwargs)
except MultifactorRateLimitError:
- c.form_errors['code'] = 'Multifactor rate limit exceeded, slow
down and try again later.'
+ request.validation.errors['code'] = 'Multifactor rate limit
exceeded, slow down and try again later.'
h.auditlog_user('Multifactor login - rate limit', user=user)
return self.multifactor(mode=mode, **kwargs)
else:
@@ -831,7 +831,7 @@ class PreferencesController(BaseController):
totp_service.verify(totp, code, c.user)
except InvalidToken:
h.auditlog_user('Failed to set up multifactor TOTP (wrong code)')
- c.form_errors['code'] = 'Invalid code, please try again.'
+ request.validation.errors['code'] = 'Invalid code, please try
again.'
return self.totp_new(**kw)
else:
h.auditlog_user('Set up multifactor TOTP')
@@ -1067,7 +1067,7 @@ class UserContactsController(BaseController):
Validator = validator_map.get(kw['socialnetwork'])
kw['accounturl'] = Validator().to_python(kw['accounturl'])
except fe.Invalid as e:
- # c.form_errors['accounturl'] = e.msg
+ # request.validation.errors['accounturl'] = e.msg
flash(e.msg, 'error')
redirect('.')
diff --git a/Allura/allura/controllers/project.py
b/Allura/allura/controllers/project.py
index 56d01c9d0..baaede732 100644
--- a/Allura/allura/controllers/project.py
+++ b/Allura/allura/controllers/project.py
@@ -153,7 +153,7 @@ class NeighborhoodController:
def add_project(self, **form_data):
with h.login_overlay():
require_access(self.neighborhood, 'register')
- verify = c.form_errors == {'_the_form': 'phone-verification'}
+ verify = request.validation.errors == {'_the_form':
'phone-verification'}
c.show_phone_verification_overlay = verify
c.add_project = W.add_project
form_data.setdefault('tools', W.add_project.default_tools)
@@ -197,7 +197,7 @@ class NeighborhoodController:
@validate(W.add_project)
def check_names(self, **raw_data):
require_access(self.neighborhood, 'register')
- return c.form_errors
+ return request.validation.errors
@h.vardec
@expose()
diff --git a/Allura/allura/controllers/site_admin.py
b/Allura/allura/controllers/site_admin.py
index b9a8f93e8..440c024f0 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -219,12 +219,12 @@ class SiteAdminController:
mount_point=validators.NotEmpty()))
def reclone_repo(self, prefix=None, shortname=None, mount_point=None,
**data):
if request.method == 'POST':
- if c.form_errors:
+ if request.validation.errors:
error_msg = 'Error: '
- for msg in list(c.form_errors):
+ for msg in list(request.validation.errors):
names = {'prefix': 'Neighborhood prefix', 'shortname':
'Project shortname', 'mount_point': 'Repository
mount point'}
- error_msg += f'{names[msg]}: {c.form_errors[msg]} '
+ error_msg += f'{names[msg]}:
{request.validation.errors[msg]} '
flash(error_msg, 'error')
return dict(prefix=prefix, shortname=shortname,
mount_point=mount_point)
nbhd = M.Neighborhood.query.get(url_prefix='/%s/' % prefix)
@@ -455,8 +455,8 @@ class SiteNotificationController:
def new(self, **kw):
"""Render the New SiteNotification form"""
return dict(
- form_errors=c.form_errors or {},
- form_values=c.form_values or {},
+ form_errors=request.validation.errors or {},
+ form_values=request.validation.values or {},
form_title='New Site Notification',
form_action='create'
)
@@ -475,10 +475,10 @@ class SiteNotificationController:
@expose('jinja:allura:templates/site_admin_site_notifications_create_update.html')
def edit(self, **kw):
- if c.form_values:
+ if request.validation.values:
return dict(
- form_errors=c.form_errors or {},
- form_values=c.form_values or {},
+ form_errors=request.validation.errors or {},
+ form_values=request.validation.values or {},
form_title='Edit Site Notification',
form_action='update'
)
@@ -583,8 +583,8 @@ class TaskManagerController:
def new(self, **kw):
"""Render the New Task form"""
return dict(
- form_errors=c.form_errors or {},
- form_values=c.form_values or {},
+ form_errors=request.validation.errors or {},
+ form_values=request.validation.values or {},
)
@expose()
diff --git
a/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
b/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
index 3998c4251..7937cd490 100644
--- a/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
+++ b/Allura/allura/ext/admin/templates/admin_widgets/metadata_admin.html
@@ -61,8 +61,8 @@
{% if tg.config.get('support_tool_choices') %}
<div class="support-page-fields">
Preferred Support Page (for users of your project):<br>
- {% if c.form_errors.get('support_page_url') %}
- <div class="error">{{c.form_errors.get('support_page_url')}}</div>
+ {% if request.validation.errors.get('support_page_url') %}
+ <div
class="error">{{request.validation.errors.get('support_page_url')}}</div>
{% endif %}
<input name="support_page" type="radio" value=""{% if
value.support_page == '' %} checked{% endif %} id="support_page_none">
<label for="support_page_none">None</label><br>
@@ -133,8 +133,8 @@
{% set proj_text = 'Project' if value.is_root else 'Subproject' %}
{{proj_text}} Status:
<div>
- {% if c.form_errors.get('moved_to_url') %}
- <div class="error">{{c.form_errors.get('moved_to_url')}}</div>
+ {% if request.validation.errors.get('moved_to_url') %}
+ <div
class="error">{{request.validation.errors.get('moved_to_url')}}</div>
{% endif %}
<input name="removal" type="radio" value="" id="removal_active_cb"
{% if value.removal == '' %} checked{% endif %}>
diff --git a/Allura/allura/ext/personal_dashboard/dashboard_main.py
b/Allura/allura/ext/personal_dashboard/dashboard_main.py
index 12cf1fa40..70ae65829 100644
--- a/Allura/allura/ext/personal_dashboard/dashboard_main.py
+++ b/Allura/allura/ext/personal_dashboard/dashboard_main.py
@@ -18,7 +18,7 @@
import logging
from tg import tmpl_context as c, app_globals as g
-from tg import expose, redirect, config
+from tg import expose, redirect, config, request
from itertools import islice
from ming.odm import session
@@ -92,8 +92,8 @@ class TicketsSection(DashboardSectionBase):
page = 0
limit = 25
- page_string = context['c'].form_values.get('page')
- limit_string = context['c'].form_values.get('limit')
+ page_string = request.validation.values.get('page')
+ limit_string = request.validation.values.get('limit')
if page_string is not None:
page = int(page_string)
if limit_string is not None:
diff --git a/Allura/allura/lib/decorators.py b/Allura/allura/lib/decorators.py
index 078eaa4f8..b2b15f152 100644
--- a/Allura/allura/lib/decorators.py
+++ b/Allura/allura/lib/decorators.py
@@ -142,7 +142,7 @@ def reconfirm_auth(func, *args, **kwargs):
session.save()
kwargs.pop('password', None)
else:
- c.form_errors['password'] = 'Invalid password.'
+ request.validation.errors['password'] = 'Invalid password.'
allowed_timedelta =
timedelta(seconds=asint(config.get('auth.reconfirm.seconds', 60)))
last_reconfirm = session.get('auth-reconfirmed', datetime.min)
diff --git a/Allura/allura/lib/repository.py b/Allura/allura/lib/repository.py
index 494c46772..d414d9893 100644
--- a/Allura/allura/lib/repository.py
+++ b/Allura/allura/lib/repository.py
@@ -314,7 +314,7 @@ class RepoAdminController(DefaultAdminController):
def set_checkout_url(self, **post_data):
flash_msgs = []
external_checkout_url = (post_data.get('external_checkout_url') or
'').strip()
- if 'external_checkout_url' not in c.form_errors:
+ if 'external_checkout_url' not in request.validation.errors:
if (self.app.config.options.get('external_checkout_url') or '') !=
external_checkout_url:
M.AuditLog.log('{}: set "{}" {} => {}'.format(
self.app.config.options['mount_point'],
"external_checkout_url",
@@ -322,7 +322,7 @@ class RepoAdminController(DefaultAdminController):
self.app.config.options.external_checkout_url =
external_checkout_url
flash_msgs.append("External checkout URL successfully
changed.")
else:
- flash_msgs.append("Invalid external checkout URL: %s." %
c.form_errors['external_checkout_url'])
+ flash_msgs.append("Invalid external checkout URL: %s." %
request.validation.errors['external_checkout_url'])
merge_disabled = bool(post_data.get('merge_disabled'))
if merge_disabled != self.app.config.options.get('merge_disabled',
False):
diff --git a/Allura/allura/templates/login_multifactor.html
b/Allura/allura/templates/login_multifactor.html
index f71755ff5..749b74b34 100644
--- a/Allura/allura/templates/login_multifactor.html
+++ b/Allura/allura/templates/login_multifactor.html
@@ -30,8 +30,8 @@
<span class="totp">Please enter the {{
config['auth.multifactor.totp.length'] }}-digit code from your authenticator
app:</span>
<span class="recovery">Please enter a recovery code:</span>
<br>
- {% if c.form_errors['code'] %}
- <span class="fielderror">{{ c.form_errors['code'] }}</span><br>
+ {% if request.validation.errors['code'] %}
+ <span class="fielderror">{{ request.validation.errors['code']
}}</span><br>
{% endif %}
<input type="text" name="code" autofocus autocomplete="off"/>
<input type="hidden" name="return_to" value="{{ return_to }}"/>
diff --git a/Allura/allura/templates/reconfirm_auth.html
b/Allura/allura/templates/reconfirm_auth.html
index a3ea322c3..d592a4e9b 100644
--- a/Allura/allura/templates/reconfirm_auth.html
+++ b/Allura/allura/templates/reconfirm_auth.html
@@ -27,8 +27,8 @@
<form method="post">
<h2>Password Confirmation</h2>
<p>To access this account security page, you must reconfirm your
password:<br>
- {% if c.form_errors['password'] %}
- <span class="fielderror">{{ c.form_errors['password'] }}</span><br>
+ {% if request.validation.errors['password'] %}
+ <span class="fielderror">{{ request.validation.errors['password']
}}</span><br>
{% endif %}
<input type="password" name="password" autofocus>
<br>
diff --git a/Allura/allura/templates/user_totp.html
b/Allura/allura/templates/user_totp.html
index ce4ae726a..38cb92989 100644
--- a/Allura/allura/templates/user_totp.html
+++ b/Allura/allura/templates/user_totp.html
@@ -56,8 +56,8 @@
<form method="POST" action="totp_set" id="totp_set">
<p>
Enter the {{ config['auth.multifactor.totp.length'] }}-digit code
from the app, to confirm it is set up correctly:<br>
- {% if c.form_errors['code'] %}
- <span class="fielderror">{{ c.form_errors['code'] }}</span><br>
+ {% if request.validation.errors['code'] %}
+ <span class="fielderror">{{ request.validation.errors['code']
}}</span><br>
{% endif %}
<input type="text" name="code" autofocus autocomplete="off"
maxlength="{{ config['auth.multifactor.totp.length']|int + 1 }}"/>
{{ lib.csrf_token() }}
diff --git a/Allura/allura/templates/webhooks/create_form.html
b/Allura/allura/templates/webhooks/create_form.html
index 9598e1f0a..948fc4046 100644
--- a/Allura/allura/templates/webhooks/create_form.html
+++ b/Allura/allura/templates/webhooks/create_form.html
@@ -58,8 +58,8 @@
{% endblock %}
{%- macro error(field_name) %}
- {% if c.form_errors[field_name] %}
- <div class="error">{{c.form_errors[field_name]}}</div>
+ {% if request.validation.errors[field_name] %}
+ <div class="error">{{request.validation.errors[field_name]}}</div>
{% endif %}
{%- endmacro %}
@@ -69,20 +69,20 @@
<form action="{{action}}" method="post" enctype="multipart/form-data">
<div>
<label for="url">url</label>
- <input name="url" value="{{ c.form_values['url'] }}">
+ <input name="url" value="{{ request.validation.values['url'] }}">
{{ error('url') }}
</div>
<div>
<label for="secret">secret (leave empty to autogenerate)</label>
- <input name="secret" value="{{ c.form_values['secret'] }}">
+ <input name="secret" value="{{ request.validation.values['secret'] }}">
{{ error('secret') }}
</div>
{% block additional_fields %}{% endblock %}
<input type="submit" value="{{action|capitalize}}">
- {% if c.form_values['webhook'] %}
- <input type="hidden" name="webhook" value="{{c.form_values['webhook']}}">
+ {% if request.validation.values['webhook'] %}
+ <input type="hidden" name="webhook"
value="{{request.validation.values['webhook']}}">
{% endif %}
{{lib.csrf_token()}}
</form>
diff --git a/Allura/allura/templates/widgets/neighborhood_add_project.html
b/Allura/allura/templates/widgets/neighborhood_add_project.html
index fea1f149a..2e8625de9 100644
--- a/Allura/allura/templates/widgets/neighborhood_add_project.html
+++ b/Allura/allura/templates/widgets/neighborhood_add_project.html
@@ -51,7 +51,7 @@
<h2 style="padding-left:20px">
Select the tools to use in your project. You may add or remove tools
at any time.
</h2>
- <span class="fielderror">{{ c.form_errors.get('tools', '') }}</span>
+ <span class="fielderror">{{ request.validation.errors.get('tools', '')
}}</span>
{% for opt in widget.fields.tools.options %}
{% set tool = g.entry_points["tool"][opt.html_value] %}
{% set _ctx = widget.context_for(widget.fields.tools) %}
diff --git a/Allura/allura/templates/widgets/sortable_repeated_field.html
b/Allura/allura/templates/widgets/sortable_repeated_field.html
index 8390d0e22..2e5e9c6ee 100644
--- a/Allura/allura/templates/widgets/sortable_repeated_field.html
+++ b/Allura/allura/templates/widgets/sortable_repeated_field.html
@@ -29,10 +29,10 @@
{% set id = 0 %}
{% for i in range(repetitions) %}
{% set ctx = widget.context_for(i) %}
- {% if c.form_values %}
- {% if 'features-' ~ i ~ '.feature' in c.form_values %}
+ {% if request.validation.values %}
+ {% if 'features-' ~ i ~ '.feature' in request.validation.values %}
{% set ctx = widget.context_for(i) %}
- {% do ctx.update({'value': {'feature':
c.form_values.get('features-' ~ i ~ '.feature')} }) %}
+ {% do ctx.update({'value': {'feature':
request.validation.values.get('features-' ~ i ~ '.feature')} }) %}
{{ widget.field.display(css_class=field_cls, **ctx) }}
{% endif %}
{% else %}
@@ -40,7 +40,7 @@
{% endif %}
{% endfor %}
{% if extra_field_on_focus_name %}
- {% if not c.form_values %}
+ {% if not request.validation.values %}
{% set ctx = widget.context_for(repetitions) %}
{{ widget.field.display(css_class=field_cls, **ctx) }}
{% endif %}
diff --git
a/Allura/allura/templates_responsive/override/allura/ext/admin/templates/admin_widgets/metadata_admin.html
b/Allura/allura/templates_responsive/override/allura/ext/admin/templates/admin_widgets/metadata_admin.html
index 68ac3c213..eeec119db 100644
---
a/Allura/allura/templates_responsive/override/allura/ext/admin/templates/admin_widgets/metadata_admin.html
+++
b/Allura/allura/templates_responsive/override/allura/ext/admin/templates/admin_widgets/metadata_admin.html
@@ -64,8 +64,8 @@
{% if tg.config.get('support_tool_choices') %}
<div class="support-page-fields new-visual-group">
Preferred Support Page (for users of your project):<br>
- {% if c.form_errors.get('support_page_url') %}
- <div
class="error">{{c.form_errors.get('support_page_url')}}</div>
+ {% if request.validation.errors.get('support_page_url') %}
+ <div
class="error">{{request.validation.errors.get('support_page_url')}}</div>
{% endif %}
<input name="support_page" type="radio" value=""{% if
value.support_page == '' %} checked{% endif %} id="support_page_none">
@@ -147,8 +147,8 @@
{% set proj_text = 'Project' if value.is_root else 'Subproject' %}
{{proj_text}} Status:
<div>
- {% if c.form_errors.get('moved_to_url') %}
- <div class="error">{{c.form_errors.get('moved_to_url')}}</div>
+ {% if request.validation.errors.get('moved_to_url') %}
+ <div
class="error">{{request.validation.errors.get('moved_to_url')}}</div>
{% endif %}
<input name="removal" type="radio" value="" id="removal_active_cb"
{% if value.removal == '' %} checked{% endif %}>
diff --git a/Allura/allura/webhooks.py b/Allura/allura/webhooks.py
index 1ca1e4381..246f481ff 100644
--- a/Allura/allura/webhooks.py
+++ b/Allura/allura/webhooks.py
@@ -128,9 +128,9 @@ class WebhookController(BaseController,
AdminControllerMixin, metaclass=WebhookC
@with_trailing_slash
@expose('jinja:allura:templates/webhooks/create_form.html')
def index(self, **kw):
- if not c.form_values and kw:
+ if not request.validation.values and kw:
# Executes if update_webhook raises an error
- c.form_values = {'url': kw.get('url'),
+ request.validation.values = {'url': kw.get('url'),
'secret': kw.get('secret')}
return {'sender': self.sender,
'action': 'create',
@@ -148,7 +148,7 @@ class WebhookController(BaseController,
AdminControllerMixin, metaclass=WebhookC
self.update_webhook(webhook, url, secret)
except Invalid as e:
# trigger error_handler directly
- c.form_errors['_the_form'] = e
+ request.validation.errors['_the_form'] = e
return self.index(url=url, secret=secret)
M.AuditLog.log('add webhook %s %s %s',
@@ -170,7 +170,7 @@ class WebhookController(BaseController,
AdminControllerMixin, metaclass=WebhookC
self.update_webhook(webhook, url, secret)
except Invalid as e:
# trigger error_handler directly
- c.form_errors['_the_form'] = e
+ request.validation.errors['_the_form'] = e
return self._default(webhook=webhook, url=url, secret=secret)
M.AuditLog.log('edit webhook %s\n%s => %s\n%s',
webhook.type, old_url, url,
@@ -199,7 +199,7 @@ class WebhookController(BaseController,
AdminControllerMixin, metaclass=WebhookC
wh = form.fields['webhook'].to_python(webhook)
except Invalid:
raise exc.HTTPNotFound()
- c.form_values = {'url': kw.get('url') or wh.hook_url,
+ request.validation.values = {'url': kw.get('url') or wh.hook_url,
'secret': kw.get('secret') or wh.secret,
'webhook': str(wh._id)}
return {'sender': self.sender,
diff --git a/ForgeImporters/forgeimporters/base.py
b/ForgeImporters/forgeimporters/base.py
index 4cdf67dba..1491ee969 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -324,7 +324,7 @@ class ProjectImporter(BaseController):
Ajax form validation.
"""
- return c.form_errors
+ return request.validation.errors
def after_project_create(self, project, **kw):
"""
diff --git a/ForgeImporters/forgeimporters/github/templates/code/index.html
b/ForgeImporters/forgeimporters/github/templates/code/index.html
index e65906196..7fb3efa48 100644
--- a/ForgeImporters/forgeimporters/github/templates/code/index.html
+++ b/ForgeImporters/forgeimporters/github/templates/code/index.html
@@ -25,12 +25,12 @@
{% block importer_fields %}
<div>
<label for="gh_user_name">GitHub User Name</label>
- <input name="gh_user_name" value="{{ c.form_values['gh_user_name'] }}" />
+ <input name="gh_user_name" value="{{
request.validation.values['gh_user_name'] }}" />
{{ error('gh_user_name') }}
</div>
<div>
<label for="gh_project_name">GitHub Project Name</label>
- <input name="gh_project_name" value="{{ c.form_values['gh_project_name'] }}"
/>
+ <input name="gh_project_name" value="{{
request.validation.values['gh_project_name'] }}" />
{{ error('gh_project_name') }}
</div>
diff --git a/ForgeImporters/forgeimporters/github/templates/project.html
b/ForgeImporters/forgeimporters/github/templates/project.html
index 5c957f0a0..a50067efb 100644
--- a/ForgeImporters/forgeimporters/github/templates/project.html
+++ b/ForgeImporters/forgeimporters/github/templates/project.html
@@ -29,9 +29,9 @@
</label>
</div>
<div class="grid-10">
- <input id="project_url" name="project_url"
value="{{c.form_values['project_url']}}" />
- <div id="project_url_error" class="error{% if not
c.form_errors['project_url'] %} hidden{% endif %}">
- {{c.form_errors['project_url']}}
+ <input id="project_url" name="project_url"
value="{{request.validation.values['project_url']}}" />
+ <div id="project_url_error" class="error{% if not
request.validation.errors['project_url'] %} hidden{% endif %}">
+ {{request.validation.errors['project_url']}}
</div>
</div>
<div class="grid-10 field-divider">
@@ -47,9 +47,9 @@
</label>
</div>
<div class="grid-10">
- <input id="user_name" name="user_name"
value="{{c.form_values['user_name']}}" autofocus/>
- <div id="user_name_error" class="error{% if not
c.form_errors['user_name'] %} hidden{% endif %}">
- {{c.form_errors['user_name']}}
+ <input id="user_name" name="user_name"
value="{{request.validation.values['user_name']}}" autofocus/>
+ <div id="user_name_error" class="error{% if not
request.validation.errors['user_name'] %} hidden{% endif %}">
+ {{request.validation.errors['user_name']}}
</div>
</div>
@@ -64,9 +64,9 @@
</div>
<div class="grid-10">
- <input id="project_name" name="project_name"
value="{{c.form_values['project_name']}}" />
- <div id="project_name_error" class="error{% if not
c.form_errors['project_name'] %} hidden{% endif %}">
- {{c.form_errors['project_name']}}
+ <input id="project_name" name="project_name"
value="{{request.validation.values['project_name']}}" />
+ <div id="project_name_error" class="error{% if not
request.validation.errors['project_name'] %} hidden{% endif %}">
+ {{request.validation.errors['project_name']}}
</div>
</div>
@@ -83,12 +83,12 @@
</label>
</div>
<div class="grid-10">
- <input id="project_shortname" name="project_shortname"
value="{{c.form_values['project_shortname']}}"/>
- <div id="project_shortname_error" class="error{% if not
c.form_errors['project_shortname'] %} hidden{% endif %}">
- {{c.form_errors['project_shortname']}}
+ <input id="project_shortname" name="project_shortname"
value="{{request.validation.values['project_shortname']}}"/>
+ <div id="project_shortname_error" class="error{% if not
request.validation.errors['project_shortname'] %} hidden{% endif %}">
+ {{request.validation.errors['project_shortname']}}
</div>
<div id="project-url">
-
http://{{request.environ['HTTP_HOST']}}{{importer.neighborhood.url()}}<span
id="url-fragment">{{c.form_values['project_shortname']}}</span>
+
http://{{request.environ['HTTP_HOST']}}{{importer.neighborhood.url()}}<span
id="url-fragment">{{request.validation.values['project_shortname']}}</span>
</div>
</div>
<script>
diff --git a/ForgeImporters/forgeimporters/github/templates/tracker/index.html
b/ForgeImporters/forgeimporters/github/templates/tracker/index.html
index 653662850..1e41cf9bb 100644
--- a/ForgeImporters/forgeimporters/github/templates/tracker/index.html
+++ b/ForgeImporters/forgeimporters/github/templates/tracker/index.html
@@ -25,12 +25,12 @@
{% block importer_fields %}
<div>
<label for="gh_user_name">GitHub User Name</label>
- <input name="gh_user_name" value="{{ c.form_values['gh_user_name'] }}" />
+ <input name="gh_user_name" value="{{
request.validation.values['gh_user_name'] }}" />
{{ error('gh_user_name') }}
</div>
<div>
<label for="gh_project_name">GitHub Project Name</label>
- <input name="gh_project_name" value="{{ c.form_values['gh_project_name'] }}"
/>
+ <input name="gh_project_name" value="{{
request.validation.values['gh_project_name'] }}" />
{{ error('gh_project_name') }}
</div>
{% endblock %}
diff --git a/ForgeImporters/forgeimporters/github/templates/wiki/index.html
b/ForgeImporters/forgeimporters/github/templates/wiki/index.html
index b372c4937..d5e433e97 100644
--- a/ForgeImporters/forgeimporters/github/templates/wiki/index.html
+++ b/ForgeImporters/forgeimporters/github/templates/wiki/index.html
@@ -25,17 +25,17 @@
{% block importer_fields %}
<div>
<label for="gh_user_name">GitHub User Name</label>
- <input name="gh_user_name" value="{{ c.form_values['gh_user_name'] }}" />
+ <input name="gh_user_name" value="{{
request.validation.values['gh_user_name'] }}" />
{{ error('gh_user_name') }}
</div>
<div>
<label for="gh_project_name">GitHub Project Name</label>
- <input name="gh_project_name" value="{{ c.form_values['gh_project_name'] }}"
/>
+ <input name="gh_project_name" value="{{
request.validation.values['gh_project_name'] }}" />
{{ error('gh_project_name') }}
</div>
<div>
<label for="import_history">Import wiki history</label>
- <input id="import_history" name="tool_option" value="import_history"
type="checkbox" {% if c.form_values['tool_option'] == 'import_history' %}
checked="checked"{% endif %}/>
+ <input id="import_history" name="tool_option" value="import_history"
type="checkbox" {% if request.validation.values['tool_option'] ==
'import_history' %} checked="checked"{% endif %}/>
{{ error('tool_option') }}
</div>
{% endblock %}
diff --git a/ForgeImporters/forgeimporters/templates/importer_base.html
b/ForgeImporters/forgeimporters/templates/importer_base.html
index cec519517..9bacf58d1 100644
--- a/ForgeImporters/forgeimporters/templates/importer_base.html
+++ b/ForgeImporters/forgeimporters/templates/importer_base.html
@@ -62,8 +62,8 @@
{% endblock %}
{%- macro error(field_name) %}
- {% if c.form_errors[field_name] %}
- <div class="error">{{c.form_errors[field_name]}}</div>
+ {% if request.validation.errors[field_name] %}
+ <div class="error">{{request.validation.errors[field_name]}}</div>
{% endif %}
{%- endmacro %}
@@ -74,12 +74,12 @@
{% if not show_mount_fields is defined or show_mount_fields %}
<div>
<label for="mount_label">Label</label>
- <input name="mount_label" value="{{ c.form_values['mount_label'] or
target_app.default_mount_label }}" />
+ <input name="mount_label" value="{{
request.validation.values['mount_label'] or target_app.default_mount_label }}"
/>
{{ error('mount_label') }}
</div>
<div>
<label for="mount_point">Mount Point</label>
- <input name="mount_point" value="{{ c.form_values['mount_point'] or
target_app.default_mount_point }}" />
+ <input name="mount_point" value="{{
request.validation.values['mount_point'] or target_app.default_mount_point }}"
/>
{{ error('mount_point') }}
</div>
{% endif %}
diff --git a/ForgeImporters/forgeimporters/templates/project_base.html
b/ForgeImporters/forgeimporters/templates/project_base.html
index 640e66a1c..40bc5d2d4 100644
--- a/ForgeImporters/forgeimporters/templates/project_base.html
+++ b/ForgeImporters/forgeimporters/templates/project_base.html
@@ -91,9 +91,9 @@
<label>Project Name</label>
</div>
<div class="grid-10">
- <input id="project_name" name="project_name"
value="{{c.form_values['project_name']}}"/>
- <div id="project_name_error" class="error{% if not
c.form_errors['project_name'] %} hidden{% endif %}">
- {{c.form_errors['project_name']}}
+ <input id="project_name" name="project_name"
value="{{request.validation.values['project_name']}}"/>
+ <div id="project_name_error" class="error{% if not
request.validation.errors['project_name'] %} hidden{% endif %}">
+ {{request.validation.errors['project_name']}}
</div>
</div>
@@ -101,31 +101,31 @@
<label>{{config.site_name}} URL Name</label>
</div>
<div class="grid-10">
- <input id="project_shortname" name="project_shortname"
value="{{c.form_values['project_shortname']}}"/>
- <div id="project_shortname_error" class="error{% if not
c.form_errors['project_shortname'] %} hidden{% endif %}">
- {{c.form_errors['project_shortname']}}
+ <input id="project_shortname" name="project_shortname"
value="{{request.validation.values['project_shortname']}}"/>
+ <div id="project_shortname_error" class="error{% if not
request.validation.errors['project_shortname'] %} hidden{% endif %}">
+ {{request.validation.errors['project_shortname']}}
</div>
<div id="project-url">
-
http://{{request.environ['HTTP_HOST']}}{{importer.neighborhood.url()}}<span
id="url-fragment">{{c.form_values['project_shortname']}}</span>
+
http://{{request.environ['HTTP_HOST']}}{{importer.neighborhood.url()}}<span
id="url-fragment">{{request.validation.values['project_shortname']}}</span>
</div>
</div>
{% endblock %}
</fieldset>
<div id="tool-fields">
- {% if c.form_errors['tools'] %}
- <div class="error">{{c.form_errors['tools']}}</div>
+ {% if request.validation.errors['tools'] %}
+ <div class="error">{{request.validation.errors['tools']}}</div>
{% endif %}
{% for name, tool_importer in importer.tool_importers.items() %}
<div class="tool">
<img src="{{ tool_importer.tool_icon(g.theme, 48) }}" alt="{{
tool_importer.tool_label }} icon">
<label>
- <input name="tools" value="{{name}}" type="checkbox"{% if not
c.form_errors or name in c.form_values['tools'] %} checked="checked"{% endif
%}/>
+ <input name="tools" value="{{name}}" type="checkbox"{% if not
request.validation.errors or name in request.validation.values['tools'] %}
checked="checked"{% endif %}/>
{{tool_importer.tool_label}}
</label>
{% for option_name, option_label in
tool_importer.tool_option.items() %}
<label>
- <input name="tool_option" value="{{option_name}}"
type="checkbox"{% if not c.form_errors or name in c.form_values['tool_option']
%} checked="checked"{% endif %}/>
+ <input name="tool_option" value="{{option_name}}"
type="checkbox"{% if not request.validation.errors or name in
request.validation.values['tool_option'] %} checked="checked"{% endif %}/>
{{option_label}}
</label>
{% endfor %}
diff --git a/ForgeImporters/forgeimporters/trac/templates/project.html
b/ForgeImporters/forgeimporters/trac/templates/project.html
index a9af7341b..eee2b06ae 100644
--- a/ForgeImporters/forgeimporters/trac/templates/project.html
+++ b/ForgeImporters/forgeimporters/trac/templates/project.html
@@ -23,9 +23,9 @@
<label>Trac URL</label>
</div>
<div class="grid-10">
- <input id="trac_url" name="trac_url"
value="{{c.form_values['trac_url']}}" autofocus/>
- <div id="trac_url_error" class="error{% if not
c.form_errors['trac_url'] %} hidden{% endif %}">
- {{c.form_errors['trac_url']}}
+ <input id="trac_url" name="trac_url"
value="{{request.validation.values['trac_url']}}" autofocus/>
+ <div id="trac_url_error" class="error{% if not
request.validation.errors['trac_url'] %} hidden{% endif %}">
+ {{request.validation.errors['trac_url']}}
</div>
</div>
@@ -33,10 +33,10 @@
<label>User Map (optional)</label>
</div>
<div class="grid-10">
- <input id="user_map" name="user_map"
value="{{c.form_values['user_map']}}" type="file"/>
+ <input id="user_map" name="user_map"
value="{{request.validation.values['user_map']}}" type="file"/>
<br><small>JSON file mapping Trac usernames to Allura usernames</small>
- <div id="user_map_error" class="error{% if not
c.form_errors['user_map'] %} hidden{% endif %}">
- {{c.form_errors['user_map']}}
+ <div id="user_map_error" class="error{% if not
request.validation.errors['user_map'] %} hidden{% endif %}">
+ {{request.validation.errors['user_map']}}
</div>
</div>
diff --git a/ForgeImporters/forgeimporters/trac/templates/tickets/index.html
b/ForgeImporters/forgeimporters/trac/templates/tickets/index.html
index 42b8a9fc6..9ffd7bf93 100644
--- a/ForgeImporters/forgeimporters/trac/templates/tickets/index.html
+++ b/ForgeImporters/forgeimporters/trac/templates/tickets/index.html
@@ -21,7 +21,7 @@
{% block importer_fields %}
<div>
<label for="trac_url">URL of the Trac instance</label>
- <input name="trac_url" value="{{ c.form_values['trac_url'] }}" />
+ <input name="trac_url" value="{{ request.validation.values['trac_url'] }}
aajdspofijasopdfij" />
{{ error('trac_url') }}
</div>
<div>
diff --git a/ForgeSVN/forgesvn/svn_main.py b/ForgeSVN/forgesvn/svn_main.py
index 4110266cd..4136155ed 100644
--- a/ForgeSVN/forgesvn/svn_main.py
+++ b/ForgeSVN/forgesvn/svn_main.py
@@ -143,7 +143,7 @@ class SVNRepoAdminController(RepoAdminController):
else:
flash("%s is not a valid path for this repository" %
checkout_url, "error")
- if 'external_checkout_url' not in c.form_errors:
+ if 'external_checkout_url' not in request.validation.errors:
if (self.app.config.options.get('external_checkout_url') or '') !=
external_checkout_url:
M.AuditLog.log('{}: set "{}" {} => {}'.format(
self.app.config.options['mount_point'],
"external_checkout_url",
@@ -151,7 +151,7 @@ class SVNRepoAdminController(RepoAdminController):
self.app.config.options.external_checkout_url =
external_checkout_url
flash("External checkout URL successfully changed")
else:
- flash("Invalid external checkout URL: %s" %
c.form_errors['external_checkout_url'], "error")
+ flash("Invalid external checkout URL: %s" %
request.validation.errors['external_checkout_url'], "error")
class SVNImportController(BaseController, AdminControllerMixin):
diff --git a/ForgeShortUrl/forgeshorturl/main.py
b/ForgeShortUrl/forgeshorturl/main.py
index e4d88d331..5163cf5ee 100644
--- a/ForgeShortUrl/forgeshorturl/main.py
+++ b/ForgeShortUrl/forgeshorturl/main.py
@@ -225,11 +225,11 @@ class ShortURLAdminController(DefaultAdminController):
else:
require_access(self.app, 'create')
if request.method == 'POST':
- if c.form_errors:
+ if request.validation.errors:
error_msg = 'Error: '
- for msg in list(c.form_errors):
+ for msg in list(request.validation.errors):
names = {'short_url': 'Short url', 'full_url': 'Full URL'}
- error_msg += f'{names[msg]}: {c.form_errors[msg]} '
+ error_msg += f'{names[msg]}:
{request.validation.errors[msg]} '
flash(error_msg, 'error')
redirect(six.ensure_text(request.referer or '/'))