#13291: Allow `color_style()` and `parse_color_setting()` to be used with custom
colour palettes.
--------------------------------------+-------------------------------------
Reporter: mrmachine | Owner: nobody
Status: new | Milestone:
Component: django-admin.py | Version: SVN
Resolution: | Keywords: management command
customize color roles
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 1 |
--------------------------------------+-------------------------------------
Changes (by carljm):
* needs_better_patch: 0 => 1
Comment:
Some notes on the patch:
I think the documentation addition is misplaced; rather than being in the
django-admin.py documentation, it should go in the "writing custom
management commands" howto, as it's only relevant to someone who's writing
a custom command, not all users of django-admin.py.
I think it also needs more context; there currently is no documentation at
all for using django's style/colors system in your own custom management
command. If we're going to bother adding the customizability this patch
offers, we should document it, and that means full documentation that
would actually allow someone to use it, including how to actually do the
styled output, etc.
Also, as currently written, the docs show updating PALETTES directly,
which monkeypatches the built-in palettes. Actually, even the .copy()
method used in the tests, presumably to avoid that, is not effective: only
a shallow copy of the outer dictionary is performed, so the inner palette
dictionaries are still referring to the same actual dictionary, and
updating them _still_ in fact monkeypatches the built-in palettes.
All of which leads me in a roundabout way to my only issue with the code
patch itself: it suggests a usage pattern that is too easy to misuse, as
demonstrated by the fact that both the provided test and the provided docs
misuse it! I think perhaps a better option for the API would be to pass in
palette_overrides rather than completely new palettes; this would make the
usage look more like palette_overrides={'dark': {'WARNING': {'fg':
'yellow'}}}. Or, perhaps even better, to reuse the more compact
DJANGO_COLORS string syntax, so you would just pass in
palette_overrides="warning=yellow".
--
Ticket URL: <http://code.djangoproject.com/ticket/13291#comment:4>
Django <http://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.