Does anyone know if there is a way for me to aggregate comments made by people throughout a Plone site? I know how to turn comments/discussion on but is there a way to print or export them out into a text file or excel spreadsheet? Any help would be most appreciated. Thank you.
Probably would have to be a script at least. It would iterate over all content items and output any comments on them. Haven’t heard of an add on that does that though.
Comments are standard Plone content items that can be search through the portal_catalog. Iterating over them and generating a CSV file or a text file is straight forward and not more than some lines of code.
Thanks Kim and Andreas. So my next question will show my complete ignorance and lack of knowledge. I am familiar with extracting info from a MySQL database and output that information in any shape or form but I am completely clueless how to do so for a Zope database. Could you direct me to some references or examples to help me jump start this project? Thanks so much.
Created a page called "section" with comments. "Test" is my Plone site:
Test/division/section
Added a Python Script called "comments" in ZMI and placed it at Test//division/section:
Appended some codes from to the Python Script:
# Import a standard function, and get the HTML request and response objects.
from Products.PythonScripts.standard import html_quote
request = container.REQUEST
response = request.response
# Return a string identifying this script.
print "This is the", script.meta_type, '"%s"' % script.getId(),
if script.title:
print "(%s)" % html_quote(script.title),
print "in", container.absolute_url()
return printed
from plone import api
portal = api.portal.get()
assert portal.id == 'Test'
from plone import api
documents = api.content.find(
context=api.portal.get(), portal_type='Document')
I am sure I am doing something wrong because I am not see anything except for the default example that came with the script when I load Test/division/comments:
This is the Script (Python) "comments" in https://..../Test/division
It's because your script doesn't print anything after finding the documents... you should add another print statement and then move the return printed line to the bottom of your script.
I am getting an Insufficient Privileges page even when logged in as a Manager. I am sure I am doing something wrong:
# Example code:
# Import a standard function, and get the HTML request and response objects.
from Products.PythonScripts.standard import html_quote
request = container.REQUEST
response = request.response
# Return a string identifying this script.
#print "This is the", script.meta_type, '"%s"' % script.getId(),
#if script.title:
# print "(%s)" % html_quote(script.title),
#print "in", container.absolute_url()
from plone import api
portal = api.portal.get()
assert portal.id == 'Test'
from plone import api
documents = api.content.find(
context=api.portal.get(), portal_type='Document')
print documents
return printed
Thanks Kim. If that is the case, where should this script go? Should it be in a Plone product. If so, where in the Plone product? Ultimately, I would like to be able to consolidate or capture all comments made within a folder or a site.