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
1
Merge Requests
1
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
Boxiang Sun
erp5
Commits
09a43898
Commit
09a43898
authored
Sep 27, 2011
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve the performance in ERP5Site_getKnowledgePadListForUser.
parent
0903f18e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
14 deletions
+8
-14
bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/ERP5Site_getKnowledgePadListForUser.xml
...rp5_knowledge_pad/ERP5Site_getKnowledgePadListForUser.xml
+7
-13
bt5/erp5_knowledge_pad/bt/revision
bt5/erp5_knowledge_pad/bt/revision
+1
-1
No files found.
bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/ERP5Site_getKnowledgePadListForUser.xml
View file @
09a43898
...
@@ -55,16 +55,9 @@ isAnon = context.portal_membership.isAnonymousUser()\n
...
@@ -55,16 +55,9 @@ isAnon = context.portal_membership.isAnonymousUser()\n
isAnonymousKnowledgePadUsed = request.get(\'is_anonymous_knowledge_pad_used\', 0);\n
isAnonymousKnowledgePadUsed = request.get(\'is_anonymous_knowledge_pad_used\', 0);\n
from zExceptions import Unauthorized\n
from zExceptions import Unauthorized\n
\n
\n
def safe_filter(func, list):\n
if default_pad_group == \'default_content_pad\':\n
ret = []\n
raise\n
append = ret.append\n
context.log(context.getRelativeUrl())\n
for e in list:\n
try:\n
if func(e):\n
append(e)\n
except Unauthorized:\n
pass\n
return ret\n
\n
\n
def filterKnowledgePadListForContext(results, mode, \n
def filterKnowledgePadListForContext(results, mode, \n
default_pad_group):\n
default_pad_group):\n
...
@@ -74,19 +67,20 @@ def filterKnowledgePadListForContext(results, mode, \n
...
@@ -74,19 +67,20 @@ def filterKnowledgePadListForContext(results, mode, \n
real_context = context\n
real_context = context\n
if context.getId() in context.Localizer.get_supported_languages():\n
if context.getId() in context.Localizer.get_supported_languages():\n
real_context = context.getParentValue() \n
real_context = context.getParentValue() \n
real_context_url = real_context.getRelativeUrl()\n
\n
\n
if mode == \'erp5_front\':\n
if mode == \'erp5_front\':\n
# leave only those not having a publication_section as \n
# leave only those not having a publication_section as \n
# this means belonging to root\n
# this means belonging to root\n
results =
safe_
filter(lambda x: x.getPublicationSection() is None and \\\n
results = filter(lambda x: x.getPublicationSection() is None and \\\n
x.getGroup() is None, results)\n
x.getGroup() is None, results)\n
elif mode == \'web_front\':\n
elif mode == \'web_front\':\n
# Web Site must at least one Pad referenced by context\n
# Web Site must at least one Pad referenced by context\n
results =
safe_filter(lambda x: x.getPublicationSectionValue() == real_context
and \\\n
results =
filter(lambda x: x.getPublicationSection() == real_context_url
and \\\n
x.getGroup() is None, results)\n
x.getGroup() is None, results)\n
elif mode == \'web_section\':\n
elif mode == \'web_section\':\n
# Web Sections, Web Pages can "reuse" tabs\n
# Web Sections, Web Pages can "reuse" tabs\n
results =
safe_filter(lambda x: x.getPublicationSectionValue() == real_context
or \\\n
results =
filter(lambda x: x.getPublicationSection() == real_context_url
or \\\n
x.getGroup() == default_pad_group, results)\n
x.getGroup() == default_pad_group, results)\n
return results\n
return results\n
\n
\n
...
...
bt5/erp5_knowledge_pad/bt/revision
View file @
09a43898
725
726
\ No newline at end of file
\ No newline at end of file
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