Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 9017 invoked from network); 5 Jul 2007 18:16:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Jul 2007 18:16:32 -0000 Received: (qmail 32035 invoked by uid 500); 5 Jul 2007 16:27:14 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 31967 invoked by uid 500); 5 Jul 2007 16:27:14 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 31955 invoked by uid 99); 5 Jul 2007 16:27:14 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jul 2007 09:27:14 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [216.86.168.179] (HELO mxout-04.mxes.net) (216.86.168.179) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jul 2007 09:27:08 -0700 Received: from [192.168.0.129] (unknown [80.240.191.89]) by smtp.mxes.net (Postfix) with ESMTP id 91FB6A32B1 for ; Thu, 5 Jul 2007 12:26:47 -0400 (EDT) Message-ID: <468D1BBF.3010201@apache.org> Date: Thu, 05 Jul 2007 18:26:39 +0200 From: Grzegorz Kossakowski User-Agent: Thunderbird 2.0.0.4 (X11/20070604) MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: Clarification on converter concept References: <468AA7E9.7020902@tuffmail.com> <468BCB1B.3050907@nada.kth.se> <468C259F.60306@apache.org> <468CFCDD.4030301@nada.kth.se> In-Reply-To: <468CFCDD.4030301@nada.kth.se> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Daniel Fagerstrom pisze: > Grzegorz Kossakowski skrev: >> Daniel Fagerstrom pisze: > ... >> Yes, but I really didn't get the idea fully. Now I think that it may >> be just a lack of use cases for converter. Would you be so kind to >> provide some examples how it could work in particular cases and how it >> would be helpful for Cocoon developer? >> >> Sometimes abstract explanations hide the basic idea, actually. > Didn't my examples from CForms and CTemplate below help you? I had a feeling that there is much more besides Date/Number/Currency formatting but now I think that I was suffering from over-generalization problem. The converter concept is that simple how you describe it but it's not wrong because it solves very concrete problem. Now I think that I fully get the idea and we can focus on discussing how to implement it. > Anyway, say that you have a couple of dates in your model bean that you > would like to render on a web page using CTemplate. Then you currently > would need to write something like (haven't checked the details): > > locale="${cocoon.request.locale}"> > > for each date. That is of course quite OK to write, but it clearly > clutters the code, and it is not that obvious for a non developer. With > converters it would be more like: > > ${myobj.startDate#short} > > and > > ${myobj.startDate} Personally, I prefer ${myboject.startDate}#short syntax because choosing converter should not be part of expression (it would be hard to distinguish where expression part ends and converter name begins in some cases). The syntax would also imply that conversion is performed after obtaining value (object) by evaluating the exception. > Maybe, but in that case you have one way of handling formating for forms > and another way for templates. And you would need two configurations > instead of one. Also from a conceptual standpoint it is better to > separate the rendering part (template) and the model part (form > definition). See my abstract text ;) > http://article.gmane.org/gmane.text.xml.cocoon.devel/42968 for more > about the model-rendering separation. Yes, I understand it now. -- Grzegorz Kossakowski http://reflectingonthevicissitudes.wordpress.com/