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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eugene Shen
erp5
Commits
982b42ba
Commit
982b42ba
authored
Jan 26, 2017
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Catalog: implment getDocumentValueList() in CatalogTool.
parent
216a2c03
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
87 additions
and
67 deletions
+87
-67
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.py
.../portal_skins/erp5_web/WebSection_getDocumentValueList.py
+13
-1
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.xml
...portal_skins/erp5_web/WebSection_getDocumentValueList.xml
+1
-1
product/ERP5/Document/WebSection.py
product/ERP5/Document/WebSection.py
+32
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Site_getSearchResultList.py
...em/portal_skins/erp5_core/ERP5Site_getSearchResultList.py
+2
-5
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_getDocumentValueList.catalog_keys.xml
...l_innodb/SQLCatalog_getDocumentValueList.catalog_keys.xml
+2
-0
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_getDocumentValueList.py
...alog/erp5_mysql_innodb/SQLCatalog_getDocumentValueList.py
+10
-17
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_getDocumentValueList.xml
...log/erp5_mysql_innodb/SQLCatalog_getDocumentValueList.xml
+2
-2
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_zGetDocumentValueList.catalog_keys.xml
..._innodb/SQLCatalog_zGetDocumentValueList.catalog_keys.xml
+2
-0
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_zGetDocumentValueList.sql
...og/erp5_mysql_innodb/SQLCatalog_zGetDocumentValueList.sql
+2
-2
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_zGetDocumentValueList.xml
...og/erp5_mysql_innodb/SQLCatalog_zGetDocumentValueList.xml
+3
-2
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/template_catalog_method_id_list
...5_mysql_innodb_catalog/bt/template_catalog_method_id_list
+2
-0
product/ERP5Catalog/CatalogTool.py
product/ERP5Catalog/CatalogTool.py
+16
-0
product/ERP5Type/Core/Folder.py
product/ERP5Type/Core/Folder.py
+0
-37
No files found.
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.py
View file @
982b42ba
return
context
.
Base_getDocumentValueList
(
**
kw
)
# First find the Web Section or Web Site we belong to
search_context
=
context
.
getWebSectionValue
()
if
all_versions
is
None
:
all_versions
=
search_context
.
getLayoutProperty
(
'layout_all_versions'
,
default
=
False
)
if
all_languages
is
None
:
all_languages
=
search_context
.
getLayoutProperty
(
'layout_all_languages'
,
default
=
False
)
return
context
.
getPortalObject
().
portal_catalog
.
getDocumentValueList
(
search_context
=
search_context
,
all_versions
=
all_versions
,
all_languages
=
all_languages
,
**
kw
)
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/WebSection_getDocumentValueList.xml
View file @
982b42ba
...
...
@@ -50,7 +50,7 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
**kw
</string>
</value>
<value>
<string>
all_versions=None, all_languages=None,
**kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
...
...
product/ERP5/Document/WebSection.py
View file @
982b42ba
...
...
@@ -312,6 +312,38 @@ class WebSection(Domain, DocumentExtensibleTraversableMixin):
return
result
security
.
declareProtected
(
Permissions
.
View
,
'getDocumentValueList'
)
def
getDocumentValueList
(
self
,
**
kw
):
"""
Return the list of documents which belong to the
current section. The API is designed to
support additional parameters so that it is possible
to group documents by reference, version, language, etc.
or to implement filtering of documents.
This method must be implemented through a
portal type dependent script:
WebSection_getDocumentValueList
"""
cache
=
getReadOnlyTransactionCache
()
if
cache
is
not
None
:
key
=
(
'getDocumentValueList'
,
self
)
+
tuple
(
kw
.
items
())
try
:
return
cache
[
key
]
except
KeyError
:
pass
result
=
self
.
_getTypeBasedMethod
(
'getDocumentValueList'
,
fallback_script_id
=
'WebSection_getDocumentValueList'
)(
**
kw
)
if
cache
is
not
None
:
cache
[
key
]
=
result
if
result
is
not
None
and
not
kw
.
get
(
'src__'
,
0
):
result
=
[
doc
.
__of__
(
self
)
for
doc
in
result
]
return
result
security
.
declareProtected
(
Permissions
.
View
,
'getPermanentURL'
)
def
getPermanentURL
(
self
,
document
,
view
=
True
):
"""
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Site_getSearchResultList.py
View file @
982b42ba
# Use getDocumentValueList for ERP5 Web
if
context
.
getWebSectionValue
()
is
None
:
search_method
=
context
.
getPortalObject
().
portal_catalog
else
:
search_method
=
context
.
getDocumentValueList
search_method
=
getattr
(
context
,
'getDocumentValueList'
,
context
.
getPortalObject
().
portal_catalog
)
return
search_method
(
**
kw
)
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_getDocumentValueList.catalog_keys.xml
0 → 100644
View file @
982b42ba
<catalog_method>
</catalog_method>
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base
_getDocumentValueList.py
→
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog
_getDocumentValueList.py
View file @
982b42ba
...
...
@@ -43,18 +43,10 @@ from Products.ZSQLCatalog.SQLCatalog import SimpleQuery, ComplexQuery
from
zExceptions
import
Unauthorized
try
:
portal
=
container
.
getPortalObject
()
kw
=
portal
.
portal_catalog
.
getSQLCatalog
().
getCannonicalArgumentDict
(
kw
)
# Try to find the Web Section or Web Site we belong to
current_section
=
context
.
getWebSectionValue
()
if
current_section
is
None
:
current_section
=
context
else
:
if
all_versions
is
None
:
all_versions
=
current_section
.
getLayoutProperty
(
'layout_all_versions'
,
default
=
False
)
if
all_languages
is
None
:
all_languages
=
current_section
.
getLayoutProperty
(
'layout_all_languages'
,
default
=
False
)
portal
=
context
.
getPortalObject
()
kw
=
context
.
getCannonicalArgumentDict
(
kw
)
if
search_context
is
None
:
search_context
=
context
# Build the list of parameters
if
not
language
:
...
...
@@ -86,7 +78,7 @@ try:
if
all_versions
:
if
not
all_languages
:
kw
[
'language'
]
=
language
return
current_section
.
searchResults
(
src__
=
src__
,
**
kw
)
return
search_context
.
searchResults
(
src__
=
src__
,
**
kw
)
else
:
group_by_list
=
set
(
kw
.
get
(
'group_by_list'
,
[]))
if
all_languages
:
...
...
@@ -100,10 +92,11 @@ try:
kw
.
setdefault
(
'select_dict'
,
{}).
update
(
(
x
.
replace
(
'.'
,
'_'
)
+
'__ext__'
,
x
)
for
x
in
extra_column_set
if
not
x
.
endswith
(
'__score__'
))
return
current_section
.
Base_zGetDocumentValueList
(
language
=
language
,
all_languages
=
all_languages
,
src__
=
src__
,
kw
=
kw
)
return
context
.
SQLCatalog_zGetDocumentValueList
(
search_context
=
search_context
,
language
=
language
,
all_languages
=
all_languages
,
src__
=
src__
,
kw
=
kw
)
except
Unauthorized
:
return
[]
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base
_getDocumentValueList.xml
→
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog
_getDocumentValueList.xml
View file @
982b42ba
...
...
@@ -50,11 +50,11 @@
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
language=None, all_languages=None, all_versions=None, now=None, src__=0, **kw
</string>
</value>
<value>
<string>
search_context=None,
language=None, all_languages=None, all_versions=None, now=None, src__=0, **kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base
_getDocumentValueList
</string>
</value>
<value>
<string>
SQLCatalog
_getDocumentValueList
</string>
</value>
</item>
</dictionary>
</pickle>
...
...
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog_zGetDocumentValueList.catalog_keys.xml
0 → 100644
View file @
982b42ba
<catalog_method>
</catalog_method>
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base
_zGetDocumentValueList.sql
→
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog
_zGetDocumentValueList.sql
View file @
982b42ba
<
dtml
-
let
query
=
"
(_.has_key('buildSQLQuery') and buildSQLQuery or
portal_catalog.buildSQLQuery)(query=portal_catalog.getSecurityQuery(**kw), **kw)"
<
dtml
-
let
query
=
"
getattr(search_context, 'buildSQLQuery',
portal_catalog.buildSQLQuery)(query=portal_catalog.getSecurityQuery(**kw), **kw)"
selection_domain
=
"kw.get('selection_domain', None)"
selection_report
=
"kw.get('selection_report', None)"
optimizer_switch_key_list
=
"
portal_catalog.getSQLCatalog().
getOptimizerSwitchKeyList()"
>
optimizer_switch_key_list
=
"getOptimizerSwitchKeyList()"
>
<
dtml
-
comment
>
Currently
,
there
is
no
other
choice
to
implement
this
method
as
an
SQL
catalog
until
SQLCatalog
...
...
bt5/erp5_base/SkinTemplateItem/portal_skins/erp5_base/Base
_zGetDocumentValueList.xml
→
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/SQLCatalog
_zGetDocumentValueList.xml
View file @
982b42ba
...
...
@@ -22,7 +22,8 @@
</item>
<item>
<key>
<string>
arguments_src
</string>
</key>
<value>
<string>
language\r\n
<value>
<string>
search_context\r\n
language\r\n
all_languages\r\n
kw
</string>
</value>
</item>
...
...
@@ -50,7 +51,7 @@ kw</string> </value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base
_zGetDocumentValueList
</string>
</value>
<value>
<string>
SQLCatalog
_zGetDocumentValueList
</string>
</value>
</item>
<item>
<key>
<string>
max_cache_
</string>
</key>
...
...
product/ERP5/bootstrap/erp5_mysql_innodb_catalog/bt/template_catalog_method_id_list
View file @
982b42ba
erp5_mysql_innodb/SQLCatalog_catalogTransformation
erp5_mysql_innodb/SQLCatalog_catalogTransformationList
erp5_mysql_innodb/SQLCatalog_getDocumentValueList
erp5_mysql_innodb/SQLCatalog_zGetDocumentValueList
erp5_mysql_innodb/SQLCatalog_makeFullTextQuery
erp5_mysql_innodb/SQLCatalog_makeQuickSearchQuery
erp5_mysql_innodb/SQLCatalog_makeSearchTextQuery
...
...
product/ERP5Catalog/CatalogTool.py
View file @
982b42ba
...
...
@@ -1126,5 +1126,21 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
db
.
query
(
r
)
return
src
# XXX which permission ?
# XXX API parameters should be explicitly defined in interface
# instead of **kw
def
getDocumentValueList
(
self
,
**
kw
):
"""
Return the list of documents which belong to the
current section. The API is designed to
support additional parameters so that it is possible
to group documents by reference, version, language, etc.
or to implement filtering of documents.
This method must be implemented through a
catalog method script :
SQLCatalog_getDocumentValueList
"""
return
self
.
getSQLCatalog
().
SQLCatalog_getDocumentValueList
(
**
kw
)
InitializeClass
(
CatalogTool
)
product/ERP5Type/Core/Folder.py
View file @
982b42ba
...
...
@@ -42,7 +42,6 @@ from Products.CMFCore.CMFCatalogAware import CMFCatalogAware
from
Products.CMFCore.PortalFolder
import
ContentFilter
from
Products.ERP5Type.Base
import
Base
from
Products.ERP5Type.Cache
import
getReadOnlyTransactionCache
from
Products.ERP5Type.ConsistencyMessage
import
ConsistencyMessage
from
Products.ERP5Type.CopySupport
import
CopyContainer
from
Products.ERP5Type
import
PropertySheet
...
...
@@ -432,42 +431,6 @@ class FolderMixIn(ExtensionClass.Base):
else
:
return
None
security
.
declareProtected
(
Permissions
.
View
,
'getDocumentValueList'
)
def
getDocumentValueList
(
self
,
**
kw
):
"""
Return the list of documents which belong to the
current section. The API is designed to
support additional parameters so that it is possible
to group documents by reference, version, language, etc.
or to implement filtering of documents.
This method must be implemented through a
portal type dependent script like :
Base_getDocumentValueList
"""
cache
=
getReadOnlyTransactionCache
()
if
cache
is
not
None
:
key
=
(
'getDocumentValueList'
,
self
)
+
tuple
(
kw
.
items
())
try
:
return
cache
[
key
]
except
KeyError
:
pass
_getTypeBasedMethod
=
getattr
(
self
,
'_getTypeBasedMethod'
,
None
)
if
_getTypeBasedMethod
is
None
:
result
=
self
.
Base_getDocumentValueList
(
**
kw
)
else
:
result
=
_getTypeBasedMethod
(
'getDocumentValueList'
,
fallback_script_id
=
'Base_getDocumentValueList'
)(
**
kw
)
if
cache
is
not
None
:
cache
[
key
]
=
result
if
result
is
not
None
and
not
kw
.
get
(
'src__'
,
0
):
result
=
[
doc
.
__of__
(
self
)
for
doc
in
result
]
return
result
def
_recurseCallMethod
(
self
,
method_id
,
method_args
=
(),
method_kw
=
{},
restricted
=
False
,
id_list
=
None
,
min_id
=
None
,
**
kw
):
"""Run a script by activity on objects found recursively from this folder
...
...
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