#5968: Registering/Unregistering multiple models fails
-----------------------+----------------------------------------------------
Reporter: anderso | Owner: nobody
Status: new | Component: django.contrib.databrowse
Version: SVN | Resolution:
Keywords: | Stage: Accepted
Has_patch: 1 | Needs_docs: 1
Needs_tests: 0 | Needs_better_patch: 1
-----------------------+----------------------------------------------------
Changes (by mtredinnick):
* needs_docs: 0 => 1
* stage: Unreviewed => Accepted
Comment:
Since you're doing a for-loop over the iterator, it must have an
`__iter__` or `__getitem__` method, so the test you're doing is fine.
Leave the patch as it is for now, but I'm still tempted to move to the
`*args` format. It would be mostly backwards compatible, the only
difference being that `databrowse_class` would have to be specified as a
keyword argument, but we can enforce that and that parameter isn't
documented, so arguably isn't part of the public API (yet, at least).
I'm still a little concerned about how you're going about the test here.
Currently we check that the input must be a model. This patch changes that
so that {{{site.register(int)}}} won't raise the error it does now and
will only cause problems later. I think it's important to keep the test
for models in there somewhere. Presumably the end result is to allow
multiple models to be registered at once. The iterable is just a way to
achieve that, not a requirement, right? After all, given an iterable, you
can still make it work with the *args format by calling
`register(*list(my_iter))`. Thus my slight preference for the *args
version when we can just iterate over `args` inside the `register()`
method.
Anyway, let's leave it as is for now and we can tweak it when it comes
time to commit. I think the idea is reasonable, however we end up
imlpementing it.
--
Ticket URL: <http://code.djangoproject.com/ticket/5968#comment:3>
Django Code <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
-~----------~----~----~----~------~----~------~--~---