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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
erp5
Commits
f1b7b62c
Commit
f1b7b62c
authored
Apr 18, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display the constraint relative URL in checkConsistency
parent
968cd504
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
product/ERP5Type/ConsistencyMessage.py
product/ERP5Type/ConsistencyMessage.py
+16
-4
product/ERP5Type/mixin/constraint.py
product/ERP5Type/mixin/constraint.py
+5
-1
No files found.
product/ERP5Type/ConsistencyMessage.py
View file @
f1b7b62c
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
##############################################################################
##############################################################################
import
zope.interface
import
zope.interface
from
Acquisition
import
aq_base
from
Products.PythonScripts.Utility
import
allow_class
from
Products.PythonScripts.Utility
import
allow_class
from
Products.ERP5Type.ObjectMessage
import
ObjectMessage
from
Products.ERP5Type.ObjectMessage
import
ObjectMessage
...
@@ -36,7 +37,7 @@ class ConsistencyMessage(ObjectMessage):
...
@@ -36,7 +37,7 @@ class ConsistencyMessage(ObjectMessage):
"""
"""
Consistency Message is used for notifications to user after checkConsistency.
Consistency Message is used for notifications to user after checkConsistency.
"""
"""
zope
.
interface
.
implements
(
interfaces
.
IConsistencyMessage
,
)
zope
.
interface
.
implements
(
interfaces
.
IConsistencyMessage
,
)
def
__init__
(
self
,
constraint
,
object_relative_url
=
''
,
def
__init__
(
self
,
constraint
,
object_relative_url
=
''
,
...
@@ -47,6 +48,16 @@ class ConsistencyMessage(ObjectMessage):
...
@@ -47,6 +48,16 @@ class ConsistencyMessage(ObjectMessage):
ObjectMessage
.
__init__
(
self
,
object_relative_url
,
message
,
mapping
)
ObjectMessage
.
__init__
(
self
,
object_relative_url
,
message
,
mapping
)
self
.
description
=
constraint
.
description
self
.
description
=
constraint
.
description
self
.
class_name
=
constraint
.
__class__
.
__name__
self
.
class_name
=
constraint
.
__class__
.
__name__
# keep track of the relative URL of the constraint to have it included in
# the message
constraint_relative_url
=
getattr
(
aq_base
(
constraint
),
'relative_url'
,
None
)
if
not
constraint_relative_url
:
try
:
constraint_relative_url
=
constraint
.
getRelativeUrl
()
except
AttributeError
:
constraint_relative_url
=
constraint
.
id
self
.
constraint_relative_url
=
constraint_relative_url
self
.
__dict__
.
update
(
kw
)
self
.
__dict__
.
update
(
kw
)
def
__getitem__
(
self
,
key
):
def
__getitem__
(
self
,
key
):
...
@@ -66,8 +77,9 @@ class ConsistencyMessage(ObjectMessage):
...
@@ -66,8 +77,9 @@ class ConsistencyMessage(ObjectMessage):
return
self
.
getTranslatedMessage
()
return
self
.
getTranslatedMessage
()
def
__repr__
(
self
):
def
__repr__
(
self
):
return
"<ERP5Type.ConsistencyMessage for %s on %s (message: %s)>"
%
(
return
"<ERP5Type.ConsistencyMessage for %s %s on %s (message: %s)>"
%
(
self
.
class_name
,
self
.
object_relative_url
,
self
.
getTranslatedMessage
())
self
.
class_name
,
self
.
constraint_relative_url
,
self
.
object_relative_url
,
self
.
getTranslatedMessage
())
allow_class
(
ConsistencyMessage
)
allow_class
(
ConsistencyMessage
)
product/ERP5Type/mixin/constraint.py
View file @
f1b7b62c
...
@@ -201,4 +201,8 @@ class ConstraintMixin(IdAsReferenceMixin('_constraint'), Predicate):
...
@@ -201,4 +201,8 @@ class ConstraintMixin(IdAsReferenceMixin('_constraint'), Predicate):
# this(accessor_holder is on-memory object and is kept beyond transaction)
# this(accessor_holder is on-memory object and is kept beyond transaction)
# then ConnectionStateError occurs after a long time.
# then ConnectionStateError occurs after a long time.
import
copy
import
copy
accessor_holder
.
constraints
.
append
(
copy
.
deepcopy
(
self
.
aq_base
))
constraint_definition
=
copy
.
deepcopy
(
self
.
aq_base
)
# note the relative url of this constraint to display it later in
# checkConsistency messages
constraint_definition
.
relative_url
=
self
.
getRelativeUrl
()
accessor_holder
.
constraints
.
append
(
constraint_definition
)
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