Permalink
Browse files

Added more setcookie() fields to reflect actual function definition.

  • Loading branch information...
adamcrosby authored and anandology committed Aug 7, 2008
1 parent 558edc7 commit c9caba428d0ab0e074f4a2e842944c104cb1fad7
Showing with 11 additions and 5 deletions.
  1. +11 −5 cookbook/cookies.md
View
@@ -9,15 +9,21 @@ title: cookies
You want to set and retrieve cookies for a user browsing the site.
##Solution
-Web.py comes with an easy to use method for setting/getting cookies.
+Web.py *comes* with an easy to use method for setting/getting cookies.
###Setting Cookies
####Overview
+ setcookie(name, value, expires="", domain=None, secure=False):
+
+ *name* `(string)` - The actual name of the cookie, as stored by the browser, and returned to the server.
- web.setcookie(cookieName, cookieValue, [expires])
- # cookieName is the actual name of the cookie, as stored by the browser
- # cookieValue is the value you want stored under that name
- # [expires] optionally, is the time in seconds until the browser should expire the cookie
+ *value* `(string)` - The value you want stored under that name.
+
+ *expires* `(int)` - Optionally, is the time in seconds until the browser should expire the cookie. Note: this must be an integer, not a string.
+
+ *domain* `(string)` - The domain the cookie is valid for. By default, set to the host accessed, this allows you to set the domain, rather than just a host (such as `.webpy.org`).
+
+ *secure* `(bool)`- If True, require that the cookie only be sent over HTTP/S.
####Example
`web.setcookie()` can be used to set the cookie for a user, like this:

0 comments on commit c9caba4

Please sign in to comment.