Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ https://github.com/zopefoundation/Zope/blob/5.x/CHANGES.rst.

- Update to newest compatible versions of dependencies.

- Use ZODB new ``class_factory`` parameter to fix registration of ZODB class
factory sometimes not beeing effective.
See `ZODB issue #420 <https://github.com/zopefoundation/ZODB/issues/420>`_.


6.0 (2026-03-04)
----------------
Expand Down
2 changes: 1 addition & 1 deletion constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ WSGIProxy2==0.5.1
WebOb==1.8.9
WebTest==3.0.7
ZConfig==4.3
ZODB==6.2
ZODB==6.3
Zope2==4.0
accessible-pygments==0.0.5
alabaster==1.0.0
Expand Down
13 changes: 0 additions & 13 deletions docs/locale/ja/LC_MESSAGES/operation.po
Original file line number Diff line number Diff line change
Expand Up @@ -1657,19 +1657,6 @@ msgid ""
"specify the connection class."
msgstr ""

#: ../../Schema
msgid ""
"class-factory (Zope2.Startup.datatypes.importable_name) (default: "
"Zope2.Startup.datatypes.simpleClassFactory)"
msgstr ""

#: ../../description:1
msgid ""
"Change the class factory function a database uses on a per-database basis"
" to support different class factory policy. Use a Python dotted-path name"
" to specify the class factory function."
msgstr ""

#: ../../Schema
msgid "container-class (string)"
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion requirements-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ WSGIProxy2==0.5.1
WebOb==1.8.9
WebTest==3.0.7
ZConfig==4.3
ZODB==6.2
ZODB==6.3
Zope2==4.0
beautifulsoup4==4.14.3
cffi==2.0.0
Expand Down
8 changes: 4 additions & 4 deletions src/Zope2/App/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def startup():
getattr(configuration, 'testinghome', None),
configuration.instancehome,
]
from .ClassFactory import ClassFactory
for location in custom_locations:
if not location:
continue
Expand All @@ -91,8 +92,10 @@ def startup():
DB = module.DB
databases.update(getattr(DB, 'databases', {}))
DB.databases = databases
DB.classFactory = ClassFactory
else:
DB = ZODB.DB(module.Storage, databases=databases)
DB = ZODB.DB(module.Storage, databases=databases,
class_factory=ClassFactory)

break
else:
Expand All @@ -116,9 +119,6 @@ def startup():
Zope2.DB = DB
Zope2.opened.append(DB)

from . import ClassFactory
DB.classFactory = ClassFactory.ClassFactory

# "Log on" as system user
newSecurityManager(None, AccessControl.users.system)

Expand Down
12 changes: 3 additions & 9 deletions src/Zope2/Startup/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,16 @@ class ZopeDatabase(ZODBDatabase):

def createDB(self, database_name, databases):
self.config.database_name = database_name
if self.config.class_factory is None:
from Zope2.App.ClassFactory import ClassFactory
self.config.class_factory = ClassFactory
return ZODBDatabase.open(self, databases)

def open(self, database_name, databases):
DB = self.createDB(database_name, databases)
if self.config.connection_class:
# set the connection class
DB.klass = self.config.connection_class
if self.config.class_factory is not None:
DB.classFactory = self.config.class_factory
return DB

def getName(self):
Expand Down Expand Up @@ -257,10 +258,3 @@ def getName(self, mount_path):
if name is None:
self._mountPathError(mount_path)
return name


def simpleClassFactory(jar, module, name, _silly=('__doc__',), _globals={}):
"""Class factory.
"""
m = __import__(module, _globals, _globals, _silly)
return getattr(m, name)
9 changes: 0 additions & 9 deletions src/Zope2/Startup/wsgischema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@
</description>
</key>

<key name="class-factory" datatype=".importable_name"
default="Zope2.Startup.datatypes.simpleClassFactory">
<description>
Change the class factory function a database uses on a
per-database basis to support different class factory policy.
Use a Python dotted-path name to specify the class factory function.
</description>
</key>

<key name="container-class" datatype="string">
<description>
Change the container class a (mounted) database uses on a
Expand Down
2 changes: 1 addition & 1 deletion versions-prod.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ WebTest = 3.0.7
WSGIProxy2 = 0.5.1
WebOb = 1.8.9
ZConfig = 4.3
ZODB = 6.2
ZODB = 6.3
beautifulsoup4 = 4.14.3
cffi = 2.0.0
multipart = 1.3.1
Expand Down
Loading