11.3. How to store plugin state between callbacks

The easiest way to store state between callbacks is to store the data in the data dict. For example:


STATE_KEY = "myplugin_state"

def cb_date_head(args):
   request = args["request"]
   data = request.getData()

   if data.has_key(STATE_KEY) and data[STATE_KEY]["blah"] == "blahblah":
      ...


def cb_filelist(args):
   request = args["request"]
   data = request.getData()

   data[STATE_KEY] = {}
   data[STATE_KEY]["blah"] = "blahblah"