Re: Bug in django\forms\models.py in _construct_form, line 593?

2014-09-08 Thread Piotr Gosławski
My project is not python 2 compatibile so I've tried to create a minimal project that would reproduce the error, but failed to do so. Turned out the view throwing KeyError was not the problem, at least not by itself. I went back to the original project and started poking at it. Finally I've noti

Bug in django\forms\models.py in _construct_form, line 593?

2014-09-06 Thread Piotr Gosławski
Hi, when using UpdateView with formset (inlineformset_factory), I randomly got KeyError (page works, refresh, error, refresh, works, ...) Django Version: 1.7 Exception Type: KeyError Exception Value: 0 Exception Location: ...\django\forms\models.py in _construct_form, line 593 P

Re: Feature request: ttl method for cache

2014-05-08 Thread Piotr Gosławski
I was fixing my little helper function to behave more like Sean's and I think I've found a bug in locmem. Could you please take a look at this: >>> cache >>> cache.set('a', 1) >>> cache.set('b', 2, None) >>> cache.get('a') 1 >>> cache.get('b') 2 >>> cache.has_key('a') True >>> cache.has_key('b')

Re: Feature request: ttl method for cache

2014-05-07 Thread Piotr Gosławski
It would sacrifice atomicity of incr()/decr() methods and hit their speed pretty hard. W dniu wtorek, 6 maja 2014 16:47:53 UTC+2 użytkownik adamcik napisał: > > On Tue, May 06, 2014 at 05:57:28AM -0700, Piotr Gosławski wrote: > > W dniu wtorek, 6 maja 2014 11:47:17 UTC+2 użytko

Re: Feature request: ttl method for cache

2014-05-07 Thread Piotr Gosławski
W dniu wtorek, 6 maja 2014 16:47:53 UTC+2 użytkownik adamcik napisał: > > See > https://groups.google.com/d/msg/django-developers/ctKJzBTONu8/opbWqUIcOKgJ > for a similar case that has come up before. The tuple solution used there > could easily be adapted to store the time the key will expire,

Re: Feature request: ttl method for cache

2014-05-06 Thread Piotr Gosławski
W dniu wtorek, 6 maja 2014 11:47:17 UTC+2 użytkownik Florian Apolloner napisał: > > [...] > Memcached doesn't provide access to the remaining TTL, and I don't see how > we can reasonably fake this without writing an extra key containing the > expiration date. > > Would that be unacceptable to a

Feature request: ttl method for cache

2014-05-05 Thread Piotr Gosławski
Hi! Since the contribution workflow is a bit confusing to me, I'll just leave it here. I think django's cache needs ttl (time to live) method that would return time left until specified key expires. I, for instance, needed one when writing a rate limiter. Without it I would have to store twice a