auth.contrib silently catching TypeError. Bug?

2009-04-20 Thread Tamas Szabo
Hi, The function authenticate in django/contrib/auth/__init__.py reads: 31def authenticate(**credentials): 32 """ 33 If the given credentials are valid, return a User object. 34 """ 35 for backend in get_backends(): 36 try: 37

Re: auth.contrib silently catching TypeError. Bug?

2009-04-23 Thread Tamas Szabo
as a result which will be much slower then a changed implementation. Regards, Tamas On Thu, Apr 23, 2009 at 8:06 AM, James Bennett wrote: > > On Mon, Apr 20, 2009 at 4:20 AM, Tamas Szabo wrote: >> As you can see the code catches and silently ignores all TypeError >> ex

Re: auth.contrib silently catching TypeError. Bug?

2009-04-27 Thread Tamas Szabo
Hi Carl, On Mon, Apr 27, 2009 at 10:14 PM, Carl Meyer wrote: > > Hi Tamas, > > On Apr 23, 3:25 am, Tamas Szabo wrote: >> For example if I have a Token based authenticator >> (authenticate(token)) that is configured to be after my User/Password >> based au

Re: auth.contrib silently catching TypeError. Bug?

2009-04-27 Thread Tamas Szabo
On Tue, Apr 28, 2009 at 12:31 PM, James Bennett wrote: > > On Mon, Apr 27, 2009 at 10:49 PM, Tamas Szabo wrote: >> I'm new to Python so I might not understand how keyword arguments work, BUT >> you do assume that authenticate will always be called with keyword >&g

Re: How to handle this race condition?

2009-11-09 Thread Tamas Szabo
Would something like UPDATE bid = new_bid WHERE id = id and bid < new_bid work for you? It is a more optimistic approach (it assumes that the case you describe is an exception rather than what usually happens) and I think it is simpler by not having to do any locking etc. Regards, Tamas O

Re: How to handle this race condition?

2009-11-10 Thread Tamas Szabo
> > Anyways, as concurrency is hard and taking row level locks is cheap > and easy way to get the concurrency right I would suggest you use the > select for update method. Also, this way you will avoid the need to > retry failed transactions because of concurrent updates. > > IMHO, both approaches

Re: How to handle this race condition?

2009-11-10 Thread Tamas Szabo
You can inspect the rowcount attribute of the cursor object after you executed your update. rowcount returns the number of rows affected by your update, so it will be 1 if your where condition was true. On Wed, Nov 11, 2009 at 10:04 AM, Continuation wrote: > > > > Would something like > > > > U

Re: request.POST['value'] cannot get value, 500 error

2009-11-10 Thread Tamas Szabo
Does request.POST['value'][0]['LastName'] work? It looks like your post data has an array (keyed as 'value') of dicts. You might also consider using Firebug (or something similar) to inspect the http requests and responses when you are developing. Regards, Tamas On Wed, Nov 11, 2009 at 2: