Re: [Django] #16803: Unicode representation of ContentType instances is not translated

2011-10-09 Thread Django
#16803: Unicode representation of ContentType instances is not translated
-+-
 Reporter:  bronger  |Owner:  isagalaev
 Type:  Bug  |   Status:  closed
Component:   |  Version:  1.3
  contrib.contenttypes   |   Resolution:  fixed
 Severity:  Normal   | Triage Stage:  Accepted
 Keywords:   |  Needs documentation:  0
Has patch:  1|  Patch needs improvement:  1
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-

Comment (by loewis):

 In [16950]:
 {{{
 #!CommitTicketReference repository="" revision="16950"
 Merged revisions
 
16743,16745,16747-16750,16752-16754,16756-16760,16770,16773-16800,16802-16804,16806,16808,16811,16813,16815,16817-16826,16829-16833,16835-16836,16838-16843,16845-16858,16860-16866,16868,16871-16877,16882-16890,16893-16947
 via svnmerge from
 https://code.djangoproject.com/svn/django/trunk

 
   r16743 | gabrielhurley | 2011-09-09 23:36:58 +0200 (Fr, 09 Sep 2011) | 2
 lines

   Fixed #16791 -- Updated a broken URL in the README file. Thanks to
 paulcwatts for the report and patch.
 
   r16745 | Alex | 2011-09-09 23:45:58 +0200 (Fr, 09 Sep 2011) | 1 line

   Switch to using explicit new-style division behavior, rather than
 relying on teh classic behavior.
 
   r16747 | SmileyChris | 2011-09-10 00:32:38 +0200 (Sa, 10 Sep 2011) | 1
 line

   Fix and test for cleaning a non-string value in a URLField
 
   r16748 | gabrielhurley | 2011-09-10 00:33:28 +0200 (Sa, 10 Sep 2011) | 2
 lines

   Fixed #16786 -- Minor cleanups in the memcached section of the caching
 topic guide. Thanks to jamesp for the report and patch.
 
   r16749 | jbronn | 2011-09-10 00:34:23 +0200 (Sa, 10 Sep 2011) | 1 line

   Fixed #16408 -- Fixed conversion of dates, and other problems with the
 SpatiaLite backend.
 
   r16750 | jbronn | 2011-09-10 00:47:18 +0200 (Sa, 10 Sep 2011) | 1 line

   Removed extra call to `syncdb` that slipped in with r16749.
 
   r16752 | SmileyChris | 2011-09-10 00:57:12 +0200 (Sa, 10 Sep 2011) | 1
 line

   Fixes #16664 -- URLField's to_python method fails with ValueError on
 some urls on python 2.7. Based on patch by zigzag.
 
   r16753 | russellm | 2011-09-10 01:02:33 +0200 (Sa, 10 Sep 2011) | 1 line

   Added two pointless query repeats to work around a known issue with
 MySQL that was causing failures in our test suite.
 
   r16754 | gabrielhurley | 2011-09-10 01:25:48 +0200 (Sa, 10 Sep 2011) | 2
 lines

   Fixed #16782 -- Corrected a broken cross-reference to the database
 engine setting in the tutorial. Thanks to mjumbewu for the report and
 patch.
 
   r16756 | kmtracey | 2011-09-10 02:05:48 +0200 (Sa, 10 Sep 2011) | 2
 lines

   Fixed #15722: ensure formsets evaluate to True even if they have no
 forms. Thanks mlavin.
 
   r16757 | jbronn | 2011-09-10 02:29:34 +0200 (Sa, 10 Sep 2011) | 1 line

   Fixed #13670 -- Comparisons with the spatial adapter won't blow up in
 some corner cases.  Thanks, milosu for the bug report and jpaulett for the
 patch.
 
   r16758 | russellm | 2011-09-10 02:46:38 +0200 (Sa, 10 Sep 2011) | 1 line

   Added protection against spoofing of X_FORWARDED_HOST headers. A
 security announcement will be made shortly.
 
   r16759 | russellm | 2011-09-10 02:46:48 +0200 (Sa, 10 Sep 2011) | 1 line

   Corrected an issue which could allow attackers to manipulate session
 data using the cache. A security announcement will be made shortly.
 
   r16760 | russellm | 2011-09-10 02:47:00 +0200 (Sa, 10 Sep 2011) | 1 line

   Altered the behavior of URLField to avoid a potential DOS vector, and to
 avoid potential leakage of local filesystem data. A security announcement
 will be made shortly.
 
   r16770 | Alex | 2011-09-10 03:53:56 +0200 (Sa, 10 Sep 2011) | 1 line

   Make ``Formset.__getitem__`` O(1), rather than O(n).  If you override
 ``__iter__`` you now need to also override ``__getitem__`` for consistant
 behavior.  Thanks to Carl and Russ for the review.
 
   r16773 | Alex | 2011-09-10 04:42:05 +0200 (Sa, 10 Sep 2011) | 1 line

   Fixed #11404.  Added ``FormSet.has_changed``, for consistancy with
 ``Form.has_changed``. Thanks to michelts for the patch.
 
   r16774 | Alex | 2011-09-10 04:52:37 +0200 (Sa, 10 Sep 2011) | 1 line

   Fixed #16793. Added more cross referencing to the load tag's
 documentation.  Thanks to bluejeansummer for the patch.
 
   r16775 | jbronn | 2011-09-10 05:04:30 +0200 (Sa, 10 Sep 2011) | 1 line

   Fixed #16790 -- Modified the geographic admin to work after r16594.
 Thanks, jdiego, for the 

Re: [Django] #16803: Unicode representation of ContentType instances is not translated

2011-09-16 Thread Django
#16803: Unicode representation of ContentType instances is not translated
+--
   Reporter:  bronger   |  Owner:  isagalaev
   Type:  Bug   | Status:  closed
  Milestone:|  Component:  contrib.contenttypes
Version:  1.3   |   Severity:  Normal
 Resolution:  fixed |   Keywords:
   Triage Stage:  Accepted  |  Has patch:  1
Needs documentation:  0 |Needs tests:  0
Patch needs improvement:  1 |  Easy pickings:  0
  UI/UX:  0 |
+--
Changes (by carljm):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [16839]:
 {{{
 #!CommitTicketReference repository="" revision="16839"
 Fixed #16803 -- Use model verbose_name directly as ContentType unicode
 representation so it can be translated. Thanks to bronger for the report
 and Ivan Sagalaev for the patch.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16803: Unicode representation of ContentType instances is not translated

2011-09-16 Thread Django
#16803: Unicode representation of ContentType instances is not translated
+--
   Reporter:  bronger   |  Owner:  isagalaev
   Type:  Bug   | Status:  assigned
  Milestone:|  Component:  contrib.contenttypes
Version:  1.3   |   Severity:  Normal
 Resolution:|   Keywords:
   Triage Stage:  Accepted  |  Has patch:  1
Needs documentation:  0 |Needs tests:  0
Patch needs improvement:  1 |  Easy pickings:  0
  UI/UX:  0 |
+--

Comment (by isagalaev):

 This one should be better. UnicodeDecodeError was because of using low-
 level unicode() instead of force_unicode() — fixed. Tests now pass. I also
 updated the comment.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16803: Unicode representation of ContentType instances is not translated

2011-09-15 Thread Django
#16803: Unicode representation of ContentType instances is not translated
+--
   Reporter:  bronger   |  Owner:  isagalaev
   Type:  Bug   | Status:  assigned
  Milestone:|  Component:  contrib.contenttypes
Version:  1.3   |   Severity:  Normal
 Resolution:|   Keywords:
   Triage Stage:  Accepted  |  Has patch:  1
Needs documentation:  0 |Needs tests:  0
Patch needs improvement:  1 |  Easy pickings:  0
  UI/UX:  0 |
+--

Comment (by isagalaev):

 My bad, I should've run the whole test suite. I'll look into it shortly…

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16803: Unicode representation of ContentType instances is not translated

2011-09-15 Thread Django
#16803: Unicode representation of ContentType instances is not translated
+--
   Reporter:  bronger   |  Owner:  isagalaev
   Type:  Bug   | Status:  assigned
  Milestone:|  Component:  contrib.contenttypes
Version:  1.3   |   Severity:  Normal
 Resolution:|   Keywords:
   Triage Stage:  Accepted  |  Has patch:  1
Needs documentation:  0 |Needs tests:  0
Patch needs improvement:  1 |  Easy pickings:  0
  UI/UX:  0 |
+--
Changes (by carljm):

 * needs_better_patch:  0 => 1


Comment:

 Replying to [comment:6 isagalaev]:
 > Here's the first iteration of a patch. A couple of notes:
 >
 > * {{{touch tests/regressiontests/i18n/contenttypes/__init__.py}}}
 > * I don't know if there a point of attaching compiled language files
 that don't get included in the patch, it might be easier to compile them
 from tests/regressiontests/i18n/contenttypes directory by hand
 > * I left a comment in django/contrib/contenttypes/models.py regarding
 deprecation of {{{self.name}}} but wasn't sure if we should actually raise
 a DeprecationWarning there?

 I think actual deprecation of the name field should wait until we have
 schema migrations in core, so that we can actually remove the field at the
 end of the deprecation. For now the comment is fine - I might expand on it
 to note that we'll do a real deprecation later.

 Looks good otherwise, except I'm now getting four UnicodeDecodeErrors in
 the admin_views tests with this patch. Probably due to the added
 translation with non-ASCII chars in it, haven't dug in to find the best
 solution.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16803: Unicode representation of ContentType instances is not translated

2011-09-15 Thread Django
#16803: Unicode representation of ContentType instances is not translated
+--
   Reporter:  bronger   |  Owner:  isagalaev
   Type:  Bug   | Status:  assigned
  Milestone:|  Component:  contrib.contenttypes
Version:  1.3   |   Severity:  Normal
 Resolution:|   Keywords:
   Triage Stage:  Accepted  |  Has patch:  1
Needs documentation:  0 |Needs tests:  0
Patch needs improvement:  0 |  Easy pickings:  0
  UI/UX:  0 |
+--
Changes (by isagalaev):

 * has_patch:  0 => 1


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16803: Unicode representation of ContentType instances is not translated

2011-09-15 Thread Django
#16803: Unicode representation of ContentType instances is not translated
+--
   Reporter:  bronger   |  Owner:  isagalaev
   Type:  Bug   | Status:  assigned
  Milestone:|  Component:  contrib.contenttypes
Version:  1.3   |   Severity:  Normal
 Resolution:|   Keywords:
   Triage Stage:  Accepted  |  Has patch:  0
Needs documentation:  0 |Needs tests:  0
Patch needs improvement:  0 |  Easy pickings:  0
  UI/UX:  0 |
+--

Comment (by isagalaev):

 Here's the first iteration of a patch. A couple of notes:

 * {{{touch tests/regressiontests/i18n/contenttypes/__init__.py}}}
 * I don't know if there a point of attaching compiled language files that
 don't get included in the patch, it might be easier to compile them from
 tests/regressiontests/i18n/contenttypes directory by hand
 * I left a comment in django/contrib/contenttypes/models.py regarding
 deprecation of {{{self.name}}} but wasn't sure if we should actually raise
 a DeprecationWarning there?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16803: Unicode representation of ContentType instances is not translated

2011-09-13 Thread Django
#16803: Unicode representation of ContentType instances is not translated
+--
   Reporter:  bronger   |  Owner:  isagalaev
   Type:  Bug   | Status:  assigned
  Milestone:|  Component:  contrib.contenttypes
Version:  1.3   |   Severity:  Normal
 Resolution:|   Keywords:
   Triage Stage:  Accepted  |  Has patch:  0
Needs documentation:  0 |Needs tests:  0
Patch needs improvement:  0 |  Easy pickings:  0
  UI/UX:  0 |
+--
Changes (by isagalaev):

 * owner:  nobody => isagalaev
 * status:  new => assigned


Comment:

 I was thinking along those lines too :-). I think I could make a patch…

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16803: Unicode representation of ContentType instances is not translated

2011-09-13 Thread Django
#16803: Unicode representation of ContentType instances is not translated
+--
   Reporter:  bronger   |  Owner:  nobody
   Type:  Bug   | Status:  new
  Milestone:|  Component:  contrib.contenttypes
Version:  1.3   |   Severity:  Normal
 Resolution:|   Keywords:
   Triage Stage:  Accepted  |  Has patch:  0
Needs documentation:  0 |Needs tests:  0
Patch needs improvement:  0 |  Easy pickings:  0
  UI/UX:  0 |
+--
Changes (by carljm):

 * stage:  Design decision needed => Accepted


Comment:

 I don't see any good reason why `ContentType` should have a denormalized
 name field stored in the database, rather than looking up the appropriate
 model `verbose_name` at runtime - its not as if the latter is an expensive
 operation, and translation is a real problem with the current approach.

 I think we can make this fix in a backwards-compatible way. The
 `__unicode__` method can check if the name field is equal to the model's
 `verbose_name_raw` (i.e. hasn't been manually changed), and if so look up
 the real `verbose_name` (possibly translated) and return that. If the name
 field has been changed, return it. This still leaves open the possibility
 that in the future (once we have a schema-alteration framework in core) we
 could deprecate and then remove the name field entirely.

 In the meantime, there's also a workaround that I think can help
 multilingual sites: on `ModelForm`s for models with an FK to
 `ContentType`, you can replace the form field for that FK with a subclass
 of `ModelChoiceField` that overrides the `label_for_instance` method to do
 the translated `verbose_name` lookup. This
 
[https://docs.djangoproject.com/en/dev/ref/forms/fields/#django.forms.ModelChoiceField
 is documented]; it's fairly verbose (which is why I'm not simply pointing
 to it and closing this wontfix), but it should do the trick for the time
 being.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16803: Unicode representation of ContentType instances is not translated

2011-09-13 Thread Django
#16803: Unicode representation of ContentType instances is not translated
-+-
   Reporter:  bronger|  Owner:  nobody
   Type:  Bug| Status:  new
  Milestone: |  Component:
Version:  1.3|  contrib.contenttypes
 Resolution: |   Severity:  Normal
   Triage Stage:  Design |   Keywords:
  decision needed|  Has patch:  0
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
Changes (by isagalaev):

 * stage:  Unreviewed => Design decision needed


Comment:

 First, I was wrong that the field {{{name}}} is technical. Quite the
 opposite, it's intended to be a human-readable representation. So the
 simplest solution to your use-case is changing the {{{name}}} to whatever
 you want. However this won't work in a multilingual environment since the
 field's content cannot be translated (at the moment).

 I've conducted a little research. {{{ContentType.name}}} is initialized
 with model's untranslated verbose name — {{{verbose_name_raw}}}, a
 property which was introduced in [5225] specifically for the purpose of
 using for content types. I don't know why it was done this way. It might
 be a good idea to change this to using a usual translated verbose names of
 a model but it's technically backwards incompatible.

 I'm marking this as DDN to get an opinion of a core developer. To
 summarize:

 * {{{ContentType}}} uses a dedicated field for its human-readable
 representation. The idea is to use real verbose names of models.
 * Good: {{{ContentType}}}s will become translatable
 * Good: code around {{{verbose_name_raw}}} will go away
 * Bad: it's technically backwards incompatible: users might be changing
 and relying on {{{ContentType.name}}}

 My own take would be to go for a change since I doubt
 {{{ContentType.name}} is widely used **and** is different from
 {{{verbose_name}}} of a model. Most probably we will even save maintenance
 for people who routinely change names of content type according to model's
 verbose names.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16803: Unicode representation of ContentType instances is not translated

2011-09-10 Thread Django
#16803: Unicode representation of ContentType instances is not translated
-+-
   Reporter:  bronger|  Owner:  nobody
   Type:  Bug| Status:  new
  Milestone: |  Component:
Version:  1.3|  contrib.contenttypes
 Resolution: |   Severity:  Normal
   Triage Stage: |   Keywords:
  Unreviewed |  Has patch:  0
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-

Comment (by bronger):

 I have three occurences of M2M relationships to !ContentType in my models.
 These models become model forms.  Then, you get selection boxes in the
 browser with untranslated items.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #16803: Unicode representation of ContentType instances is not translated

2011-09-10 Thread Django
#16803: Unicode representation of ContentType instances is not translated
-+-
   Reporter:  bronger|  Owner:  nobody
   Type:  Bug| Status:  new
  Milestone: |  Component:
Version:  1.3|  contrib.contenttypes
 Resolution: |   Severity:  Normal
   Triage Stage: |   Keywords:
  Unreviewed |  Has patch:  0
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
Changes (by isagalaev):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 ContentType instance name is a pretty "technical" name. Can you describe a
 usecase where it is shown in a user or admin interface?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



[Django] #16803: Unicode representation of ContentType instances is not translated

2011-09-10 Thread Django
#16803: Unicode representation of ContentType instances is not translated
-+--
 Reporter:  bronger  |  Owner:  nobody
 Type:  Bug  | Status:  new
Milestone:   |  Component:  contrib.contenttypes
  Version:  1.3  |   Severity:  Normal
 Keywords:   |   Triage Stage:  Unreviewed
Has patch:  0|  Easy pickings:  0
UI/UX:  0|
-+--
 {{{unicode(contenttype_instance)}}} always returns the English name of the
 respective model class.  More accurately, it returns the "{{{name}}}"
 field which contains the underlying model class'es {{{verbose_name_raw}}}.
 It would have helped me if it said in
 {{{django/django/contrib/contenttypes/models.py}}} line 87:

 {{{
 def __unicode__(self):
 return unicode(self.model_class()._meta.verbose_name)
 }}}

 or something similar.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.