Delete caching object

I'm trying to delete a previously created stroage object with:

Data.Remove("test")

After reading the object again with:

tmp = Data.LoadObject("test")

The data still exists... I'm trying to delete this object in case of an error.

def MainMenu():
  Plugin.AddViewGroup('InfoList', viewMode='InfoList', mediaType='items')

oc = ObjectContainer(title1=TEXT_TITLE, view_group = ‘InfoList’)

token = getToken(“tv”)

Only process if we got a valid token.

errmsg = “”
if token != “”:
result = getChannels(token)
if debug == True: Log("Token to use for api calls: " + token)

if result.has_key('channels'):
  for channel in result['channels']['elements']:
    testchan = channel;
    oc.add(createTVChannelObject(channel))

# Check errormessage if we got a negative reply from the api.
if result.has_key('errors'):
  deleteTokenFromCache("tv")
  errmsg = "<br>[ " + result['errors'][0]['description'] + " ]"

oc.add(PrefsObject(title=TEXT_PREFERENCES, thumb=R(ICON_SETTINGS)))

if len(oc) < 2:
failoc = ObjectContainer(header=“Fehler!”, message=“Zugriff nicht möglich.” + errmsg)
failoc.add(PrefsObject(title=TEXT_PREFERENCES, thumb=R(ICON_SETTINGS)))
return failoc

return oc

Any hints about removing storage objects? Or did I face a bug?

I would suggest using Dict rather than Data.

'''save a token'''
Dict['token'] = token
'''delete the saved token'''
Dict['token'] = None 

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.