Writing a file in ZMI using python script
HI All, How can i create a file in ZMI using python script (It is working fine with python external method). Here I want to write the output of a query to a file in ZMI. from Products.PythonScripts.standard import html_quote, structured_text from Products.CMFCore.utils import getToolByName portal_catalog = getToolByName(context, 'portal_catalog') request = container.REQUEST RESPONSE = request.RESPONSE site_title = context.portal_url.getPortalObject().Title() site_desc = context.portal_url.getPortalObject().Description() site_url = context.portal_url.getPortalObject().absolute_url() query = {} query["portal_type"]='Article' query["sort_on"]='Date' query["sort_order"]='reverse' query["review_state"]='published' query['getMycategory']=my_id #our search category brains = portal_catalog.searchResults(**query) I want to write the output to file and access in ZMI. Thanks and regards, Kedar
--On 10. Juni 2008 16:28:14 +0530 Kedar Dash <kedar.dash@oneworld.net> wrote:
HI All,
How can i create a file in ZMI using python script (It is working fine with python external method). Here I want to write the output of a query to a file in ZMI.
from Products.PythonScripts.standard import html_quote, structured_text from Products.CMFCore.utils import getToolByName portal_catalog = getToolByName(context, 'portal_catalog')
request = container.REQUEST RESPONSE = request.RESPONSE site_title = context.portal_url.getPortalObject().Title() site_desc = context.portal_url.getPortalObject().Description() site_url = context.portal_url.getPortalObject().absolute_url()
query = {} query["portal_type"]='Article' query["sort_on"]='Date' query["sort_order"]='reverse' query["review_state"]='published' query['getMycategory']=my_id #our search category
brains = portal_catalog.searchResults(**query)
I want to write the output to file and access in ZMI.
What's the sense of saving the result? Write a temple calling your script and render the result based on the current state of your catalog. Andreas
----- Original Message ----- From: "Kedar Dash" <kedar.dash@oneworld.net> To: <Zope@zope.org> Sent: Tuesday, June 10, 2008 6:58 AM Subject: [Zope] Writing a file in ZMI using python script
HI All,
How can i create a file in ZMI using python script (It is working fine with python external method). Here I want to write the output of a query to a file in ZMI.
If your use case requires 'snapshots' of the data at various times, then you have some options for saving the results: 1- use an external method to write the results to the filesystem 2- use EXTFILE 3- save the results in a DTML Document 4- save the results in a property field on a folder 5- build your own Product (don't you just love Zope... more ways to solve a problem than anyone could hope for!) If, as was already mentioned, you don't need to retain snapshots of the data, then just call your script/template to build/display the results as and when they are required. Jonathan
participants (3)
-
Andreas Jung -
Jonathan -
Kedar Dash