Re: htmlfill question

Jonathan Vanasco <[email protected]> Wed, 22 Feb 2012 18:52:11 -0500
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
--===============2895657387242510347==
Content-Type: multipart/alternative; boundary=Apple-Mail-31--539786254


--Apple-Mail-31--539786254
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Thanks Chris.

I knew about being able to specify & pass custom formatters.  I wanted =
to avoid that, and rely on the auto error.  I guess i wanted a clue on =
how to patch formencode.

My issue is with the behavior I illustrated below, which I would =
consider a bug.

One would assume that if you pass in the "auto_error_formatter" =
argument, it would be used for generating ALL errors.  Instead it =
generates errors only for html input type elements, and does not format =
the form:error blocks.

On Feb 5, 2012, at 10:42 AM, Chris Lambacher wrote:

> You should be able to use the formatter attribute to specify a custom =
formatter:
> http://www.formencode.org/en/latest/htmlfill.html#errors:
> <form:error name=3D"field_name" format=3D"formatter">=20
>=20
> You will also need to provide the error_formatters argument to =
renderer if the formatter you want to use is not one of the default =
ones:
> =
http://www.formencode.org/en/latest/modules/htmlfill.html#formencode.htmlf=
ill.render
>=20
> -Chris
>=20
> On Sat, Feb 4, 2012 at 3:11 PM, Jonathan Vanasco <[email protected]> =
wrote:
>=20
> i'm a little confused by htmlfill's behavior on this.
>=20
> Given a form like this:
>     <form:error name=3D"Error_Main"/>
>     <input id=3D"login-email_address" name=3D"email_address" =
placeholder=3D"Email Address" size=3D"30" type=3D"text" />
>     <input id=3D"login-password" name=3D"password" =
placeholder=3D"Password" size=3D"30" type=3D"password" />
>=20
> and a call to htmlfill with this:
>    formencode.htmlfill.render(\
>            form_content,
>            defaults=3Ddefaults,
>            errors=3Derrors,
>            auto_error_formatter=3Dcustom_formatter
>    )
>=20
> My output is essentially this:
>        Error Main -- rendered with default formatter
>        email_address -- rendered with custom formatter
>        password  -- rendered with custom formatter
>=20
> anyone have an idea to get the Error_Main section to render with the =
custom formatter along with the other fields  (aside from specifying a =
custom renderer in the field and passing in a dict )?
> =
--------------------------------------------------------------------------=
----
> Try before you buy =3D See our experts in action!
> The most comprehensive online learning library for Microsoft =
developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, =
MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> FormEncode-discuss mailing list
> FormEncode-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/formencode-discuss
>=20
>=20
>=20
> --=20
> Christopher Lambacher
> [email protected]

// Jonathan Vanasco

c. 646.729.6436  |  415.501.9815
e. [email protected]
w. http://findmeon.com/user/jvanasco=20
linkedin. http://linkedin.com/in/jonathanvanasco
blog. http://destructuring.net


--Apple-Mail-31--539786254
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space; =
">Thanks Chris.<div><br></div><div>I knew about being able to specify =
&amp; pass custom formatters. &nbsp;I wanted to avoid that, and rely on =
the auto error. &nbsp;I guess i wanted a clue on how to patch =
formencode.</div><div><br></div><div>My issue is with the behavior I =
illustrated below, which I would consider a =
bug.</div><div><br></div><div>One would assume that if you pass in the =
"auto_error_formatter" argument, it would be used for generating ALL =
errors. &nbsp;Instead it generates errors only for html input type =
elements, and does not format the form:error =
blocks.</div><div><br></div><div><div><div>On Feb 5, 2012, at 10:42 AM, =
Chris Lambacher wrote:</div><br =
class=3D"Apple-interchange-newline"><blockquote type=3D"cite">You should =
be able to use the formatter attribute to specify a custom =
formatter:<div><span class=3D"pre" =
style=3D"color:rgb(68,68,68);font-family:Consolas,'Deja Vu Sans =
Mono','Bitstream Vera Sans =
Mono',monospace;font-size:15px;line-height:22px;text-align:left;background=
-color:rgb(242,242,242)"><a =
href=3D"http://www.formencode.org/en/latest/htmlfill.html#errors">http://w=
ww.formencode.org/en/latest/htmlfill.html#errors</a>:</span></div>
<div><span class=3D"pre" =
style=3D"color:rgb(68,68,68);font-family:Consolas,'Deja Vu Sans =
Mono','Bitstream Vera Sans =
Mono',monospace;font-size:15px;line-height:22px;text-align:left;background=
-color:rgb(242,242,242)">&lt;form:error</span><span =
style=3D"color:rgb(68,68,68);font-family:Consolas,'Deja Vu Sans =
Mono','Bitstream Vera Sans =
Mono',monospace;font-size:15px;line-height:22px;text-align:left;background=
-color:rgb(242,242,242)">&nbsp;</span><span class=3D"pre" =
style=3D"color:rgb(68,68,68);font-family:Consolas,'Deja Vu Sans =
Mono','Bitstream Vera Sans =
Mono',monospace;font-size:15px;line-height:22px;text-align:left;background=
-color:rgb(242,242,242)">name=3D"field_name"</span><span =
style=3D"color:rgb(68,68,68);font-family:Consolas,'Deja Vu Sans =
Mono','Bitstream Vera Sans =
Mono',monospace;font-size:15px;line-height:22px;text-align:left;background=
-color:rgb(242,242,242)">&nbsp;</span><span class=3D"pre" =
style=3D"color:rgb(68,68,68);font-family:Consolas,'Deja Vu Sans =
Mono','Bitstream Vera Sans =
Mono',monospace;font-size:15px;line-height:22px;text-align:left;background=
-color:rgb(242,242,242)">format=3D"formatter"&gt;</span>&nbsp;</div>
<div><br></div><div>You will also need to provide the error_formatters =
argument to renderer if the formatter you want to use is not one of the =
default ones:</div><div><a =
href=3D"http://www.formencode.org/en/latest/modules/htmlfill.html#formenco=
de.htmlfill.render">http://www.formencode.org/en/latest/modules/htmlfill.h=
tml#formencode.htmlfill.render</a>
</div><div><br>-Chris</div><div><br><div class=3D"gmail_quote">On Sat, =
Feb 4, 2012 at 3:11 PM, Jonathan Vanasco <span dir=3D"ltr">&lt;<a =
href=3D"mailto:[email protected]">[email protected]</a>&gt;</span> =
wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; =
border-left-width: 1px; border-left-color: rgb(204, 204, 204); =
border-left-style: solid; padding-left: 1ex; position: static; z-index: =
auto; ">
<br>
i'm a little confused by htmlfill's behavior on this.<br>
<br>
Given a form like this:<br>
 &nbsp; &nbsp; &lt;form:error name=3D"Error_Main"/&gt;<br>
 &nbsp; &nbsp; &lt;input id=3D"login-email_address" name=3D"email_address"=
 placeholder=3D"Email Address" size=3D"30" type=3D"text" /&gt;<br>
 &nbsp; &nbsp; &lt;input id=3D"login-password" name=3D"password" =
placeholder=3D"Password" size=3D"30" type=3D"password" /&gt;<br>
<br>
and a call to htmlfill with this:<br>
 &nbsp; &nbsp;formencode.htmlfill.render(\<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;form_content,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;defaults=3Ddefaults,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;errors=3Derrors,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;auto_error_formatter=3Dcustom_formatter<br>
 &nbsp; &nbsp;)<br>
<br>
My output is essentially this:<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Error Main -- rendered with default =
formatter<br>
 &nbsp; &nbsp; &nbsp; &nbsp;email_address -- rendered with custom =
formatter<br>
 &nbsp; &nbsp; &nbsp; &nbsp;password &nbsp;-- rendered with custom =
formatter<br>
<br>
anyone have an idea to get the Error_Main section to render with the =
custom formatter along with the other fields &nbsp;(aside from =
specifying a custom renderer in the field and passing in a dict )?<br>
=
--------------------------------------------------------------------------=
----<br>
Try before you buy =3D See our experts in action!<br>
The most comprehensive online learning library for Microsoft =
developers<br>
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, =
MVC3,<br>
Metro Style Apps, more. Free future releases when you subscribe now!<br>
<a href=3D"http://p.sf.net/sfu/learndevnow-dev2" =
target=3D"_blank">http://p.sf.net/sfu/learndevnow-dev2</a><br>
_______________________________________________<br>
FormEncode-discuss mailing list<br>
<a =
href=3D"mailto:FormEncode-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org">FormEncode-discus=
[email protected]</a><br>
<a =
href=3D"https://lists.sourceforge.net/lists/listinfo/formencode-discuss" =
target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/formencode-=
discuss</a><br>
</blockquote></div><br><br clear=3D"all"><div><br></div>-- =
<br>Christopher Lambacher<br><a =
href=3D"mailto:[email protected]">[email protected]</a><br>
</div>
</blockquote></div><br><div>
<span class=3D"Apple-style-span" style=3D"border-collapse: separate; =
color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; =
font-variant: normal; font-weight: normal; letter-spacing: normal; =
line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: =
0px; text-transform: none; white-space: normal; widows: 2; word-spacing: =
0px; -webkit-border-horizontal-spacing: 0px; =
-webkit-border-vertical-spacing: 0px; =
-webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span =
class=3D"Apple-style-span" style=3D"border-collapse: separate; color: =
rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: =
normal; font-weight: normal; letter-spacing: normal; line-height: =
normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; =
text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =
0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
-webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
Helvetica; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; orphans: 2; =
text-align: -webkit-auto; text-indent: 0px; text-transform: none; =
white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =
0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
-webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
style=3D"orphans: 2; text-indent: 0px; widows: 2; =
-webkit-text-decorations-in-effect: none; "><div style=3D"word-wrap: =
break-word; -webkit-nbsp-mode: space; -webkit-line-break: =
after-white-space; "><span class=3D"Apple-style-span" style=3D"orphans: =
2; text-indent: 0px; widows: 2; -webkit-text-decorations-in-effect: =
none; "><div style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
-webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
style=3D"orphans: 2; text-indent: 0px; widows: 2; =
-webkit-text-decorations-in-effect: none; "><div style=3D"word-wrap: =
break-word; -webkit-nbsp-mode: space; -webkit-line-break: =
after-white-space; "><div><div>// Jonathan =
Vanasco</div><div><br></div><div>c. 646.729.6436 &nbsp;| =
&nbsp;415.501.9815</div><div>e. <a =
href=3D"mailto:[email protected]">[email protected]</a></div><div>w. <a =
href=3D"http://findmeon.com/user/jvanasco">http://findmeon.com/user/jvanas=
co</a>&nbsp;</div><div>linkedin. <a =
href=3D"http://linkedin.com/in/jonathanvanasco">http://linkedin.com/in/jon=
athanvanasco</a></div><div>blog. <a =
href=3D"http://destructuring.net">http://destructuring.net</a></div></div>=
</div></span></div></span></div></span></div></span></div></span></span>
</div>
<br></div></body></html>=

--Apple-Mail-31--539786254--


--===============2895657387242510347==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
--===============2895657387242510347==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
FormEncode-discuss mailing list
FormEncode-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/formencode-discuss

--===============2895657387242510347==--