Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Laurent S
erp5
Commits
49d40b36
Commit
49d40b36
authored
Nov 12, 2013
by
Jérome Perrin
Committed by
Arnaud Fontaine
Nov 13, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZODB Components: Allow use of ZODB Extensions as a brain.
Signed-off-by:
Arnaud Fontaine
<
arnaud.fontaine@nexedi.com
>
parent
58ec3221
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
product/ERP5Type/patches/DA.py
product/ERP5Type/patches/DA.py
+29
-0
No files found.
product/ERP5Type/patches/DA.py
View file @
49d40b36
...
@@ -340,3 +340,32 @@ DA.fromText = DA_fromText
...
@@ -340,3 +340,32 @@ DA.fromText = DA_fromText
DA.manage_FTPget = DA_manage_FTPget
DA.manage_FTPget = DA_manage_FTPget
DA.PUT = DA_PUT
DA.PUT = DA_PUT
DA._upgradeSchema = DA_upgradeSchema
DA._upgradeSchema = DA_upgradeSchema
# Patch to allow using ZODB components for brains
def getObjectMeta(original_function):
def getObject(module, name, reload=0):
# Modified version that ignore errors as long as the module can be be
# imported, which is enough to use a ZODB Extension as a brain.
try:
m = __import__('erp5.component.extension.%s' % module, globals(),
{}, 'erp5.component.extension')
o = getattr(m, name, None)
if o is None:
raise ImportError(
"
Cannot
get
%
s
from
erp5
.
component
.
extension
.
%
s
" % (name, module))
return o
except ImportError:
return original_function(module, name, reload=reload)
return getObject
# This get Object exists both in DA.getObject and App.Extensions.getObject, so
# we'll patch both
import Shared.DC.ZRDB.DA
Shared.DC.ZRDB.DA.getObject = getObjectMeta(Shared.DC.ZRDB.DA.getObject)
import App.Extensions
App.Extensions.getObject = getObjectMeta(App.Extensions.getObject)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment