Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make iterators behave like python 2 expects
  • Loading branch information
Paul Jukic committed Oct 29, 2019
commit 92aecb3f640a693113f4f0bc91fe68b17752ce5d
4 changes: 2 additions & 2 deletions mongorm/DocumentMetaclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __new__( cls, name, bases, attrs ):
attrs['_collection'] = collection

# find all fields and add them to our field list
for attrName, attrValue in attrs.items( ):
for attrName, attrValue in list(attrs.items( )):
if hasattr(attrValue, '__class__') and \
issubclass(attrValue.__class__, BaseField):
field = attrValue
Expand Down Expand Up @@ -109,7 +109,7 @@ def indexConverter( fieldName ):
newClass = superNew( cls, name, bases, attrs )

# record the document in the fields
for field in newClass._fields.values( ):
for field in list(newClass._fields.values( )):
#field.ownerDocument = newClass
field.setOwnerDocument( newClass )

Expand Down
2 changes: 1 addition & 1 deletion mongorm/fields/SafeDictField.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def deepCoded( dictionary, coder ):
toCode = deque( [dictionary] )
while toCode:
nextDictionary = toCode.popleft( )
for key, value in nextDictionary.items( ): # can't be iteritems as we're changing the dict
for key, value in list(nextDictionary.items( )): # can't be iteritems as we're changing the dict
if isinstance(key, basestring):
# Keys have to be strings in mongo so this should always occur
del nextDictionary[key]
Expand Down
4 changes: 2 additions & 2 deletions mongorm/queryset/Q.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def toMongo( self, document, forUpdate=False, modifier=None ):
'matches': ( None, '' ),
'imatches': ( None, 'i' ),
}
ALL_COMPARISONS = MONGO_COMPARISONS + REGEX_COMPARISONS.keys()
ALL_COMPARISONS = MONGO_COMPARISONS + list(REGEX_COMPARISONS.keys())
ARRAY_VALUE_COMPARISONS = ['all', 'in', 'nin']

comparison = None
Expand Down Expand Up @@ -132,7 +132,7 @@ def __or__( self, other ):
return self.do_merge( other, '$or' )

def __and__( self, other ):
if len( set( self.query.keys() ).intersection( other.query.keys() ) ) > 0:
if len( set( self.query.keys() ).intersection( list(other.query.keys()) ) ) > 0:
# if the 2 queries have overlapping keys, we need to use a $and to join them.
return self.do_merge( other, '$and' )
else:
Expand Down