#17763: Problem with auth_permission name length
------------------------------+-------------------------------------
     Reporter:  stenius@…     |                    Owner:  anonymous
         Type:  Bug           |                   Status:  assigned
    Component:  contrib.auth  |                  Version:  1.0
     Severity:  Normal        |               Resolution:
     Keywords:                |             Triage Stage:  Accepted
    Has patch:  0             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  0
Easy pickings:  1             |                    UI/UX:  0
------------------------------+-------------------------------------
Changes (by shai):

 * cc: shai@… (added)
 * version:  1.3 => 1.0


Comment:

 To strengthen ricw's point, the name value is based on the model's verbose
 name, which is not necessarily derived from the class name.

 Having a field whose name indicates verbosity limited to 39 characters is
 strongly counter-intuitive.

 Also, ricw's option 1 has been wontfix'd in #4748; the problem has been
 with us since before 1.0.

 My own suggestion of a fix: Change
 `django.contrib.auth.management._get_all_permissions` to read:
 {{{
 def _get_all_permissions(opts):
     "Returns (codename, name) for all permissions in the given opts."
     perms = []
     for action in ('add', 'change', 'delete'):
         perm_name = u'Can %s %s' % (action, opts.verbose_name_raw)
         if len(perm_name)>50:
             perm_name= perm_name[:40] + u'...' + perm_name[-7:]
         perms.append((_get_permission_codename(action, opts), perm_name))
     return perms + list(opts.permissions)
 }}}

 Because the name is just used for UI anyway. Of course, you can play with
 the "40" and "7" there -- that's what I thought was reasonable. And
 perhaps the two-line snippet for "make display string fit in length"
 should be factored out and used elsewhere.

 If a core developer finds the approach acceptable, but would rather have
 this as a patch, just say so.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17763#comment:5>
Django <https://code.djangoproject.com/>
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 [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-updates?hl=en.

Reply via email to