diff options
| author | ianb <devnull@localhost> | 2005-07-13 04:44:40 +0000 |
|---|---|---|
| committer | ianb <devnull@localhost> | 2005-07-13 04:44:40 +0000 |
| commit | a6095e88d312390302c44a35225fdd423b79779e (patch) | |
| tree | b518ba15f72b36788c67f07a642aa588b3cec4a8 /paste | |
| parent | 0ebeb3144c516cf1766d9a7843ce07aebd51cafb (diff) | |
| download | paste-a6095e88d312390302c44a35225fdd423b79779e.tar.gz | |
Added cookie setting method
Diffstat (limited to 'paste')
| -rw-r--r-- | paste/wareweb/cookie.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/paste/wareweb/cookie.py b/paste/wareweb/cookie.py index a1a2625..eb315c1 100644 --- a/paste/wareweb/cookie.py +++ b/paste/wareweb/cookie.py @@ -1,3 +1,4 @@ +from Cookie import SimpleCookie import timeinterval class Cookie(object): @@ -24,5 +25,17 @@ class Cookie(object): expires = time.strftime("%a, %d-%b-%Y %H:%M:%S GMT", expires) self.expires = expires - def __str__(self): - raise NotImplementedError + def __repr__(self): + return '<%s %s=%r>' % ( + self.__class__.__name__, self.name, self.value) + + def header(self): + c = SimpleCookie() + c[self.name] = value + c[self.name]['path'] = self.path + if self.expires is not None: + c[self.name]['expires'] = expires + if self.secure: + c[self.name]['secure'] = True + return str(c).split(':')[1].strip() + |
