Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3a9582f

Browse files
committed
Fix the example (it didn't seem to reflect reality).
1 parent 6f477a6 commit 3a9582f

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

Doc/lib/libcookie.tex

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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
189191
Set-Cookie: sugar=wafer;
190192
Set-Cookie: fig=newton;
191193
>>> C = Cookie.SmartCookie()
@@ -197,18 +199,18 @@ \subsection{Example \label{cookie-example}}
197199
Cookie: rocky=road;
198200
>>> C = Cookie.SmartCookie()
199201
>>> C.load("chips=ahoy; vienna=finger") # load from a string (HTTP header)
200-
>>> C
202+
>>> print C
201203
Set-Cookie: vienna=finger;
202204
Set-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
206208
Set-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
224226
Set-Cookie: number=7;
225227
Set-Cookie: string=seven;
226228
>>> C = Cookie.SerialCookie()
@@ -230,7 +232,7 @@ \subsection{Example \label{cookie-example}}
230232
7
231233
>>> C["string"].value
232234
'seven'
233-
>>> C
235+
>>> print C
234236
Set-Cookie: number="I7\012.";
235237
Set-Cookie: string="S'seven'\012p1\012.";
236238
>>> C = Cookie.SmartCookie()
@@ -240,7 +242,7 @@ \subsection{Example \label{cookie-example}}
240242
7
241243
>>> C["string"].value
242244
'seven'
243-
>>> C
245+
>>> print C
244246
Set-Cookie: number="I7\012.";
245247
Set-Cookie: string=seven;
246248
\end{verbatim}

0 commit comments

Comments
 (0)