Skip to main content

How it started ..

In this blog I will share my experience how I approached for GSOC and my experience with plone in past few months. I had a great time while working with plone and I am learning a lot of new technologies with plone. People here in plone are really helpful and supportive and helped me a lot during my interaction with them. The journey was too good and full of surprises, success and defeat at different part of the journey.

Journey Starts...

After getting results for last year I have decided that I will give a try for GSOC next year, but at that point of time I had no Idea what I will do, How I will do and how will I proceed. Then During September I started looking for the organization that have been selected last year for the GSOC on the melange site. At first things were alien to me and I rarely understand anything on that site. I started reading about different organizations and and their projects. I mainly concentrated on organizations that involves python in it. Finally during the end of October I started reading about plone.  Plone has a very huge code base and Contains a lot of its own coding conventions and other rules. Its always fun working with plone as people on IRC(Instant relay chat) are too helpful and they helped me a lot in understanding the work flow of plone. Finally After 1 month I was able to install the core development environment into my local and I am in condition to start developing things for plone.

The Project Idea

After installation now the main problem is to find the problem for which I can work on to find its solution. So I started looking through the last few years GSOC ideas to get the idea of which type of projects the organization expected and the level of projects. While I was going through these things I came to know about the ticket (Ticket in plone means issue or problem ) which has been proposed by Tom few months ago and he has also tried to do the changes accordingly but there were lot of constraint of test cases that made it less possible to work on it. Then I have seen a GSOC project of 2007 that tried to work on creating a Plone.transform package and then after discussing a lot about all these with plone people on irc, the final conclusion is to create a new safe_html package that will contain html filter using lxml and its own test cases and a seperate package for html filter. Now as we have decided the project and there were few ways to achieve that goal and we have decided to go this way(to create a seperate package). This was the right time to start working on the project and start learning about plone.

Why We need to create a new safe_html over the existing one ?

Right now we have safe_html under the plone.transform project but that safe_html contains the dependencies of CMFDefault and we need to remove that dependency to filter html. We will use lxml or html cleaner which are quite faster than the current filter system. This will gonna help in increasing speed as well as accuracy for the html filtering.

Note 

Now the things in the blog is related to my project so most of them are technical stuff, I tried to explain it in layman form as much as possible but can't help more on it. :P

The new safe Experimental html filter

After creating a new add-on we have few things to do to setup that add-on. Basically we need to work for generic setup of the transform. Generic setup of safe_html for browser. Adding browser layer of safe_html. Create generic way to add filter to the browser. Register safe_html for the browser. Also add control panel for filter to the browser. Also create interface for filter in controlpanel.py under browser. By performing all these thing we will be able to set up out safe_html for the browser. This will create interface for filter control panel and also this will register a browser layer to safe_html. After this we need to setup profile for the transform by registering browser layer and control panel under the profile module. We will also register safe_html here.
We will register the profile created above for safe_html transform in the configuration.zcml file. Also configure the de registration of safe_html profile there. After that we will also configure the post install import step from safe_html. After that we will create marker interface that defines a browser layer.
We will also create interface for the safe_html transform for providing users the option to customize the HTML filter. These are the basic things required for setting up the safe_html so that it will register the browser layer so that it will work for cross browser. This will also register the safe_html profile and also create the interface for the safe_html. This will also register the filter control panel that will gonna be shown on the browser.
We will also have to replace the existing one with a transform of the same name, since TinyMCE and p.a.controlpanel address safe_html by it’s Transform name, rather than asking for one MIME to another MIME. (safe_html = getattr(getToolByName(self, 'portal_transforms'), 'safe_html'))

Automatic register and deregister for safe_html

For automatically registering the safe_html package for the developer we will write functions for register and deregister of the product. We will register safe_html on the installation of the add on so we will just write the registration of safe_html under the “post_install” function. We will also take care for the deregistration of the old safe_html from the portal_transform. So when any developer just install safe_html, the old safe_html will de register and the new safe_html will get registered and this will gonna work perfectly.
Other people who are just using plone site will use safe_html by adding an add-on in their “@@overview-controlpanel” and add safe_html. As they will add safe_html the old safe_html from portal_transform will be deregistered and  the new safe_html that add-on one will get registered. This way normal user can also use the safe_html transform.

Safe_html transform

Right now safe_html transform of the portal_transform is using CMFDefault dependencies. Our main aim of the project is to write transforms that are independent of CMFDefault. For this we will rewrite the whole safe_html transform again without CMFDefault. We will use lxml for filtering html (mostly) there are other options too to use for filtering html in safe_html transform like beautifulsoup, html_laundary.

Improve integration of tinyMCE with our HTML filter

Right now there are lot of issue related to the tinyMCE installation with the HTML filter like it ignores the HTML filter settings. We need to improve the tinyMCE integration with our own html_filter.


Automated tests for the transform

Write tests for the safe_html transform the proper tests for input and output of the html as written in safe_html of the portal_transform.  We will test our html filter with the real life documents and will check for faults in these cases and improve our html filter.We will also develop robot tests for the same.

 

Few More goals

 After discussing a lot the stretch goals with mentors the proposal can be extended by involving two more issues :-
  • Making tinyMCE use the safe_html filter configuration.
  • To create default and customized filter settings for safe_html.

 

Making tinyMCE use the safe_html filter configuration

As we will gonna integrate tinyMCE with our safe_html product, we will try to unify the filtering configuration and will try to match the filter criteria of safe_html and tinyMCE. As we know the safe_html does filtering on server side and tinyMCE works on client side and as the tinyMCE has its own filter criteria so there may be differences in the filtering for the text from safe_html and tinyMCE so we will try to configure tinyMCE according to safe_html so to match the filter criteria between them and also the filter criteria will match both at server and client.
In a nutshell we can say that we will try to match the filtering configuartion of tinyMCE as on server side we will use safe_html and now we will try to configure tinyMCE to use safe_html filtering configuration so that the filtering process can be unified across client and server.

To create default and customized filter settings for safe_html 

Here we will create a preset so that it will just change the control panel options for allowed tags, instead of having to choose tags yourself. So basically we will just toggle the control panel settings such that if user doesn't select tags for filtering then the default filter settings will be applied.
So in a nutshell we can say that for our safe_html we will have a default settings to filter the safe_html and when user selects the tags then we will shift things in control panel and then the customized filter will be activated.
These are the new two issues that are related to the proposal and that will gonna help in creating a better product. Though I have discussed these things on irc still there can be some modification in these things which can be handle during the development of the product.

27th  April

Finally after submitting proposal and also discussing that much things with the people on irc, my proposal has been accepted by Plone Foundation. Those are some of the unforgettable moments of life when I saw my name in the accepted projects list. I worked hard to get through it and finally got accepted for the google summer of code 2015. I will really like to continue the work with plone after GSOC also. I have learnt a lot of new technologies while working with plone and will learn a lot more new technologies this summer. 

That was really a nice experience for me but it was just the beginning, a lot more yet to come, a lot more to learn, a lot more to code and a lot more to enjoy.
This was the basic overview of the work flow of my work to be done this summer. Hope you enjoyed reading that blog.

happy Coding!!
Cheers,

Comments

Popular posts from this blog

Summarizing Summer

It was a great pleasure to work with great coders/developers at Plone Foundation and learning a lot from them during the course of the program. This blog is about summarizing the whole work I have done during this summer under Google summer of code 2016 under Plone Foundation. So my project mainly focuses on improving forms in plone for dexterity. We already have forms in plone for archetype. So there is a project named collective.easyform which basically provide forms for Plone as dexterity contenttype. The main focus of the project was to improve that code base. Make this stable for plone 5.0 and above. Make all the test cases passing for the code base. Try to cover tests as much as possible code base. Also implement functionalities for fields/actions of the forms in correct place. Make the plone more user friendly. Finally for users who want to migrate their already present forms in Plone Form Gen (PFG) which is archetype to easyforms which are dexterity based forms Plone. This w...

Testing the transform

Hello everyone, now the transform for filtering html is ready and the main task is to test the transform. For that purpose I have set up the whole test environment for my add-on using testing.py for unit tests and robot tests. After setting up the environment, now its time to first write unit test for transform that we have just created to check if they are all passing and the transform is working properly or not. For creating unit test I first created test class and in that class I just call the convert function that we have created in the transform and give the input as a data stream and pass it to convert function and then get the output as required. After writing few simple test cases like 30-35 then just ran these test cases and they ran successfully. Test cases ran successfully locally :- Travis is also happy ;) Yayayay!!! Finally test cases were passing so its like a milestone for the project and its completed. The PR got merged and things working good as expect...

One Last Time

Okay. So finally the list of GSOC'16 selected students is out and I am glad that my project got selected under Plone Foundation. I am really looking forward to work on my project which is basically improving the add-on named easyforms. I have already started working on the same project and will plan with my mentor for future work. I will keep this blog updated with the work I will be doing during the project as I did last summer too. Cheers.