Skip to content

Commit

Permalink
Merge pull request #18 from plone/python3
Browse files Browse the repository at this point in the history
Fix missing ``dict.has_key`` in Python3
  • Loading branch information
ale-rt authored Sep 22, 2018
2 parents 1988f81 + 0a5bbdd commit 038fca7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ New features:

Bug fixes:

- Fix missing ``dict.has_key`` in Python3
[ale-rt]

- Fix GopipIndex for py3
[pbauer]

Expand Down
10 changes: 7 additions & 3 deletions src/plone/app/folder/migration.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# -*- coding: utf-8 -*-
from Acquisition import aq_base
from Products.BTreeFolder2.BTreeFolder2 import BTreeFolder2Base as BTreeFolder
from Products.Five.browser import BrowserView
from logging import getLogger
from plone.app.folder.utils import checkpointIterator
from plone.app.folder.utils import findObjects
from plone.app.folder.utils import timer
from Products.BTreeFolder2.BTreeFolder2 import BTreeFolder2Base as BTreeFolder
from Products.Five.browser import BrowserView
from time import clock
from time import strftime
from transaction import get


logger = getLogger(__name__)


Expand All @@ -36,7 +37,10 @@ def migrate(self, folder):
folder = aq_base(folder)
assert isinstance(folder, BTreeFolder)
assert folder.getId() # make sure the object is properly loaded
has = folder.__dict__.has_key

def has(key):
return key in folder.__dict__

if has('_tree') and not has('_objects'):
return False # already migrated...
folder._initBTrees() # create _tree, _count, _mt_index
Expand Down

0 comments on commit 038fca7

Please sign in to comment.