#NEWLINE# def set_cookie( self , key , value ) : #NEWLINE# #INDENT# 'runinfo.set_cookie(key, value). If value is None, delete cookie' #NEWLINE# key = key . lower ( ) . strip ( ) #NEWLINE# cookies = self . get_cookiedict ( ) #NEWLINE# if ( type ( value ) not in ( int , float , str , unicode , type ( None ) ) ) : #NEWLINE# #INDENT# raise Exception ( 'Can only store cookies of type integer or string' ) #NEWLINE# #UNINDENT# if ( value is None ) : #NEWLINE# #INDENT# if ( key in cookies ) : #NEWLINE# #INDENT# del cookies [ key ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( type ( value ) in ( 'int' , 'float' ) ) : #NEWLINE# #INDENT# value = str ( value ) #NEWLINE# #UNINDENT# cookies [ key ] = value #NEWLINE# #UNINDENT# cstr = json . dumps ( cookies ) #NEWLINE# self . cookies = cstr #NEWLINE# self . save ( ) #NEWLINE# self . __cookiecache = cookies