@@ -173,19 +173,21 @@ \subsection{Morsel Objects \label{morsel-objects}}
173173
174174\subsection {Example \label {cookie-example } }
175175
176- The following example demonstrates how to open a can of spam using the
177- \module {spam} module.
176+ The following example demonstrates how to use the \module {Cookie} module.
178177
179178\begin {verbatim }
180179>>> import Cookie
181180>>> C = Cookie.SimpleCookie()
182181>>> C = Cookie.SerialCookie()
183182>>> C = Cookie.SmartCookie()
184- >>> C = Cookie.Cookie() # backwards compatible alias for SmartCookie
183+ >>> C = Cookie.Cookie() # backwards- compatible alias for SmartCookie
185184>>> C = Cookie.SmartCookie()
186185>>> C["fig"] = "newton"
187186>>> C["sugar"] = "wafer"
188- >>> C # generate HTTP headers
187+ >>> print C # generate HTTP headers
188+ Set-Cookie: sugar=wafer;
189+ Set-Cookie: fig=newton;
190+ >>> print C.output() # same thing
189191Set-Cookie: sugar=wafer;
190192Set-Cookie: fig=newton;
191193>>> C = Cookie.SmartCookie()
@@ -197,18 +199,18 @@ \subsection{Example \label{cookie-example}}
197199Cookie: rocky=road;
198200>>> C = Cookie.SmartCookie()
199201>>> C.load("chips=ahoy; vienna=finger") # load from a string (HTTP header)
200- >>> C
202+ >>> print C
201203Set-Cookie: vienna=finger;
202204Set-Cookie: chips=ahoy;
203205>>> C = Cookie.SmartCookie()
204- >>> C.load('keebler="E=everybody; L=\"Loves\"; fudge=\012;";')
205- >>> C
206+ >>> C.load('keebler="E=everybody; L=\\ "Loves\\ "; fudge=\ \012;";')
207+ >>> print C
206208Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=\012;";
207209>>> C = Cookie.SmartCookie()
208210>>> C["oreo"] = "doublestuff"
209211>>> C["oreo"]["path"] = "/"
210- >>> C
211- Set-Cookie: oreo=" doublestuff" ; Path=/;
212+ >>> print C
213+ Set-Cookie: oreo=doublestuff; Path=/;
212214>>> C = Cookie.SmartCookie()
213215>>> C["twix"] = "none for you"
214216>>> C["twix"].value
@@ -220,7 +222,7 @@ \subsection{Example \label{cookie-example}}
220222'7'
221223>>> C["string"].value
222224'seven'
223- >>> C
225+ >>> print C
224226Set-Cookie: number=7;
225227Set-Cookie: string=seven;
226228>>> C = Cookie.SerialCookie()
@@ -230,7 +232,7 @@ \subsection{Example \label{cookie-example}}
2302327
231233>>> C["string"].value
232234'seven'
233- >>> C
235+ >>> print C
234236Set-Cookie: number="I7\012.";
235237Set-Cookie: string="S'seven'\012p1\012.";
236238>>> C = Cookie.SmartCookie()
@@ -240,7 +242,7 @@ \subsection{Example \label{cookie-example}}
2402427
241243>>> C["string"].value
242244'seven'
243- >>> C
245+ >>> print C
244246Set-Cookie: number="I7\012.";
245247Set-Cookie: string=seven;
246248\end {verbatim }
0 commit comments