ParTecs Weblog

Introducing PloneCaptcha…

March 31st, 2006

So we got the new and improved version of our website up, announcing all our new initiatives with lot of new content and even a bright new Contact us form. The site includes Geoff’s CacheFu with all its recent enhancements (did you know 1.0 is in beta now) making it fast and responsive, all the flash animations we did looks great (OK, kinda great…), the content looks sharp and concise, and I should be feeling relieved and at peace, but instead I am tossing and turnin with this nagging feeling that wont let me go to sleep…

Its the darn Contact us form. See, we have been doing a whole lot of of automated web testing using frameworks like mechanize, twill and zope.testbrowser and I know how easy it would be for some kook to write a script that will submit those Contact forms dozens to the minute creating a whole bunch of spam and bringing our server to its knees. In fact I met a couple of those kooks at the last beer party I went to.

If only I could add one of those squiggly text images and a word verification text box to our Plone site and thus ensure that only a real live human being (or an extremely well trained chimp) would be filling out our Plone Training request forms…

So I dig around. As it turns out this mechanism is called a Captcha. Short for “Completely Automated Public Turing test to tell Computers and Humans Apart”. Invented by Carnegie Mellon University after they decided to do something useful for furthering Computer Science. And there is a whole site that provides the service straight from their site. For free! All we need is to do a little bit of tailoring of our forms. Darn easy to make it work. What’s even better is that it looks like a slated feature for Plone 3.0. Of course only if the Accessibility freaks (you know who you are 😉 ) let it get there!

You know the rest of the story. I throw together the PloneCaptcha product. And with one stroke of metal you can have your own squiggly text image on your pages, thus ensuring that only a really well trained chimp could sign up for that Plone training of yours.

PS; The stroke of metal you need:

< div metal:use-macro=”here/captcha/macros/edit” />

And Get your PloneCatcha here!

Announcing DateBox 1.0.3 now compatible with Plone 2.1.2

March 27th, 2006

DateBox 1.0.2 was using toPortal time method in its page templates. This method has been deprecated. Now we are using toLocalizedTime instead of toPortalTime. Download the latest version from from ParTecs downloads

Thanks to Paul Roe for sending us the patch.

A Gmail like invite system for plone?

March 22nd, 2006

Ever wondered how cool it would be to have GMAIL kind of invitation system for your Plone site? Well I am going to talk about an PloneInvite product that we developed some time ago which does just that.

A webmaster would want to use invitation based registration for his site, if he wants to control who registers with the portal. An invite based registration system has a strong advantage when it comes to building online communities. The biggest advantage is, since only an existing member can send invites to the potential members, screening of the new members becomes and automatic process, this directly results in to an enriched online community.

Let me explain how PloneInvite works.

Once you install the product in your Plone portal(which like installing any other plone product.) it basically adds two actions to the site. One for the portal admin and another for the normal member.

  1. PloneInvite has invite quota for every member. Portal admin can only assign every member no of invitations, he can invite any one to join the website.
  2. Portal admin can also set an expiry date on all these invitations. He can also choose to enforce the email address (i.e.. Register a user with the same email id as mentioned by the invitee.).
  3. He can view status of the each and every invite he has allocated to the members.

A Member on the other hand can

  1. invite potential members if (s)he has been assigned invites by the portal admin.
  2. Member can choose to enforce the email address if portal admin has not already enforced it.
  3. Member can send invite to any email address along with his own message. After sending an invitation member can see the status of his invitation.
  4. An invitation has to be used within its validity period after that invited person will not be able use the same invitation to register with the site.

Well we had fun while developing this particular module. Watch this space for the release.

Announcing DateBox

March 21st, 2006

DateBox is a Plone Archetype Field using JavaScript, DHTML and advanced Date parsing to generate the date based on the grammar passed. The purpose of DateBox is to simplify the date entering process using grammatical terms we are all familiar with.

In simpler terms, that means, with DateBox installed on your site, users can enter dates like

  • Today
  • Tomorrow
  • next friday
  • 6 april
  • 7th may 2006

and the datebox widget will convert that into proper date formats (eg: YYYY-MM-DD).


Download: Get it here
DateBox is also available on under the Products section

1. Install as usual in your Products folder
2. Install in your Plone Site with the Quickinstaller tool
3. In your custom Archetype, add :
from Products.DateBox import DateBoxField
from Products.DateBox import DateBoxWidget
4. Use like a regular field/widget in your Type’s Schema. There is an included example.

Full usage example::
required = True,
widget = DateBoxWidget(lable = ‘Test DateBox’,
description = ‘Test DateBox Field’,
label = ‘Test Datebox’,
i18n_domain = ‘plone’)

A demo type is included. Set INSTALL_DEMO_TYPES = False in to disable it.

Low hanging fruit in the quest to Ajaxify Plone

March 16th, 2006

Seems like everyone is talking about Ajaxification these days. The corridors at ParTecs are abuzz with how this or that Plone feature is ripe for Ajax. And everyone is unanimous in their agreement that Plone really needs this, like Mandy Moore needs Clearasil. Mainly because every bit of the screen real estate in Plone is dynamic, and when you trigger a full screen refresh, there is so much magic going on behind the scenes that it boggles your mind. Every portlet on the sctreen, every tab and every menu item is computed on the fly and while it is a thrill for the upstart programmer, it costs many milli-seconds in screen refresh time, something that can kill even a semi-production site. So any effort to minimize these page refreshes and stop recomputing the whole world on each click will be welcomed in a big way by Plone users everywhere.

Take for instance the Calendar portlet. Nice, as long as you don’t click any button on it. And when you do this inadvertantly, the whole world comes to a screeching halt. And slowly as the new day dawns, you see an ugly URL instead of the page you thought you were supposed to be on. I guess it was so bad that has removed the Calendar portlet from their home page. Now if the calendar portlet could just be ajaxified and then refresh just itself, Plone users would be thrilled.

Or the way batching works when you do folder contents. The code that run behinds this is definitely not a sight for the faint-hearted. Essentially the whole list, even if it has a thousand items, is recalculated as you wade through each page even though only 10 items are displayed at a time. I do not mean to underplay the complex nature of this problem itself, but surely there is scope for optimization where only the required objects that fit in the current page are woken up. Ajax can definitely come to our rescue here.

Announcing PloneSkype

March 15th, 2006

PloneSkype is available for download. PloneSkype allows the Plone portal members to communicate with other portal members via Skype. PloneSkype takes communication on the plone platform beyond the asynchronous mode of email, discussion boards and blogs.

Features :

1. Portlet to display online Portal Members
2. Display the user status on the document created by him.
3. Display status of the user when you visit his/her home folder.
4. Option to set type of “skype presence” icons.
5. The portal member has the option of disabling their presence shown to the portal members.
6. Option to setup the status refresh interval.
PloneSkype Screenshot

Download it today and give it a spin.

Tell us how we can expand the idea of using Skype with Plone further and what features you would like to see added to PloneSkype.

Rock on!

Ajaxifying Archetypes

March 14th, 2006

Plone has had Archetypes for ages. Being someone from the pre-Archetype era who has hand rolled them a couple of times (TTWTypes and Formulator ring a bell, anyone?), AT was to me the greatest invention since sliced bread. I have used them in a few applications, and being able to whip out objects and forms and write code just to specify *business logic* was such a joy to behold!

So it causes me endless heartburn when some slick noobie comes along and shows me how she can generate content types on the fly with this great new framework called Cowboy or TurboCam or something without writing any SQL. Now you can bet your ZODB that what I would really like to do is tell her how I have been doing this even before she learnt to type [Ctrl-D] to exit from the python prompt. And then redirect her to all those Archetypes screens which function on less than 20 lines of code – most of which is actually data and may be a little validation. Instead, I blink. And you know why! Its that darn 4 lettered word that my Archetypes still can’t do. My Archetype screens are so hopelessly static and plain behind the times. If only we could have the Ajax-y sexiness of some of those frameworks.

So what do we need to do? Well… I head off to the google toolbar. AJAX+Archetypes. Only 2 relevant hits. Gnubi is working on FAT AT product. No releases yet. And Balazs Ree has a proposal which is basically at the level of the individual widgets.

But I am thinking along a different direction. Which is, basically eliminate the view/edit duality imposed by the templates. Instead, you have a single tab which will allow you to both view and also edit the page if you have the right permissions and save it — and all happens with the same URL and page template so it is ripe for AJAX-ification.

I am going to investigate this with the help of some good friends. Will keep you posted.

When Plone met Skype…

March 13th, 2006

Of late we have been using Skype more and more to communicate (both one-on-one and multiway conferencing) and have been quite happy with it. Something we are even happier with is our company intranet which is based on Plone and which we use heavily for asynchronous communication. So we thought it was pretty natural to have a product that would integrate Skype with Plone. Now we all know how the Plone world is littered with custom Products that solve pretty much any problem you can think of (and with some of them, you wonder who would ever need something like that?) So we went out to and began our hunt for such a product expecting to find about a dozen versions all covering the essential functions but differing in their UI and implementation details. And what do you think we found?

Zilch. Zipp. Nada. 3 degrees below…

Absolutely nothing whatsoever that resembled anything which even remotely addressed this need. It appears that Plone and Skype are two parallel worlds without any cross border terrorism 🙂
So we set out to write this product. And PloneSkype was conceived!

What did we want from such a product:

1. For starters, a portlet that would show all the members who were logged into Skype at that time and the ability to start a conversation with any of them

2. The ability to tie together a skype icon that will be displayed along the by-line which already appears on pages created by members

3. To be able to set your own skype id on your preferences page

4. Administrator to update skype id of members

5. Display if member is online on Member search page

This seems to be a good set of starting requirements. Se we started implementing these requirements and as it turns out, Skype provides a nice enough API to make much of this quiet easy to implement.And PloneSkype was born! The end product is available for download and install here.

Of course, with design and implementation the devil is in the proverbial details. Along the way we were confronted with issues for which we had to make a few trade-offs. Stay tuned for future installments here to find out and appreciate these design decisions.

Update: Plone Skype available for download 

Two algorithms to sort a dictionary by it’s value

February 27th, 2006

Here are 2 algorithms that I’ve use to sort dictionaries by their values. I have yet to profile both algorithms to see what works best in a senario. Personnally I feel the first method is more cognitive to Python developers.
Method 1 – Here I have converted the dictionary to a list of tuple (key, value) pairs. Further I have sorted the list by comparing the tuples second element.

>>> a = {1: 4, 2: 5, 4: 6, 7: 4} >>> sorted_dict = list(a.iteritems()) >>> sorted_dict.sort(lambda i1, i2: cmp(i1[1], i2[1])) >>> for key, value in sorted_dict: ... print key, value ... 1 4 7 4 2 5 4 6

Method 2 – In this case I have constructed a dictionary whose keys are the values of the dictionary I wanted sorted. The values of newly constructed dictionary is composed of a list of all the keys with the same value.

>>> for key, value in a.iteritems(): ... if sorted_dict.has_key(value): ... sorted_dict[value].append(key) ... continue ... sorted_dict[value] = [key] ... >>> for value, keys in sorted_dict.iteritems(): ... for key in keys: ... print key, value ... 1 4 7 4 2 5 4 6

Undo more than 20 transactions in Zope

February 27th, 2006

Some time ago I need to undo more that 20 transactions in one go. The zope interface displayed only 20 transactions per page. I did the unthinkable and tried to undo the transactions by opening the Zope database on the interpreter. There is a much simpler solution that skipped my mind. All one needed to do was manipulate the URL like so.

http://localhost:8080/manage_UndoForm ?first_transaction:int=20&last_transaction:int=100& PrincipiaUndoBatchSize:int=80

This might seem really obvious but it skipped my mind. And if you were still wondering how one would go about viewing the undo log of the Zope database. I have a small code snippet that will help you get started.

>>> from ZODB import FileStorage, DB
>>> storage = FileStorage.FileStorage('Data.fs')
>>> root=DB(storage).open().root()
>>> print storage.undoLog(0, 10)
« Previous PageNext Page »

Feedburner RSS

Enter your email address:

Delivered by FeedBurner



RSS Telematics Freedom

November 2022
« May    


Sky Sponsored by Web Hosting