Help: Have an instance, but can't access its info

Robb Shecter shecter at darmstadt.gmd.de
Thu May 27 07:51:35 EDT 1999


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





More information about the Python-list mailing list