Skip to content

Commit

Permalink
Fixed a hashability problem for dict subclasses.
Browse files Browse the repository at this point in the history
refs #165
  • Loading branch information
Eli Stevens committed May 26, 2011
1 parent 3f266f3 commit c4eabfc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions couchable/core.py
Expand Up @@ -342,9 +342,9 @@ def store(self, what, skip=None):
@return: The C{._id} of the C{what} parameter, or the list of such IDs if C{what} was a list.
"""
if skip is None:
self._skip_set = set()
self._skip_list = []
else:
self._skip_set = set([x for x in skip if hasattr(x, '_id') and hasattr(x, '_rev')])
self._skip_list = [x for x in skip if hasattr(x, '_id') and hasattr(x, '_rev')]

if not isinstance(what, list):
store_list = [what]
Expand All @@ -360,7 +360,7 @@ def store(self, what, skip=None):
mime_list = []
bulk_list = []
for (obj, doc, attachment_dict) in todo_list:
if obj not in self._skip_set:
if obj not in self._skip_list:
if 'pickles' in attachment_dict:
content_tup = attachment_dict['pickles']

Expand Down Expand Up @@ -533,7 +533,7 @@ def store(self, what, skip=None):
#self._obj_by_id[obj._id] = obj

del self._done_dict
del self._skip_set
del self._skip_list

if not isinstance(what, list):
return what._id
Expand Down Expand Up @@ -691,7 +691,7 @@ def _pack_object(self, parent_doc, data, attachment_dict, name, isKey, topLevel=

# Means this needs to be a new top-level document.
if base_cls and not topLevel:
if data not in self._skip_set:
if data not in self._skip_list:
self._store(data)

return '{}{}:{}'.format(FIELD_NAME, 'id', data._id)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -23,7 +23,7 @@

setup(
name='couchable',
version='0.3.0b4',
version='0.3.0b5',
author='Eli Stevens',
author_email='wickedgrey@gmail.com',
url='http://github.com/wickedgrey/couchable',
Expand Down

0 comments on commit c4eabfc

Please sign in to comment.