Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Binh
erp5
Commits
2ef1dd35
Commit
2ef1dd35
authored
12 years ago
by
Ivan Tyagov
Browse files
Options
Download
Email Patches
Plain Diff
Search for documents which reference us only if our reference itself is
following format defined in system preference level.
parent
a4011582
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
3 deletions
+20
-3
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_getImplicitPredecessorValueList.xml
...l_skins/erp5_dms/Base_getImplicitPredecessorValueList.xml
+2
-1
bt5/erp5_dms/bt/revision
bt5/erp5_dms/bt/revision
+1
-1
product/ERP5/Document/Document.py
product/ERP5/Document/Document.py
+17
-1
No files found.
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Base_getImplicitPredecessorValueList.xml
View file @
2ef1dd35
...
...
@@ -58,7 +58,8 @@ and make sure we get latest/most relevant version\n
should be reimplemented in SQL some sunny day.\n
"""\n
reference = context.getReference()\n
if reference is None:\n
if reference is None or not context.isSearchableReference():\n
# empty or not following format preference\n
return ()\n
\n
return context.Base_zGetImplicitPredecessorValueList(reference=reference)\n
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_dms/bt/revision
View file @
2ef1dd35
1269
\ No newline at end of file
1270
\ No newline at end of file
This diff is collapsed.
Click to expand it.
product/ERP5/Document/Document.py
View file @
2ef1dd35
...
...
@@ -317,6 +317,22 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin,
preferences.
"""
text
=
self
.
getSearchableText
()
# XXX getSearchableText or asText ?
return
self
.
_getSearchableReferenceList
(
text
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getSearchableReferenceList'
)
def
isSearchableReference
(
self
):
"""
Determine if current document's reference can be used for searching - i.e. follows
certain defined at system level preferences format.
"""
reference
=
self
.
getReference
()
return
len
(
self
.
_getSearchableReferenceList
(
reference
))
def
_getSearchableReferenceList
(
self
,
text
):
"""
Extract all reference alike strings from text using for that a
regular expression defined at system level preferences.
"""
regexp
=
self
.
portal_preferences
.
getPreferredDocumentReferenceRegularExpression
()
try
:
rx_search
=
re
.
compile
(
regexp
)
...
...
@@ -334,7 +350,7 @@ class Document(DocumentExtensibleTraversableMixin, XMLObject, UrlMixin,
tmp
[
key
]
=
None
for
group
,
group_item_tuple
in
tmp
.
keys
():
result
.
append
((
group
,
dict
(
group_item_tuple
)))
return
result
return
result
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getImplicitSuccessorValueList'
)
def
getImplicitSuccessorValueList
(
self
):
...
...
This diff is collapsed.
Click to expand it.
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