Adrian Holovaty wrote:
> Hi all,
> 
> The django.newforms library is getting more solid by the day, and I'm
> using it for some personal and work projects. Real-world use has
> helped me find and fix problems with it, and I'm pretty happy with how
> things have turned out.
> 
> So, then, I'd encourage everybody to play around with django.newforms
> and post a message if you have any issues or thoughts.

i tried it out yesterday, and it's very clean and intuitive.

my only worry is regarding the unicode-behavior

i created a simple form, like:

> class UniInput(Form):
>     text = CharField(max_length = 200)

but if i want to render it in a template and it contains non-ascii text, 
it fails in /home/gabor/src/django/django/template/__init__.py,
line 745, UnicodeEncodeError.

the code there calls str() on the form, and it's a problem because it 
calls Form.__str__, which in turn calls as_table, which returns unicode 
data.
which is then converted to bytestring, by the default-charset (ascii),
and that fails.

currently i solved it by sending the form as 
"form.__str__().encode('utf-8')" into the context, but that's not that nice.

one solution would be to special-case Form-object-handling in the 
template-code. currently it handled unicode and bytestrings, maybe it 
could also handle Form instances.

but the real problem imho is that Form.__str__ returns an unicodestring.
the python docs say that "The return value must be a string object." 
which i'm not sure how should be interpreted :)

maybe Form.__str__ could encode the unicode data into a bytestring using 
DEFAULT_CHARSET?

generally, before django is completely converted to unicode, how do you 
plan to integrate the forms (their input and their output) into django?

gabor

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to