Return-Path: X-Original-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C9FB2D616 for ; Fri, 24 May 2013 18:17:43 +0000 (UTC) Received: (qmail 81615 invoked by uid 500); 24 May 2013 18:17:43 -0000 Delivered-To: apmail-incubator-allura-commits-archive@incubator.apache.org Received: (qmail 81538 invoked by uid 500); 24 May 2013 18:17:43 -0000 Mailing-List: contact allura-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: allura-dev@incubator.apache.org Delivered-To: mailing list allura-commits@incubator.apache.org Received: (qmail 80840 invoked by uid 99); 24 May 2013 18:17:39 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 May 2013 18:17:39 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id AD865E7D2; Fri, 24 May 2013 18:17:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: brondsem@apache.org To: allura-commits@incubator.apache.org Date: Fri, 24 May 2013 18:18:20 -0000 Message-Id: <167ad48dba6849a5bcfd51d330a5256f@git.apache.org> In-Reply-To: <0cea9785821d460eaaeebea5e2953970@git.apache.org> References: <0cea9785821d460eaaeebea5e2953970@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [44/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/6007 Commit: 257f839d14305fd73ec118a8da5f99e87e23a292 Parents: 62a27c3 Author: Igor Bondarenko Authored: Thu May 23 11:32:56 2013 +0000 Committer: Tim Van Steenburgh 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')