Commit 9e5cc219 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Various comments for needed improvements added to the code.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32002 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 97bbebc0
......@@ -54,17 +54,22 @@
<item>
<key> <string>_body</string> </key>
<value> <string>"""\n
This script returns the list of category (or tags) that are available in the current web section.\n
This script returns the list of category (or tags) which are available in the current web section.\n
It returns a python list of Category object. A Category object is really simple, as it has just \n
one property with a getter and a setter : title.\n
"""\n
\n
TODO: XXX-JPS\n
- this is way too slow - it will collapse the system\n
- have a look at mailreader code - there is something doing the same\n
- consider using virtual domains possibly - again look in email reader code\n
""" \n
\n
\n
## First step : retrieve the raw list\n
current_section = context.getWebSectionValue()\n
subject_list = []\n
\n
for item in current_section.WebSection_getDocumentValueList():\n
for item in current_section.WebSection_getDocumentValueList(): # XXX-JPS - this will fail for performance reasons\n
subject_list.extend([x for x in item.getSubjectList() if not x in subject_list])\n
\n
## Now, build the object list so that a Listbox can be used to display the results of this script.\n
......
......@@ -57,23 +57,27 @@
This script returns the blog post that must be displayed in the current section.\n
The blog post are filtered through the tag parameter that is retrieved through\n
the GET parameters.\n
\n
TODO: XXX-JPS\n
- why don\'t you explicitly define subject as a parameter of the method\n
- again, way too slow if this returns 1,000,000 documents\n
- appropriate way is to either call context.getDocumentValueList(subject=subject, **kw)\n
or context.getDocumentValueList(subject=subject), depending on your goal\n
what about ordering ...\n
"""\n
\n
request = container.REQUEST\n
\n
requested_tag = request.get(\'tag\')\n
requested_tag = request.get(\'tag\') # XXX-JPS it would be better to use subject which is the normal term in ERP5\n
current_section = context.getWebSectionValue()\n
result = []\n
for item in current_section.WebSection_getDocumentValueList():\n
for item in current_section.WebSection_getDocumentValueList(): # XXX-JPS this could be way too slow\n
if requested_tag is not None:\n
if requested_tag in item.getSubjectList():\n
result.append(item)\n
else:\n
result.append(item)\n
\n
result.sort(key = lambda x: x.effective_date)\n
result = result[::-1]\n
\n
return result\n
</string> </value>
</item>
......@@ -122,7 +126,6 @@ return result\n
<string>_getiter_</string>
<string>item</string>
<string>None</string>
<string>_getitem_</string>
</tuple>
</value>
</item>
......
......@@ -21,7 +21,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
<value> <string>XXX-JPS - how is css added to the list of CSS of a web site ? section ?</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -21,7 +21,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
<value> <string>XXX-JPS - no plurals in ERP5 - rename</string> </value>
</item>
</dictionary>
</pickle>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment