Re: Proposal/RFC: assertContextContains

2010-06-24 Thread Paul McMillan
A very minor note, but... On Jun 24, 1:31 am, JK Laiho wrote: > self.assert_('varname' in response.context) Please use self.assertTrue(). assert_() is deprecated in unittest2. http://www.voidspace.org.uk/python/articles/unittest2.shtml#deprecations -Paul -- You received this

Re: test-refactor update

2010-06-24 Thread Paul McMillan
> Firstly, do you have any evidence that this goal is achievable? If > you've converted 7 this week, what makes you think you will be able to > convert 25 next week -- especially when there are tests like > regressiontests/queries still out there? Can you provide stats in > terms of LOC converted,

Re: Proposal/RFC: assertContextContains

2010-06-24 Thread JK Laiho
(Looks like I sort of reinvented *args and *kwargs there. Using them might look nicer, but none of the other assertion methods use them and I modeled to be in line with them.) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this

extra_context in all admin views?

2010-06-24 Thread Nan
I've been subclassing AdminSite for a recent project, and am curious whether there's a particular reason why the login, logout, and change_password views shouldn't take extra_context the way most of the other views do? thanks, -Nan -- You received this message because you are subscribed to the

Re: Proposal/RFC: assertContextContains

2010-06-24 Thread JK Laiho
Having done some preliminary coding on this, I get the feeling that the positive assertion is quite useful, but assertContextNotContains is superfluous. Theoretically, you could use it to test that unexpected keys don't end up in the context dictionary through the use of locals(), but you

Re: proposal: abstract file upload/download handling

2010-06-24 Thread Waldemar Kornewald
On Thu, Jun 24, 2010 at 1:12 PM, Luke Plant wrote: > On Thu, 2010-06-24 at 08:40 +0200, Waldemar Kornewald wrote: > >> The boolean is sufficient because those permission checks should be >> done in the download view (or a router backend): >> >> if

Re: proposal: abstract file upload/download handling

2010-06-24 Thread Luke Plant
On Thu, 2010-06-24 at 08:40 +0200, Waldemar Kornewald wrote: > The boolean is sufficient because those permission checks should be > done in the download view (or a router backend): > > if request.user.is_authenticated: > return file.serve() > else: > # user has no permissions This

Proposal/RFC: assertContextContains

2010-06-24 Thread JK Laiho
While waiting for the patch in ticket #13092 (ContextList objects do not support "in" operator) to land in Django (hopefully by 1.3), I've been using a trivial custom method, assertContextContains, to see if the Context/ContextList of a response object contains a certain key or a certain key/value

Re: proposal: abstract file upload/download handling

2010-06-24 Thread Waldemar Kornewald
On Wed, Jun 23, 2010 at 11:06 PM, Robert Coup wrote: > On Thu, Jun 24, 2010 at 4:24 AM, Waldemar Kornewald > wrote: >> FileField gets a new method prepare_upload() which takes the following >> arguments: >> * request >> * upload_url: the target