def setcookie(name, value, expires='', domain=None):
 if (expires < 0):
  expires = (-1000000000)
 kargs = {'expires': expires, 'path': '/'}
 if domain:
  kargs['domain'] = domain
 cookie = Cookie.SimpleCookie()
 cookie[name] = value
 for (key, val) in kargs.iteritems():
  cookie[name][key] = val
 header('Set-Cookie', cookie.items()[0][1].OutputString())

def setcookie ( name , value , expires = '' , domain = None ) : if ( expires < 0 ) : expires = ( - 1000000000 ) kargs = { 'expires' : expires , 'path' : '/' } if domain : kargs [ 'domain' ] = domain cookie = Cookie . SimpleCookie ( ) cookie [ name ] = value for ( key , val ) in kargs . iteritems ( ) : cookie [ name ] [ key ] = val header ( 'Set-Cookie' , cookie . items ( ) [ 0 ] [ 1 ] . OutputString ( ) )
sets a cookie .