Just to be clear, the entity coding exists in the database?  It's a unicode
or byte string containing sequences beginning with ampersand, ending
with semi colon, having just lowercase English letters between them?

Because, if so, by the time it gets to items_for_result() (I think) in
/usr/local/lib/python2.6/dist-packages/django/contrib/admin/templatetags/admin_list.py
those entities have been converted to UTF-8 encodings of Unicode code points.
If my decoding is correct, that sequence "\xc3\xb5" translates to 0x00F5, which
is "latin small letter o with tilde".

If you're comfortable driving pdb, I'd like to know what you find if you place a
conditional breakpoint in that function and poke around.  I presume that you
know the attribute name of the field containing that data.  I'll use
'foo' below,
replace it with the actual attribute name.   Between these two lines:

                if field_val is not None:
                    result_repr = escape(getattr(result, f.name))

(lines 180 and 181 in the version of the file I have handy) put:

                    if f.attname == 'foo':
                        import pdb; pdb.set_trace()

You are, I'm assuming, using manage.py runserver.  It will restart when you
save the file, or if not, kill it and restart it.  Then refresh the page in the
browser.  That should make pdb come up on the terminal where you started
the server.  Then try the following command:

p getattr(result, f.name)

Do you get the entities?  If so, we need to look down in escape.  If you get
the UTF-8 encodings, then we need to look higher up the stack.

result should be one of your Vote object instances.  You might do a by hand
query for this on in manage.py shell (using id__exact as a selector, perhaps)
and see if the value is bad there.  If bad, the problem looks to be in the ORM.

I can't tell more from the stacktrace, since the relevant variable values are
objects, and the strings are inside them and not displayed in the
frame varables.

And, of course, I can't easily reproduce this, so you may be on your own to
debug this.

Bill

On Fri, Apr 30, 2010 at 2:50 AM, zayatzz <alan.kesselm...@gmail.com> wrote:
> I dont use any cms. I use few third party plugins like django-tinymce,
> sorl-thumbnail, django-tagging and django-tagging-autocomplete and
> thats it.
>
> I checked how the stuff is stored in the database and its exactly the
> same html it prints out on the pages. Letters like äöõü are all &auml;
> &ouml; &otilde; &uuml; in the database. No idea if this is relevant
> info to you... :P
>
> Alan
>
> On Apr 30, 1:22 am, Bill Freeman <ke1g...@gmail.com> wrote:
>> I don't have time to look in detail right now, but if you're using
>> pages cms, try
>> putting:
>>
>> PAGE_SANITIZE_USER_INPUT = False
>>
>> in your settings.py (after or in place of anywhere you set it True).
>> The last time
>> I got this it was due to a bug in the sanitize stuff in that it
>> converted perfectly
>> valid unicode into a UTF-8 bytestring and left that as the value to render, 
>> so
>> when you call unicode on it, the default codec being 'ascii', it blows
>> up if there
>> was anything requiring extended coding in UTF-8, such as a nbsp (in my case,
>> the entity was being converted by sanitize to the unicode, but in UTF-8.
>>
>> If that turns out to fix your issue, we should do a real fix, which is 
>> simply to
>> decode the return value from sanitize using the 'utf-8' codec, giving us a
>> unicode string, which the safe_unicode function will be happy with.  One of
>> us should produce a patch to send to the pages cms folks.
>>
>> Bill
>>
>>
>>
>> On Thu, Apr 29, 2010 at 3:28 PM, zayatzz <alan.kesselm...@gmail.com> wrote:
>> > Buh... took me a while to get around to do it. After first installing
>> > the django trunk it revealed another problem first though. Not sure if
>> > this can be the cause or not?
>>
>> > The problem was django tinymce import error. In django tinymce widgets
>> > line 14 there was
>> >      from django.forms.util import smart_unicode
>> > But that did not work. I changed it to:
>> >      from django.utils.encoding import smart_unicode
>>
>> > After that i got this error:
>>
>> >http://pastebin.com/QaF6HQbg
>>
>> > Alan
>>
>> > On Apr 16, 4:37 pm, Bill Freeman <ke1g...@gmail.com> wrote:
>> >> I like the idea of getting a full stack trace using python 2.5
>>
>> >> I don't know what you platform is, but at least on linux (and similar 
>> >> systems)
>> >> you can easily install multiple versions of python without causing 
>> >> trouble*.
>> >> You grab the sources, do a make, and then, instead of doing make install,
>> >> you do make altinstall.  Then "python" still refers to your original
>> >> version, but
>> >> your additional version is available as, say "python2.5".  Then use 
>> >> virtualenv
>> >> to make an environment for django tied to python2.5, and do a 
>> >> checkout/clone/
>> >> whatever (assuming that your project is under revision control) of your 
>> >> project
>> >> into the virtual environment (saves trouble with wrong version .pyc
>> >> files).  Activate
>> >> the virutal environment, pip install django and your requirements, and 
>> >> fire up
>> >> manage.py runserver.  The whole process shouldn't take more than an hour
>> >> if you know what you're doing, or a couple of hours if you need to read a 
>> >> bunch
>> >> of documentation.
>>
>> >> [ * I've got 2.4 (for zope/plone), 2.5, 2.6, 2.7, 3.0, and 3.1 on my 
>> >> laptop. ]
>>
>> >> Bill
>>
>> >> On Fri, Apr 16, 2010 at 2:29 AM, zayatzz <alan.kesselm...@gmail.com> 
>> >> wrote:
>> >> > Okay. I will try to test it in the way suggested by Bill and Karen.
>>
>> >> > This will take me some time though. Hopefully you will be able to keep
>> >> > track of this thread even though it will get pushed to later pages
>> >> > when new threads are created.
>>
>> >> > Alan
>>
>> >> > On Apr 15, 10:52 pm, Karen Tracey <kmtra...@gmail.com> wrote:
>> >> >> On Thu, Apr 15, 2010 at 3:48 PM, Bill Freeman <ke1g...@gmail.com> 
>> >> >> wrote:
>> >> >> > Sadly, the problem string doesn't occur at the top level of any of 
>> >> >> > those
>> >> >> > local
>> >> >> > vars.  It was worth a shot.  It's probably in the context.
>>
>> >> >> > If I were you, I'd go find the raise wrapped... in debug.py down at 
>> >> >> > the
>> >> >> > bottom
>> >> >> > of the stack trace, and stick a pdb.set_trace() there.  Then 
>> >> >> > (assuming you
>> >> >> > do this under manage.py runserver) you can poke around to see what 
>> >> >> > was
>> >> >> > being rendered and what's in the context.  The exception being 
>> >> >> > wrapped may
>> >> >> > have useful information that isn't showing in the stacktrace.  If 
>> >> >> > you can
>> >> >> > find
>> >> >> > the actuall line of code that is getting the exception, you may be
>> >> >> > able to figure
>> >> >> > out why it thinks it has to convert something to ascii (which is 
>> >> >> > probably
>> >> >> > the
>> >> >> > default string encoding, use sys.getdefaultencoding() to find out).
>> >> >> >  Probably
>> >> >> > something is applying str() to a unicode object.
>>
>> >> >> > I'm sorry that I can't provide a shortcut.  Perhaps someone else 
>> >> >> > will.
>>
>> >> >> If there is a way to run the app using Python 2.5 instead of 2.6 then 
>> >> >> the
>> >> >> debug information would include the original traceback. Alternatively 
>> >> >> if it
>> >> >> could be run with a recent checkout of either the 1.1.X branch or 
>> >> >> trunk then
>> >> >> the full traceback would appearing, instead of it getting cut off at 
>> >> >> "raise
>> >> >> wrapped".
>>
>> >> >> Karen
>>
>> >> > --
>> >> > You received this message because you are subscribed to the Google 
>> >> > Groups "Django users" group.
>> >> > To post to this group, send email to django-us...@googlegroups.com.
>> >> > To unsubscribe from this group, send email to 
>> >> > django-users+unsubscr...@googlegroups.com.
>> >> > For more options, visit this group 
>> >> > athttp://groups.google.com/group/django-users?hl=en.
>>
>> >> --
>> >> You received this message because you are subscribed to the Google Groups 
>> >> "Django users" group.
>> >> To post to this group, send email to django-us...@googlegroups.com.
>> >> To unsubscribe from this group, send email to 
>> >> django-users+unsubscr...@googlegroups.com.
>> >> For more options, visit this group 
>> >> athttp://groups.google.com/group/django-users?hl=en.
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups 
>> > "Django users" group.
>> > To post to this group, send email to django-us...@googlegroups.com.
>> > To unsubscribe from this group, send email to 
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group 
>> > athttp://groups.google.com/group/django-users?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group 
>> athttp://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.

Reply via email to