Hi

On Apr 30, 6:54 pm, Bill Freeman <ke1g...@gmail.com> wrote:
> 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?

Actually my mistake here. The stuff that went into database via
tinymce was with &otilde;'s and so on.

The Grill P\xc3\xb5rsas Meremeeste moodi from pastebin page is name of
one Retsept and is in database like this:Grill Põrsas Meremeeste
moodi.

Retsept model was this:
lass Retsept(models.Model):
        name = models.CharField(max_length=100,
verbose_name=_("Name"), blank=False, null=False)
        user = models.ForeignKey(User)
        image = RemovableImageField(upload_to=content_file_name,
blank=True, null=True, verbose_name=_("Image"))
        about = tinymce_models.HTMLField(verbose_name=_("Enter the
description of the food"),blank=False, null=False)
        rating = models.DecimalField(max_digits=4, decimal_places=2,
default=0)
        views = models.PositiveIntegerField(default=0)
        tags = TagField()
        published = models.BooleanField(default=False)
        visible = models.BooleanField(default=True)
        def __unicode__(self):
                return self.name

and form, that saves it was this:
class RetseptForm(ModelForm):
        about = forms.CharField(widget=TinyMCE(attrs={'style': 'width:
370px', 'rows': 15, 'theme':"simple"}), label = _("text here"),
required=False)
        tags = TagField(label = _("tags"),
widget=TagAutocomplete(attrs={'class':'required'}))
        name = forms.CharField(label = _("Name"),
widget=forms.TextInput(attrs={'class':'required'}))
        class Meta:
                model = Retsept
                fields = ('name', 'about', 'image', 'tags',)
                widgets = {
                        'name': TextInput(attrs={'class':
'required' })
                }
>
> 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/ad 
> min_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".

Yep, you were correct.

>
> If you're comfortable driving pdb,

Nope, i guess, since i know what pdb stands for :P I ran a google
search and now i know what you were talking about

> 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()

Im having trouble figuring out where i should put this pdb stuff. I
downloaded last trunk of django 1.2beta and my admin_list.py is
somewhat different than the one you have. lines 180, 181 there are :

    if form:
        yield mark_safe(u'<td>%s</td>' %
force_unicode(form[cl.model._meta.pk.name]))

I can find the lines you mention in the old django, but stuff in new
admin_list.py is :
            else:
                if value is None:
                    result_repr = EMPTY_CHANGELIST_VALUE
                if isinstance(f.rel, models.ManyToOneRel):
                    result_repr = escape(getattr(result, f.name))
                else:
                    result_repr = display_for_field(value, f)
                if isinstance(f, models.DateField) or isinstance(f,
models.TimeField):
                    row_class = ' class="nowrap"'

So i guess i should enter your lines after  if isinstance(f.rel,
models.ManyToOneRel): ?

>
> You are, I'm assuming, using manage.py runserver.  

Nope, im using mod_wsgi, but in order to test what you suggest i could
use it.

> 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

-- 
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