ivoflipse / Pawlabeling

Tool for processing and analyzing pressure measurements
Other
18 stars 1 forks source link

Clear cache might be a bit too aggressive #72

Closed ivoflipse closed 10 years ago

ivoflipse commented 10 years ago

I just added a new subject and session, added the measurements and thought I'd try and select the session I just created, but this gave the following error:

Traceback (most recent call last):
  File "C:\Dropbox\Development\Pawlabeling\pawlabeling\widgets\database\sessionwidget.py", line 94, in put_session
    pub.sendMessage("put_session", session=session)
  File "C:\Anaconda\lib\site-packages\pubsub\core\kwargs\publisher.py", line 30, in sendMessage
    topicObj.publish(**kwargs)
  File "C:\Anaconda\lib\site-packages\pubsub\core\kwargs\publishermixin.py", line 24, in publish
    self._publish(msgKwargs)
  File "C:\Anaconda\lib\site-packages\pubsub\core\topicobj.py", line 340, in _publish
    self.__sendMessage(data, self, iterState)
  File "C:\Anaconda\lib\site-packages\pubsub\core\topicobj.py", line 359, in __sendMessage
    self._mix_callListener(listener, data, iterState)
  File "C:\Anaconda\lib\site-packages\pubsub\core\kwargs\publishermixin.py", line 64, in _mix_callListener
    listener(iterState.filteredArgs, self, msgKwargs)
  File "C:\Anaconda\lib\site-packages\pubsub\core\kwargs\listenerimpl.py", line 27, in __call__
    cb(**kwargs)
  File "C:\Dropbox\Development\Pawlabeling\pawlabeling\models\model.py", line 213, in put_session
    self.session_id = session["session_id"]
KeyError: 'session_id'

So it seems its deleting things it shouldn't be deleting.

ivoflipse commented 10 years ago

Turning off clear_cached_values solves the problem. While I thought only model.py was affected, I forgot clear_cached_values publishes the same call to the whole app, so things are deleted everywhere. I guess I'll have to rethink what can/should be cleared when.

ivoflipse commented 10 years ago

I've moved it to put_subject, a far safer choice!