You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2013/05/24 19:05:21 UTC
[45/50] git commit: [#4740] ticket:331 Preserve values in custom
fields on form errors
[#4740] ticket:331 Preserve values in custom fields on form errors
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/257f839d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/257f839d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/257f839d
Branch: refs/heads/db/6255
Commit: 257f839d14305fd73ec118a8da5f99e87e23a292
Parents: 62a27c3
Author: Igor Bondarenko <je...@gmail.com>
Authored: Thu May 23 11:32:56 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Fri May 24 13:09:19 2013 +0000
----------------------------------------------------------------------
ForgeTracker/forgetracker/widgets/ticket_form.py | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/257f839d/ForgeTracker/forgetracker/widgets/ticket_form.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/widgets/ticket_form.py b/ForgeTracker/forgetracker/widgets/ticket_form.py
index 5e3b61b..3a00389 100644
--- a/ForgeTracker/forgetracker/widgets/ticket_form.py
+++ b/ForgeTracker/forgetracker/widgets/ticket_form.py
@@ -33,6 +33,12 @@ class TicketCustomFields(ew.CompoundField):
def __init__(self, *args, **kwargs):
super(TicketCustomFields, self).__init__(*args, **kwargs)
self._fields = None
+ self._custom_fields_values = {}
+
+ def context_for(self, field):
+ response = super(TicketCustomFields, self).context_for(field)
+ response['value'] = self._custom_fields_values.get(field.name)
+ return response
@property
def fields(self):
@@ -59,6 +65,7 @@ class GenericTicketForm(ew.SimpleForm):
if idx == 'assigned_to':
self._add_current_value_to_user_field(field, ctx.get('value'))
elif idx == 'custom_fields':
+ field._custom_fields_values = ctx.get('value') or {}
for cf in c.app.globals.custom_fields:
if cf and cf.type == 'user':
val = ctx.get('value')