Skip to content

Commit

Permalink
Made compatible with Zope 2.13 and ZODB 3.10.
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed Aug 4, 2010
1 parent 53e906e commit d03e45d
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 28 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -4,6 +4,7 @@ Changelog
1.1.1 - unreleased
------------------

- Made compatible with Zope 2.13 and ZODB 3.10.

1.1 - 2010-07-18
----------------
Expand Down
6 changes: 4 additions & 2 deletions Products/ZopeVersionControl/EventLog.py
Expand Up @@ -16,7 +16,9 @@
from AccessControl import ClassSecurityInfo
from BTrees.IOBTree import IOBTree
from Utility import _findUserId
import sys, time
import time

MAX32 = 2**31 - 1


class EventLog(Persistent):
Expand All @@ -33,7 +35,7 @@ def addEntry(self, entry):
if len(self._data):
key = self._data.minKey() - 1
else:
key = sys.maxint
key = MAX32
self._data[key] = entry

security.declarePrivate('getEntries')
Expand Down
9 changes: 6 additions & 3 deletions Products/ZopeVersionControl/VersionHistory.py
Expand Up @@ -23,7 +23,9 @@
from BTrees.IIBTree import IIBTree
from BTrees.OOBTree import OOBTree
from Acquisition import Implicit
import sys, time
import time

MAX32 = 2**31 - 1


class VersionHistory(Implicit, Persistent):
Expand All @@ -39,7 +41,7 @@ def __init__(self, history_id, object):
self._versions = OOBTree()
self._branches = OOBTree()
self._labels = OOBTree()
mainline = self.createBranch('mainline', None)
self.createBranch('mainline', None)
self.id = history_id

security = ClassSecurityInfo()
Expand Down Expand Up @@ -246,7 +248,8 @@ def append(self, version):
version to support ordering and date lookups."""
if len(self.m_order):
key = self.m_order.minKey() - 1
else: key = sys.maxint
else:
key = MAX32
self.m_order[key] = version.id
timestamp = int(version.date_created / 60.0)
self.m_date[timestamp] = key
Expand Down
17 changes: 11 additions & 6 deletions Products/ZopeVersionControl/ZopeRepository.py
Expand Up @@ -11,19 +11,24 @@
#
##############################################################################

__version__='$Revision: 1.5 $'[11:-2]

from App.class_init import default__class_init__ as InitializeClass
from App.special_dtml import DTMLFile
from SequenceWrapper import SequenceWrapper
import OFS, AccessControl
import AccessControl
import OFS
import Repository

# BBB Zope 2.12
try:
from OFS.role import RoleManager
except ImportError:
from AccessControl.Role import RoleManager


class ZopeRepository(
Repository.Repository,
AccessControl.Role.RoleManager,
OFS.SimpleItem.Item,
RoleManager,
OFS.SimpleItem.Item
):
"""The ZopeRepository class builds on the core Repository implementation
to provide the Zope management interface and other product trappings."""
Expand All @@ -38,7 +43,7 @@ class ZopeRepository(
{'label': 'Properties', 'action':'manage_properties_form',
'help': ('ZopeVersionControl', 'Repository-Properties.stx')},
) +
AccessControl.Role.RoleManager.manage_options +
RoleManager.manage_options +
OFS.SimpleItem.Item.manage_options
)

Expand Down
16 changes: 8 additions & 8 deletions Products/ZopeVersionControl/ZopeVersion.py
Expand Up @@ -11,19 +11,19 @@
#
##############################################################################

__version__='$Revision: 1.6 $'[11:-2]

from App.class_init import default__class_init__ as InitializeClass
from App.special_dtml import DTMLFile
import OFS, AccessControl
import Version

# BBB Zope 2.12
try:
from OFS.role import RoleManager
except ImportError:
from AccessControl.Role import RoleManager


class ZopeVersion(
Version.Version,
AccessControl.Role.RoleManager,
OFS.SimpleItem.Item
):
class ZopeVersion(Version.Version, RoleManager, OFS.SimpleItem.Item):
"""The ZopeVersion class builds on the core Version class to provide
the Zope management interface and other product trappings."""

Expand All @@ -38,7 +38,7 @@ class ZopeVersion(
{'label': 'Properties', 'action':'manage_properties_form',
'help': ('ZopeVersionControl', 'Version-Properties.stx')},
) +
AccessControl.Role.RoleManager.manage_options +
RoleManager.manage_options +
OFS.SimpleItem.Item.manage_options
)

Expand Down
15 changes: 10 additions & 5 deletions Products/ZopeVersionControl/ZopeVersionHistory.py
Expand Up @@ -11,16 +11,21 @@
#
##############################################################################

__version__='$Revision: 1.2 $'[11:-2]

from App.class_init import default__class_init__ as InitializeClass
from App.special_dtml import DTMLFile
import OFS, AccessControl, Acquisition
import OFS, AccessControl
import VersionHistory

# BBB Zope 2.12
try:
from OFS.role import RoleManager
except ImportError:
from AccessControl.Role import RoleManager


class ZopeVersionHistory(
VersionHistory.VersionHistory,
AccessControl.Role.RoleManager,
RoleManager,
OFS.SimpleItem.Item,
):
"""The ZopeVersionHistory build on the core VersionHistory class to
Expand All @@ -37,7 +42,7 @@ class ZopeVersionHistory(
{'label': 'Properties', 'action':'manage_properties_form',
'help': ('ZopeVersionControl', 'VersionHistory-Properties.stx')},
) +
AccessControl.Role.RoleManager.manage_options +
RoleManager.manage_options +
OFS.SimpleItem.Item.manage_options
)

Expand Down
7 changes: 3 additions & 4 deletions Products/ZopeVersionControl/__init__.py
Expand Up @@ -11,9 +11,7 @@
#
##############################################################################

__version__='$Revision: 1.4 $'[11:-2]

import ZopeRepository, OFS
import ZopeRepository
from App.class_init import default__class_init__ as InitializeClass
from App.ImageFile import ImageFile

Expand Down Expand Up @@ -66,6 +64,7 @@ def filtered_manage_options(self, REQUEST=None, method = method,


def registerIcon(filename):
setattr(OFS.misc_.misc_.ZopeVersionControl, filename,
from OFS import misc_
setattr(misc_.misc_.ZopeVersionControl, filename,
ImageFile('www/%s' % filename, globals())
)

0 comments on commit d03e45d

Please sign in to comment.