<s> import cgi , os , sys <EOL> from snakeserver . snakelet import Snakelet <EOL> import Cookie <EOL> class TestCookie ( Snakelet ) : <EOL> def requiresSession ( self ) : <EOL> return self . SESSION_NOT_NEEDED <EOL> def serve ( self , request , response ) : <EOL> if request . getArg ( ) != '<STR_LIT>' : <EOL> response . setCookie ( "<STR_LIT:test>" , "<STR_LIT>" ) <EOL> response . HTTPredirect ( self . getURL ( ) + "<STR_LIT>" ) <EOL> else : <EOL> out = response . getOutput ( ) <EOL> cookies = Cookie . SimpleCookie ( request . getCookie ( ) ) <EOL> print >> out , '<STR_LIT>' <EOL> if not cookies . has_key ( "<STR_LIT:test>" ) : <EOL> print >> out , """<STR_LIT>""" % self . getURL ( ) <EOL> return <EOL> print >> out , """<STR_LIT>""" </s>
