2. How I started Contributed to Plone
Plone is one of the most frequent organization that is part of Google
Summer of Code.
The IRC people really helped a lot during the initial phase.
Awesome Documentation.
Came across the ticket
https://dev.plone.org/ticket/14929 proposed by Tom when I was
looking for some project 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.
3. Cont..
Plone.transform was a try for the same during GSOC’07.
Finally decided to create a separate project for creating safe html
transform using lxml and not of CMF Default.
We also thought about using intelligent text from html transform.
Finally created a new add-on experimental.safe_html_transform.
It uses lxml to filter html.
4. Difficulties working with Plone
Plone is not a piece of cake for anyone new.
The Plone code base is too vast.
Things were alien for 1-2 months.
It was difficult for me to figure out from where to start.
The safe_html of portal_transform is quite old.
It was difficult to understand the code of old html filter which was
using CMF Default, SGML Parser.
5. Fun With Plone
Learnt how to work in team.
Learnt a lot of new things related to plone and how awesome plone
is.
How to write efficient code and how to document the work that
have been done.
Test Driven Development. One of the best part of plone.
Got to interact with cool people.
Got to know about the unique and new beers of Europe.
6. The main aim of the project
This is to be done with CMF Default in Plone and in this project also :-
7. The new safe_Html Filter
Lot of things required to setup the add-on.
Generic setup of the transform.
Register safe_html for the browser.
Add control panel for filter to the browser.
Create interface for filter under browser.
Setup profile for the transform by registering browser layer and control
panel under the profile module.
Deregister Profile as 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'))
8. Automatic register and deregister
for safe_html
Functions for register and deregister of the product.
Register safe_html on the installation of the add on.
Deregistration of the old safe_html from the portal_transform.
when any developer just install safe_html, the old safe_html will
deregister and the new safe_html will get registered.
People who are just using plone site will use safe_html by adding an
add-on in their “@@overview-controlpanel” and add
experimental.safe_html_trasform.
The old safe_html from portal_transform will be deregistered
and the new safe_html that add-on one will get registered.
10. New Releases at plone , releases
my sweat.
This was the time when CMF Plone 5.0.dev was released.
Not able to detect the issue as where CMF Plone was used as I have
already pinned the CMF Plone.
Plone.app.widget was not pinned and that is using CMF Plone so it
was creating an error and it took me a lot of time to solve
This was one of the scariest experience of my GSOC project.
11.
12.
13. Getting Control Panel for add-on
Two ways to create Control Panel
Either to overwrite the old cntrol panel of PortalTransform safe_html.
Create a separate control panel for our new safe_html add-on.
I choose the 2nd way to create a control panel and created a
separate control panel for the add-on.
14. Cont..
Register the control panel.
<!-- Filter Control Panel -->
<browser:page
name="safe_html_transform-settings"
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
layer="..interfaces.IExperimentalSafeHtmlTransformLayer"
class=".controlpanel.FilterControlPanel"
permission="experimental.safe_html.controlpanel.Filtering“
/>
15. Cont..
Adding Permissions for control panel
<configure
xmlns="http://namespaces.zope.org/zope">
<permission id="experimental.safe_html.controlpanel.Filtering"
title="Plone Site Setup: Filtering">
<role name="Manager"/>
<role name="Site Administrator"/>
</permission>
</configure>
16. The Transform Finally…
This is the script for filtering safe_html using lxml.
Converting the whole document into the tree form and then parsing
each node of the tree anf filtering accordingly.
Used the Cleaner class of lxml for creating Html Filter.
On add-on installation this transform have to filter the HTML instaed
of the safe_html transform of Portal_transform.
17. Why we need to port the transform
to lxml ?
To remove the CMF Default dependencies.
To make the filtering faster.
To make the filtering accurate and more optimized.
18. Testing the transform
Used Unit test to test the transform.
Using sample HTML to test the transform.
Using Automated Robot test and integration tests for testing the
whole add-on.
19.
20. How to make tinyMCE uses our new
transform in place of old transform?
It uses getToolByName in portal_transform to get the required
transform.
Rename our new transform to safe_html instead of some other
name.
we changed the name of our transform same as old one so that
tinyMCE sense it like a normal thing and no change. :P
21.
22. Things I learnt during the project
How to work with test driven Development (TDD).
How work in collaboration with people on a project.
How to work on big projects.
How to catch errors from the error logs.
How to keep logs for the huge projects. (Blogging, task managers
etc)
23. Plans ahead
Looking forward to learn more about plone
As of right now a lot more to learn, a lot more to develop and a lot
more to code.