'dict' object has no attribute 'has_key'