Hello,everyone. I met some problems,I really hope that anyone can help me. * * I had writen some code in below:
*DICT_INDIUSERFORUN_LIST_BY_TYPE* = {} def get_indiuserforum_list_by_type_form_cache(obj,obj_type,parentnode): if parentnode == "-1": key = "%s_%s_%s"%(obj.id,obj_type,"00") else: key = "%s_%s_%s"%(obj.id,obj_type,parentnode) mydict = DICT_INDIUSERFORUN_LIST_BY_TYPE update_time = mydict.get('update_time_%s'%key) working_key = 'working_%s'%key working = mydict.get(working_key) refresh_flag = False indiuserforum_list_by_type = [] if not update_time: refresh_flag = True else: indiuserforum_list_by_type = mydict.get('indiuserforum_list_by_type_%s'%key,[]) if not indiuserforum_list_by_type: refresh_flag = True else: now = datetime.datetime.now() delta = now - update_time if delta.seconds > SHORT_CACHE_TIMEOUT: refresh_flag = True if refresh_flag and not working: mydict[working_key] = True try: * indiuserforum_list_by_type = xxxxx #function to set value* finally: mydict[working_key] = False mydict['indiuserforum_list_by_type_%s'%key] = indiuserforum_list_by_type mydict['update_time_%s'%key] = datetime.datetime.now() return indiuserforum_list_by_type but sometimes it occur the below error: Traceback (most recent call last): File "d:\python24\lib\site-packages\django\core\handlers\base.py", line 100, in get_response response = callback(request, *callback_args, **callback_kwargs) File "D:\PROJECT\APP\VIEWS.py", line 675, in get_message_replay_list for replyobj in replyobj_list: File "d:\python24\lib\site-packages\django\db\models\query.py", line 106, in _result_iter self._fill_cache() File "d:\python24\lib\site-packages\django\db\models\query.py", line 760, in _fill_cache self._result_cache.append(self._iter.next()) ValueError: generator already executing Many thanks Regards -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/AuCxrg67yjgJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.