After a long time, I am restarting this blog. I am now working on Django, AngularJS. But my love for Plone is not lost. Working on ZDesign has been a passion. Still working on it as part time personal project. When I migrated the code of ZDesign from Plone 2.5 to Plone 3, I have made a lot of mistakes and assumptions. Due to that, when I migrated to Plone 4, the maintenance has beeen a hell. Now, after I learnt from my mistakes, these are the things I am doing. Comment all the function and method calls Try to use as much of framework utility rather than custom code If custom code is written then add lot of documentation and comments about why that decision was taken to deviate from the framework Some of the problems I faced were Had written custom Popups for ATReferenceBrowser widget. That does not work in Plone 4 Had written multiple content types to use multi page schema where the next page was dependent on previous Input. Alas that has also become a pain to mai...
Sometimes we have to generate excel sheets or csv files or doc files which contain data of our content types. Generating Excel Sheets in Plone Let us see, how we can generate an excel sheet which contains names of Documents and their description. Add a script in Custom Folder with the sample code, shown below. Sample code to generate an excel sheet: # 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 counter = 0 print "Number|Name" documents = context.portal_catalog(portal_type='Document') for document in documents: counter += 1 doc = document.getObject() desc = doc.description dtit = doc.pretty_title_or_id() print "%d|%s|%s" % (counter,dtit,desc) RESPONSE.setHeader("Content-type","application/vnd.ms-excel") RESPONSE.setHeader("Content-disposition","attachment;filename= Doc...