Skip to content
Browse files

fixed text to match example, provided summary/prototype

  • Loading branch information...
1 parent 160f82b commit 4074d92de9cacdd35c10ebcda381bb5d8c0678e0 @adamcrosby adamcrosby committed with anandology
Showing with 11 additions and 3 deletions.
  1. +11 −3 cookbook/cookies.md
View
14 cookbook/cookies.md
@@ -10,7 +10,7 @@ You want to set and retrieve cookies for a user browsing the site.
##Solution
-web.setcookie can be used to set the cookie for a user, like this:
+`web.setcookie()` can be used to set the cookie for a user, like this:
class CookieSet:
@@ -21,12 +21,20 @@ web.setcookie can be used to set the cookie for a user, like this:
Going to the above function will set a cookie with cookie name equal to "name" and cookie value default equal to "Bob", or whatever the user gives as input. You could set a custom name by going to /cookieset?name=Guido.
+`web.setcookie()` takes a third argument, "expires", so you can decide when you want your cookie to expire. Any negative number will expire the cookie immediately. Any positive number is the number of seconds that the cookie will last (3600 would result in an hour long cookie).
-web.getcookie can be used to access an already set cookie. If a cookie is set using the above code, it can be retrieved like this:
+`web.cookies()` can be used to access an already set cookie. If a cookie is set using the above code, it can be retrieved like this:
class CookieGet:
def GET(self):
c = web.cookies(name="Bob")
return "Your name is: " + c.name
-web.setcookie takes a third argument, "expires", so you can decide when you want your cookie to expire. Any negative number will expire the cookie immediately. Any positive number is the number of seconds that the cookie will last (3600 would result in an hour long cookie).
+
+In summary:
+
+ web.setcookie(cookieName, cookieValue, expires)
+
+and
+
+ web.cookies(name)

0 comments on commit 4074d92

Please sign in to comment.
Something went wrong with that request. Please try again.