Should it not be incrementing the time? -Thadeus
On Mon, Dec 28, 2009 at 7:46 PM, Thadeus Burgess <thade...@thadeusb.com> wrote: > Yes but it is incrementing the **value**, not the **time**. > > -Thadeus > > > > > > On Mon, Dec 28, 2009 at 9:06 AM, mdipierro <mdipie...@cs.depaul.edu> wrote: >> I think it is correct >> >> self.storage[key] = (time.time(), value) >> >> so >> >> self.storage[key][0] is time and self.storage[key][1] is value >> >> web2py does not use this anywhere but apps may use it. >> >> Massimo >> >> On Dec 28, 12:05 am, Thadeus Burgess <thade...@thadeusb.com> wrote: >>> def increment(self, key, value=1): >>> self.locker.acquire() >>> try: >>> if key in self.storage: >>> value = self.storage[key][1] + value >>> self.storage[key] = (time.time(), value) >>> except BaseException, e: >>> self.locker.release() >>> raise e >>> self.locker.release() >>> return value >>> >>> Isn't that supposed to be self.storage[key][0] ?? >>> >>> If you look at >>> >>> if f is None: >>> return None >>> if item and (dt == None or item[0] > time.time() - dt): >>> return item[1] >>> value = f() >>> >>> self.locker.acquire() >>> self.storage[key] = (time.time(), value) >>> self.locker.release() >>> return value >>> >>> value is of course what is returned by f(). and that is in index 1 of >>> the list. So the increment member is actually taking the value >>> (results) and adding value to them. I don't think this is what is >>> intended? >>> >>> Where is increment used? >>> >>> -Thadeus >> >> -- >> >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To post to this group, send email to web...@googlegroups.com. >> To unsubscribe from this group, send email to >> web2py+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/web2py?hl=en. >> >> >> > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.