Ok, I figured as much.  So I guess I can use some sort of secret
keyword when I want to represent None in an HTML transaction, as
distinct from someone typing in None.

Thanks.

On Feb 15, 10:14 pm, Chris <[EMAIL PROTECTED]> wrote:
> When mako renders the template, it results in just plain old HTML
> (plus js or css etc) - meaning it can't represent an actual Python
> object (None) since HTML has no notion of objects, or python for that
> matter.  So basically, actual objects can't be POSTed or GETed.  You
> have to use strings and interpret/assemble that info correctly on the
> server side.
>
> Pylons can't interpret the u'None' value for you because it is
> ambiguous - did the user type in 'None' and submit, or is this 'None'
> the actual python None.
>
> hth,
> Chris
>
> On Feb 14, 3:53 pm, Eric Ongerth <[EMAIL PROTECTED]> wrote:
>
> > Newbie here, but getting somewhere.  But I just hit this one problem,
> > the straightening out of which will hopefully also cure me of some
> > related misconceptions or poor assumptions.
>
> > In one of my mako templates, I have something like the following.  The
> > trouble I am having is with passing the value None through the form
> > submission.
>
> > <% foo = None %>
>
> > ${h.form_remote_tag(url=h.url(action="DoXYZ", bar=foo), update="abc",
> > method="GET")}
> > ${h.text_field(name="frobnitz")}
> > ${h.submit(value='save', name='commit')}
> > ${h.end_form()}
>
> > <div id="abc"></div>
>
> > ...now when the request reaches the controller:
>
> > bar = request.params['bar']
>
> > ... and at this point, unfortunately the value of bar is u'None' .. a
> > text string rather than the actual python None.
>
> > Why does that happen?  It is easy to write an ugly workaround for it,
> > but instead I'm trying to understand better what's behind it and
> > hopefully my rewritten solution will stay more elegant.
>
> > Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to