On Mon, 2008-12-15 at 06:22 -0800, coulix wrote:
> Hello Djangonauts,
> I have a custom widget to create a kind of group list which ommits the
> last "/" at the end of an input field.
> Making html validation to fail.
>
> The important code is here:
>
>rendered_cb = cb.render(name, option_value)
> print rendered_cb
> output.append(u'%s %s' % (
> option_label,
> rendered_cb,
> option_label)
> )
> ...
>return mark_safe(u'\n'.join(output))
>
> The shell output gives me
> name="competences" />
> >
>
> >
>
>
> Thats all good
>
> But then HTML output after mark_safe takes this input "/" away
This seems to be an enormously large assumption. How have you worked out
that mark_safe() is doing this? A quick glance at the relevant pieces of
source (mark_safe() and the SafeUnicode class) will show it doesn't care
one wit about a slash character.
> Langues
> name="competences" type="checkbox"> Anglais
>
> value="3" name="competences" type="checkbox"> Espagnol
> value="4" name="competences" type="checkbox"> Japonais
The shell output you show doesn't look at all like the final output you
show, so it's not from the same run. I'm cautious about comparing apples
to oranges here. Since you print "rendered_cb" in the above code
fragment, that would be the relevant output to be comparing. Does it
have a trailing slash?
In short, there's information missing here. mark_safe() isn't doing
anything special that would affect this, as far as I know. I think you
need to take a few steps back and compare the output at each stage.
Regards,
Malcolm
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---