Merge remote branch 'upstream/master' into dev

This commit is contained in:
Nick Vlku Jr
2011-05-10 00:13:15 -04:00
5 changed files with 62 additions and 6 deletions

View File

@@ -508,6 +508,17 @@ class BaseDocument(object):
return True
return False
def __ne__(self, other):
return not self.__eq__(other)
def __hash__(self):
""" For list, dic key """
if self.pk is None:
# For new object
return super(BaseDocument,self).__hash__()
else:
return hash(self.pk)
if sys.version_info < (2, 5):
# Prior to Python 2.5, Exception was an old-style class
import types

View File

@@ -67,7 +67,7 @@ class Document(BaseDocument):
:param safe: check if the operation succeeded before returning
:param force_insert: only try to create a new document, don't allow
updates of existing documents
:param validate: validates the document; set to ``False`` for skiping
:param validate: validates the document; set to ``False`` to skip.
"""
if validate:
self.validate()

View File

@@ -663,9 +663,6 @@ class GridFSProxy(object):
def close(self):
if self.newfile:
self.newfile.close()
else:
msg = "The close() method is only necessary after calling write()"
warnings.warn(msg)
class FileField(BaseField):