]> granicus.if.org Git - python/commitdiff
Fix the example (it didn't seem to reflect reality).
authorKa-Ping Yee <ping@zesty.ca>
Thu, 18 Jan 2001 07:50:17 +0000 (07:50 +0000)
committerKa-Ping Yee <ping@zesty.ca>
Thu, 18 Jan 2001 07:50:17 +0000 (07:50 +0000)
Doc/lib/libcookie.tex

index d9dcd8a07e9d6ba357e7de0cbb0ab731076214c8..c76e1237e37ffcf1eec85e4c8544ae39bcf0d0c1 100644 (file)
@@ -173,19 +173,21 @@ The meaning for \var{attrs} is the same as in \method{output()}.
 
 \subsection{Example \label{cookie-example}}
 
-The following example demonstrates how to open a can of spam using the
-\module{spam} module.
+The following example demonstrates how to use the \module{Cookie} module.
 
 \begin{verbatim}
 >>> import Cookie
 >>> C = Cookie.SimpleCookie()
 >>> C = Cookie.SerialCookie()
 >>> C = Cookie.SmartCookie()
->>> C = Cookie.Cookie() # backwards compatible alias for SmartCookie
+>>> C = Cookie.Cookie() # backwards-compatible alias for SmartCookie
 >>> C = Cookie.SmartCookie()
 >>> C["fig"] = "newton"
 >>> C["sugar"] = "wafer"
->>> C # generate HTTP headers
+>>> print C # generate HTTP headers
+Set-Cookie: sugar=wafer;
+Set-Cookie: fig=newton;
+>>> print C.output() # same thing
 Set-Cookie: sugar=wafer;
 Set-Cookie: fig=newton;
 >>> C = Cookie.SmartCookie()
@@ -197,18 +199,18 @@ Cookie: rocky=road; Path=/cookie;
 Cookie: rocky=road;
 >>> C = Cookie.SmartCookie()
 >>> C.load("chips=ahoy; vienna=finger") # load from a string (HTTP header)
->>> C
+>>> print C
 Set-Cookie: vienna=finger;
 Set-Cookie: chips=ahoy;
 >>> C = Cookie.SmartCookie()
->>> C.load('keebler="E=everybody; L=\"Loves\"; fudge=\012;";')
->>> C
+>>> C.load('keebler="E=everybody; L=\\"Loves\\"; fudge=\\012;";')
+>>> print C
 Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=\012;";
 >>> C = Cookie.SmartCookie()
 >>> C["oreo"] = "doublestuff"
 >>> C["oreo"]["path"] = "/"
->>> C
-Set-Cookie: oreo="doublestuff"; Path=/;
+>>> print C
+Set-Cookie: oreo=doublestuff; Path=/;
 >>> C = Cookie.SmartCookie()
 >>> C["twix"] = "none for you"
 >>> C["twix"].value
@@ -220,7 +222,7 @@ Set-Cookie: oreo="doublestuff"; Path=/;
 '7'
 >>> C["string"].value
 'seven'
->>> C
+>>> print C
 Set-Cookie: number=7;
 Set-Cookie: string=seven;
 >>> C = Cookie.SerialCookie()
@@ -230,7 +232,7 @@ Set-Cookie: string=seven;
 7
 >>> C["string"].value
 'seven'
->>> C
+>>> print C
 Set-Cookie: number="I7\012.";
 Set-Cookie: string="S'seven'\012p1\012.";
 >>> C = Cookie.SmartCookie()
@@ -240,7 +242,7 @@ Set-Cookie: string="S'seven'\012p1\012.";
 7
 >>> C["string"].value
 'seven'
->>> C
+>>> print C
 Set-Cookie: number="I7\012.";
 Set-Cookie: string=seven;
 \end{verbatim}