From: shecter at darmstadt.gmd.de (Robb Shecter)
Date: Thu, 27 May 1999 13:51:35 +0200
Subject: Help: Have an instance, but can't access its info
Message-ID: <374D31C7.80437A60@darmstadt.gmd.de>
Content-Length: 1143
X-UID: 1901                                                 

Hi,

I'm having a strange problem, and it'd be great if someone has an
idea...  I have the following code, which (I believe) returns a "Cookie"
object:

db = CookieDB(filename='/path/to/cookies')
cookie = db.lookup(domain='hostname.de', path='/servlet')
print cookie
print cookie.name

.....and here's the output:

[<cookielib.Cookie instance at 80f0e68>]
Traceback (innermost last):
  File "<stdin>", line 15, in ?
AttributeError: name

.....The source code (from Grail) for Cookie is:


class Cookie:
    max_age = None

    def __init__(self, domain, path, secure, expires,
                 name, value, others=None):
        self.domain = domain and string.lower(domain)
        self.isdomain = domain and domain[0] == '.'
        self.path = path
        self.secure = secure
        self.expires = expires and long(expires) or None
        self.name = name
        self.value = value
        if others:
            for k, v in others.items():
                setattr(self, k, v)

....The strange thing is that there are other places where I get a
Cookie instance, and I have no problem accessing the object's fields.

Thanks!
- Robb





