Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in WARCRecord.__repr__() #3

Open
petri opened this issue Mar 2, 2012 · 1 comment
Open

Bug in WARCRecord.__repr__() #3

petri opened this issue Mar 2, 2012 · 1 comment

Comments

@petri
Copy link

petri commented Mar 2, 2012

The line in repr:

return "<WARCRecord: type=%r record_id=%s>" % (self['type'], self['record_id'])

results in an error. I don't know if the above line is wrong or whether there's a bug in how the attribute lookup chain is supposed to work. Changing the above line to this works though:

return "<WARCRecord: type=%r record_id=%s>" % (self.header.type, self.header.record_id)

Traceback below.


h=WARCHeader({"WARC-Type": "response"}, defaults=True)
r = WARCRecord(h)
r
Traceback (most recent call last):
File "", line 1, in
File "init.py", line 186, in repr
return "<WARCRecord: type=%r record_id=%s>" % (self['type'], self['record_id'])
File "init.py", line 172, in getitem
return self.header[name]
File "init.py", line 40, in getitem
return self._d[name.lower()]
KeyError: 'type'

@petri
Copy link
Author

petri commented Mar 2, 2012

Fix & test in koodaamo@c7b7165

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant