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
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
2a16967d
Commit
2a16967d
authored
May 30, 2013
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup
e9b75a27
(optimise ERP5Site_getKnowledgePadListForUser).
parent
e9b75a27
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
19 deletions
+11
-19
bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/ERP5Site_getKnowledgePadListForUser.xml
...rp5_knowledge_pad/ERP5Site_getKnowledgePadListForUser.xml
+11
-15
product/ERP5/tests/testKM.py
product/ERP5/tests/testKM.py
+0
-4
No files found.
bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/ERP5Site_getKnowledgePadListForUser.xml
View file @
2a16967d
...
...
@@ -56,31 +56,27 @@ isAnonymousKnowledgePadUsed = request.get(\'is_anonymous_knowledge_pad_used\', 0
\n
def filterKnowledgePadListForContext(results, mode, \n
default_pad_group):\n
filtered_results = []\n
append = filtered_results.append\n
# call getObject() explicitly so that further getter methods do not\n
# invoke getObject().\n
results = [x.getObject() for x in results]\n
# in Web Mode we can have a temporary object created based on current language, document by reference\n
real_context = context.Base_getRealContext()\n
real_context_url = real_context.getRelativeUrl()\n
if mode == \'erp5_front\':\n
# leave only those not having a publication_section as \n
# this means belonging to root\n
for x in results:\n
x = x.getObject()\n
if x.getPublicationSection() is None and x.getGroup() is None:\n
append(x)\n
results = filter(lambda x: x.getPublicationSection() is None and \\\n
x.getGroup() is None, results)\n
elif mode == \'web_front\':\n
# Web Site must at least one Pad referenced by context\n
for x in results:\n
x = x.getObject()\n
if real_context_url in x.getPublicationSectionList() and x.getGroup() is None:\n
append(x)\n
results = filter(lambda x: real_context_url in x.getPublicationSectionList() and \\\n
x.getGroup() is None, results)\n
elif mode == \'web_section\':\n
# Web Sections, Web Pages can "reuse" tabs\n
for x in results:\n
x = x.getObject()\n
if real_context_url in x.getPublicationSectionList() and x.getGroup() == default_pad_group:\n
append(x)\n
return filtered_results\n
results = filter(lambda x: real_context_url in x.getPublicationSectionList() or \\\n
x.getGroup() == default_pad_group, results)\n
return results\n
\n
\n
kw = {\'portal_type\': \'Knowledge Pad\',\n
...
...
product/ERP5/tests/testKM.py
View file @
2a16967d
...
...
@@ -222,10 +222,6 @@ class TestKM(TestKMMixIn):
self
.
assertEqual
(
1
,
len
(
website_pads
))
self
.
assertEqual
(
website
,
website_pads
[
0
].
getPublicationSectionValue
())
# depending on context we should have different list of pads for user
self
.
assertNotEqual
(
portal
.
ERP5Site_getKnowledgePadListForUser
(),
website
.
ERP5Site_getKnowledgePadListForUser
())
# check Web Section
pad_group
=
'default_section_pad'
#None
websection
=
self
.
websection
...
...
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