This is an automated email from the ASF dual-hosted git repository.
gcruz pushed a commit to branch gc/8499
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/gc/8499 by this push:
new 94b4799dd [#8499] updated syntax to retreive form values from the
request object instead of the template context c.form_values ->
request.validation.values
94b4799dd is described below
commit 94b4799dd8f63e1d86f968615d03be430e3ead40
Author: Guillermo Cruz <[email protected]>
AuthorDate: Mon Feb 13 14:11:13 2023 -0600
[#8499] updated syntax to retreive form values from the request object
instead of the template context c.form_values -> request.validation.values
---
Allura/allura/controllers/site_admin.py | 8 ++++----
Allura/allura/templates/webhooks/create_form.html | 8 ++++----
Allura/allura/templates/widgets/sortable_repeated_field.html | 8 ++++----
Allura/allura/webhooks.py | 6 +++---
ForgeImporters/forgeimporters/github/templates/code/index.html | 4 ++--
ForgeImporters/forgeimporters/github/templates/project.html | 10 +++++-----
.../forgeimporters/github/templates/tracker/index.html | 4 ++--
ForgeImporters/forgeimporters/github/templates/wiki/index.html | 6 +++---
ForgeImporters/forgeimporters/templates/importer_base.html | 4 ++--
ForgeImporters/forgeimporters/templates/project_base.html | 10 +++++-----
ForgeImporters/forgeimporters/trac/templates/project.html | 4 ++--
.../forgeimporters/trac/templates/tickets/index.html | 2 +-
12 files changed, 37 insertions(+), 37 deletions(-)
diff --git a/Allura/allura/controllers/site_admin.py
b/Allura/allura/controllers/site_admin.py
index 0f70f03b2..440c024f0 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -456,7 +456,7 @@ class SiteNotificationController:
"""Render the New SiteNotification form"""
return dict(
form_errors=request.validation.errors or {},
- form_values=c.form_values 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=request.validation.errors or {},
- form_values=c.form_values or {},
+ form_values=request.validation.values or {},
form_title='Edit Site Notification',
form_action='update'
)
@@ -584,7 +584,7 @@ class TaskManagerController:
"""Render the New Task form"""
return dict(
form_errors=request.validation.errors or {},
- form_values=c.form_values or {},
+ form_values=request.validation.values or {},
)
@expose()
diff --git a/Allura/allura/templates/webhooks/create_form.html
b/Allura/allura/templates/webhooks/create_form.html
index 34569b65a..948fc4046 100644
--- a/Allura/allura/templates/webhooks/create_form.html
+++ b/Allura/allura/templates/webhooks/create_form.html
@@ -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/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/webhooks.py b/Allura/allura/webhooks.py
index 10812b364..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',
@@ -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/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 00d00a828..a50067efb 100644
--- a/ForgeImporters/forgeimporters/github/templates/project.html
+++ b/ForgeImporters/forgeimporters/github/templates/project.html
@@ -29,7 +29,7 @@
</label>
</div>
<div class="grid-10">
- <input id="project_url" name="project_url"
value="{{c.form_values['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>
@@ -47,7 +47,7 @@
</label>
</div>
<div class="grid-10">
- <input id="user_name" name="user_name"
value="{{c.form_values['user_name']}}" autofocus/>
+ <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>
@@ -64,7 +64,7 @@
</div>
<div class="grid-10">
- <input id="project_name" name="project_name"
value="{{c.form_values['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>
@@ -83,12 +83,12 @@
</label>
</div>
<div class="grid-10">
- <input id="project_shortname" name="project_shortname"
value="{{c.form_values['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 caf2054e5..9bacf58d1 100644
--- a/ForgeImporters/forgeimporters/templates/importer_base.html
+++ b/ForgeImporters/forgeimporters/templates/importer_base.html
@@ -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 764002694..40bc5d2d4 100644
--- a/ForgeImporters/forgeimporters/templates/project_base.html
+++ b/ForgeImporters/forgeimporters/templates/project_base.html
@@ -91,7 +91,7 @@
<label>Project Name</label>
</div>
<div class="grid-10">
- <input id="project_name" name="project_name"
value="{{c.form_values['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>
@@ -101,12 +101,12 @@
<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']}}"/>
+ <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 %}
@@ -120,12 +120,12 @@
<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
request.validation.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 request.validation.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 14b09e001..eee2b06ae 100644
--- a/ForgeImporters/forgeimporters/trac/templates/project.html
+++ b/ForgeImporters/forgeimporters/trac/templates/project.html
@@ -23,7 +23,7 @@
<label>Trac URL</label>
</div>
<div class="grid-10">
- <input id="trac_url" name="trac_url"
value="{{c.form_values['trac_url']}}" autofocus/>
+ <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>
@@ -33,7 +33,7 @@
<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
request.validation.errors['user_map'] %} hidden{% endif %}">
{{request.validation.errors['user_map']}}
diff --git a/ForgeImporters/forgeimporters/trac/templates/tickets/index.html
b/ForgeImporters/forgeimporters/trac/templates/tickets/index.html
index 42b8a9fc6..ce48e479e 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'] }}"
/>
{{ error('trac_url') }}
</div>
<div>