[newmaint-site] Clearing data for a data source / contribution type

enrico at enricozini.org enrico at enricozini.org
Tue Apr 1 08:51:05 UTC 2014


On Tue, Apr 01, 2014 at 03:07:56AM +0200, Marco Bardelli wrote:

> I propose this patch:
>  http://anonscm.debian.org/gitweb/?p=users/safanaj-guest/dc.git;a=commitdiff;h=ad44f44606a6a9cbc2bf01277770b5686c397733
> i left commented out some "excessive stuff" in get_context_data that
> enumerate contributions during confirmation step.

Looks good. I didn't notice that SourceMixin and ContributionTypeMixin
could be used like that, I like the idea a lot.

I think you can leave out the "excessive stuff": this is going to be
mostly useful during early tries at data sources, to remove wrong data
that hs been posted, and one is probably not so interested in a summary
of the wrong data.

The view misses an admin check. Something like:

        if not self.object.can_admin(self.request.user):
		raise http.Http404

you can add a can_admin proxy method to ContributionType delegating to
self.source.can_admin, to make it work in both cases.

I don't like the Http404, I wish django had a raisable Http403 as well.

> Still missing unit tests, i need some overview to figure out me
> "inspired such as" Enrico and start something like test_common.py also in
> nm.debian.org, i'll try.

I'm sorry the stuff in test_common.py is a bit spaghetti-ish: it makes
complex tests possible, but every time I want to add a new unit test, I
need to reread it to remember how it works :/


Ciao,

Enrico

-- 
GPG key: 4096R/E7AD5568 2009-05-08 Enrico Zini <enrico at enricozini.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/newmaint-site/attachments/20140401/b7b5f1be/attachment.sig>


More information about the newmaint-site mailing list