Sunday, January 27, 2008

What has happened to plonecollectorng ?

One my favorite product on plone is the plonecollectorng. I like all the functionality that it offers. It was imo ahead of it's time. I was actually planning to use it to build part of company's portal as the customer care center but as I found out later it seems that plonecollectorng has disappeared from the plone world. When I ask on the channel it's people who answer me only do so in whispers and would rather not have anything to do with it and even went so far as to suggest me a new collector called poi. I felt so much like Charleston Heston in Planet of the Apes !

I am sorry I lost touch with the plone world a little while, but can anyone actually explain to me what has happened to plonecollectorng ?

Saturday, January 26, 2008

We are live on the unoffical python planet

Python programming has been slow this few weeks as I am busy working up business deals all around, with three plone presentations set up for next week. Life is busy but good. We have generated some local interest here in Malaysia especially with the ISO standardizations in using plone as their document management system. With plone's multitude of functionality, a full blown document management system is just a few clicks away.

On the blog side I happy to report that this blog is now part of the unofficial python planet community ! So we are live on two channels now ! Yayy !!

Wednesday, January 9, 2008

Plone - redirecting authenticated users to member folder after login

Another in the useful-hack-department

Task :

After login you want authenticated users to be directed straight to their folders. Normally, after login, the users are redirected to the where ever they wanted to go in the first place.

Solution :

The file that controls what happens after a user logs in is the file CMFPlone/skins/plone_login/login_next.cpy. So customize this file and edit it.

Basically what is happening here is, login_next.cpy will look for a variable called came_from. If the came_from variable is set, then it will redirect the user to whatever came_from is set as. At this point I knew what I had to do, the challenge was to find the right methods to achieve what I want. I needed the method to tell me what is the authenticated user's home folder. After some digging around I found it.

Just add this line to the login_next.cpy, somewhere at line 25 :

home_url = membership_tool.getAuthenticatedMember().getHomeFolder().absolute_url()
came_from = home_url

It's pretty evident what this two lines does, it basically calls the membership_tool's methods to determine the authenticated user's home folder's url and set's came_from to that value. After adding those two lines in there, login and logout again and all of your authenticated user's should be redirected to their home folders after login. Happy hacking !

Tuesday, January 8, 2008

plone-3.0.5 is out and it's great

Plone 3.0.5 is out, finally ! I was waiting for this release for it to solve a bug with archetypes where when I used argouml to generate a plone type, it's required fields did not work correctly. Well, I tested the release out on my lappie and now it works like a charm. Damn this is sweet !

For the uninitiated few who have been living under a big tempurung for like a year, archgenxml is product for plone which generates plone products from your uml diagrams. So what this means to you o' tired developer is, YOU DON'T HAVE TO TOUCH ONE LINE OF CODE to have a working plone product at your disposal.... YES ! Don't adjust your browser text size, you read me right the first time. YOU DO NOT HAVE TO EVEN TOUCH ONE LINE OF CODE. Just design your application using something like argouml, feed it to argenxml and BOOM BAM in as long as it takes for you to restart your plone instance, you have your product sitting there waiting for you.

Take your first step on your journey here and start taking on as many plone projects as you can ... woohoo !! Damn this product is so good it should not be free !

Zope's best kept secrets

Stumbled upon this gem of an article during one of my searches, the article does a decent job of summarizing what are the best features inside zope but wonders why zope is still the best kept secret. Reading that reminded me of a video I saw at Check it out here. Okay, so this is a plone screencast, but I shrudder to think of zope's future if the same people are involved. I mean come on, this guy is supposed to be involved in marketing plone and he is boring me to tears ! That ain't supposed to be happening. I am supposed to feel inspired after one of these right ? Heck at least the grok presentation was funny ....

I mean I can understand if English is not his language, but give a little more enthusiasm than that huh ... ?! Put me up infront of a stage of people and I can sell plone better than that pal. More thought should be given into zope / plone marketing if this is the state of the team involved with marketing it now.

More good words for z3

Electric Duncan some more good things to say about zope3 or z3 here, this time it's vs django. To a certain extent I do agree with some of the things mentioned in that article. At times I do feel that I am trying to bend django to my will when I was coding my application, but alas, I am too green in z3 to give any meaningful comment regarding the comparison. Here, duncan mentions something that piqued my interest - Coding his application in z3, with learning curve thrown in took him two days ! Now that is a wow-ser for me !

Although at the back of my mind the article look more slanted towards zope than django which might explain why the author felt more at home with z3, but then it's a good read after all and has inspired me more to go towards giving z3 another serious look for my web development work.

Monday, January 7, 2008

grok zope

Just finished my tutorial and much kudos to the author for making zope easy. The tutorial is well paced and newbies should have no problems understanding some of the concepts of zope, although to be honest when the part about the persistence come rolling along, it would pay to have some zope experience.

To me it is good to see zope reinvent ( or in this case re architect ) itself to meet the demands of web application frameworks of today. It used to be that people never looked twice at zope when you needed to deploy a basic web application because they did not want the extra baggage that came with zope ( esp the 2.x branch ) although it came with a host of useful features that would really help to shorten development time of any web application. Now with zope3, I am confident of zope being the cog that can fit into much much more wheels out there.

Good stuff ! If you haven't checked out what the whole bruhaha is surrounding zope3, do yourself a favor and drop by and try out the tutorials, the very least is you will walk away understanding the zope framework and architecture a whole lot better.

Sunday, January 6, 2008

Installing zope3

Wanting to try out the tutorials over at ( ** CORRECTION - Actually you don't need zope3 to tryout grokproject - My mistake **) which seems really really yummy, I decided to buckle up and install zope from source on my trusty old lappie. It just requires a few steps and shouldn't be scary to all ye old sys admins out there. So, this short howto is meant for those who just dipped the big toe into the big zope pool and who are just trying to get their heads around the whole architecture.

1. Get the relevant sources. In this case python-2.4.4 from and zope-3.3.x source from

2. Building python. This one is easy. Just untar the python package and then issue the commands : ./configure --prefix=/opt/python24;make;make install This will install the python binaries in the /opt/python24 folder. The reason why we have to build the python 2.4 binaries is because zope3 works best with the python-2.4.x branch.

3. Next you have to build zope. This involves untarring the zope source and then in the source directory issue the command : ./configure --prefix=/opt/zope3 --with-python=/opt/python24/bin/python. This will tell zope to install it's binaries in /opt/zope3 and use the python in /opt/python24/bin/python instead of the system PATH.

3. Create the zope instance : './opt/zope3/bin/mkzopeinstance -d /opt/zope3/instance -u [username]:[secret] where username and secret is the username and password of your choice when you want to access your zope instance.

4. Starting up your zope instance : 'cd /opt/zope3/instance/bin; ./zopectl start'. Open up your browser and try to access 'http://localhost:8080/manage'. If your installation is successful, it should prompt you for a username and password pair. Fill in the username and password from step 3.

Congrats ! You have just successfully installed zope 3 !

getting to pesky foreign key data in django

Optimizing databases is a good practice and should be done for any enterprise applications, but as all things go there is a price to pay. The price you pay is when calling back and displaying the data into one can be real PITA. django is a damn good framework and allows you to do work fast with a pedal-to-the-metal feel but then certain amounts of work still has to be done when you have foreign keys defined.

Say you have a database with two tables : contacts and address. The relationship of the two tables are of the one to many kind, I could never really wrap my head around the one-many many-one many-many thingy so let me just say it in layman so I understand it better myself. "One contact can have one or more than one address"

class Contacts(models.Model):
..... bla bla

class Address(models.Model):


So in the code above you have basically linked both the tables together using a ForeignKey relationship. the 'edit_inline' ... mumbo jumbo just tells django to add the address field into the main Contacts form during creation and modification and not as a pop up link ( This is important and could be a clincher for normal users ).

Calling all the data back for display

Okay so now you are honky dory with a great admin form for you to add data into your database, now the problem starts when you want to call all the data back for display in your template.

Don't worry django comes with little helper functions, you just have to do a few more steps to display your foreignkey data.

For my case, in my I do something like this :

from stock.models import Contacts

def main(request,id):
contact_list = Contacts.objects.get(id=id)
return render_to_response('stock/mytemplate.html',{'contacts':contact_list})

Probably the html formatting would made my code not valid in python, but just check ur identation especially after the function definition.

The few lines of code above basically expects you to send it an id ( from the url using the GET method ) and then get the Contacts object and then packs up that data object and sends you merrily along to your template with that.

Okay, a bit about the Contact objects. Inside your contact objects if you have a foreign key relationship it automatically create a method for you to access the data. The method is called _set. So following our example, we know that we have a relationship with the table Address, so we can expect that each contact object will have a method called 'address_set'. Still okay so far ? Lets go get the data you normally call it like this :


This returns an orm object inside a list, so on your template you will call it like this :

{% for address in contact.address_set.select_related %}

Address: {{address.address|escape}}

{% endfor %}

That will bring up and display all your address for that particular contact. Done ! Easy peasy, well for me at least just comment me if think more clarification...

Plone 3.0.5 !!

Waiting for the 8th of January which basically means that Plone 3.0.5 will be released. I am waiting for this release because it fixes a bug in Archetypes which currently causes validation on required fields in a form generated by Archgenxml to fail. After learning the few curves of using ArchgenXML, I must say I am bought hook and sinker on this product. It's really good stuff. With just the drawing of the uml class diagrams allows a developer to generate Plone code, almost too good to be true.

I want to be able to cover the Archgenxml topic in one of my classes on Plone. Now I am still working on the course structure of how the plone course will be like. Will keep you guys posted regarding this too.

A different view of blogger

After having a gym session and talking to geekool, I am having a different view of blogger. I used to like having my own plone site and managing it, but after chin seng explained how it would make more sense and less headaches just having your blog in blogger, it just hit home to me.

One thing about having my blog here is that no one can come and tell me that need to move it or need to shut it down or anything like that. So, I am going to put my blog up here from now on and this will be the central point of dissemination of all information.

On projects, currently I am still working on a web project using django and I am learning up the little nooks and crannies of the language. It would seem that most of the project's repo is placed in google code repositories. I am using a calendar event but it seems to be buggy. But while researching for this, I found this project that seems a bit more promising. Will look into this and report later on this.