Posts

Zissue (Zope3 product) report (I)

I created few views and wrote some unit and functional tests, though learning very slow still... I was very excited when my first functional test got run. Now I am catching up with Test Driven Development, but documention is still poor. Subversion repository is here: https://developer.berlios.de/projects/zissue/ I am also planning few simple Zope3 apps, so that I can easily make my first stable release. Day after to morrow is our election to 'Panchayath' http://en.wikipedia.org/wiki/Panchayat

Zissue My experimental Zope3 product.

Yesterday was Thiruvonam (http://en.wikipedia.org/wiki/Onam) And I didn't made any progress in Zope3 learning, Also I was wondering about this problem: http://mail.zope.org/pipermail/zope3-users/2005-September/001031.html Today only I got a solution: http://mail.zope.org/pipermail/zope3-users/2005-September/001038.html Just to track my development, I created a project at BerliOS: https://developer.berlios.de/projects/zissue/ I have committed the source to Subversion, to check out: svn checkout svn://svn.berlios.de/zissue/trunk/zissue So far only few interfaces, today I will create one view for Comments, and I have to figure out how to handle attachments (implement IFile, how?).

Zope3 study part-1

Today I started experiments with Zope 3, Last few weeks I took print outs of Zope3 book's most of the pages in DotMatrix :) I think the learning curve is too steep, but it was very interesting. When I started learning PyGTK, I created a usable app in one week. My motivation to learn PyGTK was redhat-config-* tools, there was nothing interesting in those apps, but it amazed me that it was very cool. This is first time I am learing a framework (hmm.. there is PyUnit, but its not that much difficult). May be for developing huge apps, big frameworks will be required, anyway I will look into other alternatives after Zope3 becomes comfortable. First I created an instance of zope at /var/tmp/tzope/ then created a package at /var/tmp/tzope/lib/python and It is 'Zissue Tracker' (an experimental zissue/bug tracking system for learing Zope 3) So the package reside in : /var/tmp/tzope/lib/python/zissuetracker Today (Sunday) I came to my office just to work on it. Now I only finished fe...

getdefault method for python dictionary

In this blog: http://blogs.nuxeo.com/sections/blogs/ruslan_spivak/2005_09_01_btrees-setdefault Blogger says that Python's dictionary method, 'setdefault' without explicit default is confusing and useless. Now I think there should be a 'getdefault' method which also requires two explicit arguments, it will return explicit default if no key exists. Here is an example: >>> d = {1: None} >>> print d.getdefault(1, 'Hi') None >>> print d.getdefault(2, 'Hi') 'Hi' Hmm.. there is already a 'get' method. If we have 'getdefault' then 'get' can be deprecated, Here is the reason: >>> d = {1: None} >>> print d.get(1) None >>> print d.get(2) None See, here I didn't thought about any use cases.

Singleton pattern for a database connection

I think I understood Singleton pattern, any suggestion? from pyPgSQL import PgSQL class Database(object): _sigletons = {} def __new__(cls): if cls not in cls._sigletons: cls._connection = PgSQL.connect(database='dbname', user='username', password='passwd', host='hostname') cls._sigletons[cls] = object.__new__(cls) pass return cls._sigletons[cls] def __init__(self): self.connection = Database._connection pass def cursor(self): return self.connection.cursor() #other methods follows here #just to test logjam

Moving from Python to Java :(

For last 9 months my company was developing an enterprise application. Our main language was Python. Its going to implement all over India by next few months. Next month we will start our new project, Java will be our main language. Now I started refreshing my Java. And this is one thought came to me today, when I looked into Strings in Java. One of Python's primary design principle is that: "Special cases aren't special enough to break the rules." That is, the language should avoid having privileged features that you can't reuse for other purposes. The consequence of this principle is, more generalisation of syntax and semantics of a language. In Python : (of course, there are better ways) age = 9 print "He is " + str(age) + " years old." In Java: int age = 9; String s = "He is " + age + " years old."; System.out.println(s); Concatenating string and integer like this is possible in Java, because it is a "spec...

Zope3 first look

Just now I downloaded Debian packages of Zope X3 from: http://people.debian.org/~doko/zope3/ First I tried to install zope3-lib_3.0.0-4_i386.deb but it shows dependency for python2.3-zopeinterface, then I installed python2.3-zopeinterface_3.0.0-4_i386.deb after that zope3-lib_3.0.0-4_i386.deb (I had already installed Zope 2.7 ) To work Zope 3 for me, I did following things too: 1. Edited /usr/lib/zopex3/bin/mkzopeinstance replced python2.4 with python2.3 2. #cd /usr/lib/zopex3/zopeskel (I don't know, this is necessary or not) #python ../bin/mkzopeinstance -u baiju:password -d /tmp/zope3 3. Edited /tmp/zope3/etc/zope.conf (Changed ports to 70XX) type HTTP address 7080 type FTP address 7021 4. #/tmp/zope3/bin/runzope Now I opened http://localhost:7080 in Fire Fox , I can see Zope 3 running :)