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
alecs_myu
erp5
Commits
e2c177a3
Commit
e2c177a3
authored
Jan 26, 2018
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZSQLBrain: Raise instead of returning None for unavailable objects & properties
parent
3858dcdc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
16 deletions
+7
-16
product/ZSQLCatalog/Extensions/zsqlbrain.py
product/ZSQLCatalog/Extensions/zsqlbrain.py
+7
-16
No files found.
product/ZSQLCatalog/Extensions/zsqlbrain.py
View file @
e2c177a3
...
@@ -13,7 +13,6 @@
...
@@ -13,7 +13,6 @@
##############################################################################
##############################################################################
import
Acquisition
import
Acquisition
import
sys
import
traceback
import
traceback
from
ZODB.POSException
import
ConflictError
from
ZODB.POSException
import
ConflictError
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
ClassSecurityInfo
...
@@ -55,21 +54,13 @@ class ZSQLBrain(Acquisition.Implicit):
...
@@ -55,21 +54,13 @@ class ZSQLBrain(Acquisition.Implicit):
if
'path'
not
in
dir
(
self
)
and
'PATH'
not
in
dir
(
self
):
if
'path'
not
in
dir
(
self
)
and
'PATH'
not
in
dir
(
self
):
raise
ValueError
,
"Unable to getObject from ZSQLBrain if ZSQL Method "
\
raise
ValueError
,
"Unable to getObject from ZSQLBrain if ZSQL Method "
\
"does not retrieves the `path` column from catalog table."
"does not retrieves the `path` column from catalog table."
try
:
obj
=
self
.
aq_parent
.
unrestrictedTraverse
(
self
.
getPath
())
obj
=
self
.
aq_parent
.
unrestrictedTraverse
(
self
.
getPath
())
if
obj
is
None
:
if
obj
is
None
:
if
REQUEST
is
None
:
if
REQUEST
is
None
:
REQUEST
=
self
.
REQUEST
REQUEST
=
self
.
REQUEST
obj
=
self
.
aq_parent
.
portal_catalog
.
resolve_url
(
obj
=
self
.
aq_parent
.
portal_catalog
.
resolve_url
(
self
.
getPath
(),
REQUEST
)
self
.
getPath
(),
REQUEST
)
return
obj
return
obj
except
ConflictError
:
raise
except
:
LOG
(
"ZCatalog WARNING"
,
0
,
"Could not access object path %s"
%
self
.
getPath
(),
error
=
sys
.
exc_info
()
)
return
None
def
getProperty
(
self
,
name
,
d
=
_MARKER
,
**
kw
):
def
getProperty
(
self
,
name
,
d
=
_MARKER
,
**
kw
):
value
=
None
value
=
None
...
...
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