Monday, August 18, 2008

plone.app.batch 0.1 release

That's right, I tagged the work done so far in what we can name the first release of this nice product.

In case you are interested on it, here it is: plone.app.batch-0.1

End of Summer

Don't scare, your summer is not ending yet. Don't scare, my winter here neither. The thing is that the Google Summer of Code period is finishing in about 10 hs, and last 2 weeks I worked hard adding and cleaning things.

A summary of the work done in the last 2 weeks can be summarized with the change log comments, which are:

  • Added, fixed and improved tests and documentation.
  • Minor imports fixes (and dependences changes) for working with plone.app.z3cform 0.5
  • BeautifulSoup dependence added, for making functional tests easier.
  • Fixed bug in editor: if unmarking object checkbox, now is excluded from the process (wasn't happening this).
  • utilities (datetimes functions and makeBatchEditableField) added to utils.py
  • Fixed ATValidation error class for displaying the message of the archetype validation error.
  • BatchDataManager added, which adapts content and IBatchField fields. This cleans the code of the BatchEditor adapter.
  • Dummy Lines field created, for handling different situations with archetypes Lines fields. So far, is only a Text field.
  • Reference field added, which uses first version of AccessibleWidget.
  • Accessible widget added: multiselect widget with javascript improvements, but also functional for non javascript browsers.
  • Images and Files now can be uploaded with batch editor.
  • In AT2Z3Field, removing plone.app.batch dependences, preparating the ground for making it a separated package.
  • AT2Z3Field tries to grab a vocabulary for the z3field from the objects that is trying to adapt.
  • Added TitledVocabulary (taken from PloneGetPaid), for easy creation of titled vocabularies.

refresh.txt now is plone.reload

Note: they are not the same thing, It's just the title of my post.

About 3 years ago, when I started to develope with plone/zope there was a nasty trick for speeding up development that consisted on putting an empty file named exactly "refresh.txt" in the root of your product. That way, each time you modified the code of your product, you were not pushed to restart your zope instance: you had to navigate thru an intricated path until you reach your product, and from there clicking on a magic refresh button saved us, reloading our code.

Sometimes, the code in your product was importing another modules, and then refresh were not able to reload things entirely, and there were some other oddities that I don't remember right now.

Anyway, that process worked fine for a while. But later things started to be more and more complex, until at some point the refresh thing ended been completely obsolete and non useful at all.

With the advent of Five and zcml configuration files, and probably many other new pieces on zope, refresh was wounded death.

Mourning and grief... I wored black clothes for a couple of weeks, but, slowly, I started back my normal life.

There I was when last week Anthony, who abandoned Plone development for a couple of years, asked me about our old friend refresh.txt... I started to carefully choose the words, trying to not hurt him with the terrible news, when I though "Hey, there must be some replacement out there".

I was doing a fruitless search when Matthew Wilkes introduced me the newest kid on the block: plone.reload. It simply works, and there is no need to explicitly tell it what to reload, and it is also able to reload zcml configurations!. What a joy.

Unfortunately, there are some issues on the product yet, but it's actively developed, and regardless those things, it's very useful.

- What issues did you find?

- Only this one: Does not work if you touch code in a class method that calls super. The thing is simple: the module is reloaded, so, when calling super, an internal isinstance call fail.

Accessible Multi Select Widget

While using plone.z3cform (a plone wrapper for z3c.form lib) I felt a bit frustrated when I could not find a multi select widget that were functional for a non javascript browser.

Yes, I know what you may want to say, that in the current century we web developers should not worry any more for non javascript browsers, but I think we do have to.

According to this stats (w3schools, and the counter) is about 5% of the users, and although this number is decreasing, I think that is still a considerably portion.

So, what I did is a widget that consist of a set of 3 html select fields. The actual
one (the one with the name that the form action will use) is the one that is viewed by default in a non javascript browser, and is something like in the first screen shoot.

If you have javascript enabled, the widget append a function to the onload event of the window, and then the default basic view is hidden, and shown a nicer one instead, like the one in the second shot. And each time the user do things on the nicer widget, that selection/de-selection action is reflected in the actual hidden select input.

Where is the code of the widget? So far, is inside my plone.app.batch product, but if anyone thinks may be useful we can incorporate it on a more generic package.

On this same aspect, I would like to do similar kind of things with other widgets, and I open to hear suggestions.

Olim.pyc

Are you a sports fan but you have to work instead of been watching the olympic games?

Would you like to be notified each time someone earns a medal, without needing to have a browser opened?

Well, more or less that was my situation, and that's why I dediced to create Olim.pyc. Unfortunately, during these days I was finishing (or at least working hard on it) my GSoC project, so I made a very rough version of what could be a much nicer program.

What does Olim.pyc do? This is an screen-shot of it:


It consults the official Olympic games site and refresh it's internal database. Each time some country increase it's medals counter, you will be warned. If you want to consult how the medals ranking is, just clicking on the Olim.pyc systray icon will open a summary like this one:



Wanna make a try? You'll need a linux box, with BeautifulSoup and libnotify installed. It's done in Python, of course, but there is no decent linux on earth without a Python installed.

You can download an alpha release here (don't expect a real release never).

Disclaimer: I could not make libnotify to use a certain font, and the formatting options it provides are too small for creating a decent table, so don't be surprised if you find yourself having an ugly layout.
I'll be glad of you want to help me to improve my fast and nasty code.

Of course, it's GPL.