incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [45/50] git commit: [#4740] ticket:331 Preserve values in custom fields on form errors
Date Fri, 24 May 2013 17:05:21 GMT
[#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 <jetmind2@gmail.com>
Authored: Thu May 23 11:32:56 2013 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@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')


Mime
View raw message