[kforge-dev] Re: [kforge-user] kforge-config-rebuild problem

John Bywater john.bywater at appropriatesoftwarefoundation.org
Mon Jan 16 16:37:15 UTC 2006

Hi Mark,

Sorry about the message rejection... Why not join the dev list?

Direct email is fine. I've now recreated the problem by using SQLObject 0.7.

KForge has been developed and tested against version 0.6 (0.6-1 in 
Debian Sarge).

More comments below...

Mark Constable wrote:

>Woops, I replied to the wrong email address...
> You are not allowed to post to this mailing list, and your message has
> been automatically rejected.  If you think that your messages are
> being rejected in error, contact the mailing list owner at
> kforge-dev-owner at lists.okfn.org.

Join the list! :-)

>I suspect I need to clean out my /usr/lib/python2.4/site-packages, remove
>turbogears from svn, and start all over again with plain jane stable versions
>of dependencies. That is a lot of work but I really want to get involved with
>kforge... it's going in the right direction for me.
>I hope this direct email is okay and any advice appreciated.
>On Monday 16 January 2006 21:14, John Bywater wrote:
>>Thanks for your message.
>Thanks for the reply!
>>Yes, I'm sure the problem is that the latest SQLObject has changed the 
>>addAttribute method. By the looks of things, in:
>>kforge/core/db/__init__.py (about line 206)
>Here's the whole edited def...
>        def addPersistenceAttribute(self, className, attribute):
>            mapperClass = self.getRecordClass(className)
>            mapperAttribute = mapperClass.meta.addAttribute(attribute)
>            sqlAttribute = mapperAttribute.createNamedMapperClassAttribute()
>            try:
>                if hasattr(mapperClass.sqlmeta, 'addColumn'):
>                    mapperClass.sqlmeta.addColumn(sqlAttribute, changeSchema=True)
>                else:
>                    mapperClass.addColumn(sqlAttribute, changeSchema=True)
>            except:
>                mapperClass.addColumn(sqlAttribute, changeSchema=False)
>And, FWIW, here's my current error below... still similar and probably related to
>my usage of SQLObject from svn, which is now at revision 2115. The current
>INSTALL doc mentions kforge-test-run but I don't seem to have that in bin.
>I seems like this test is failing...
>                if hasattr(mapperClass.sqlmeta, 'addColumn'):

I think the problem is that the sqlmeta.addColumn call is raising an 
exception, and then the except block, which contains:

    mapperClass.addColumn(sqlAttribute, changeSchema=False)

is called.

To explain: the try blocks attempts to add a column to the class and 
alter the database table (changeSchema=True). If the column already 
exists, an exception is raised, and instead an attempt is made to add 
the column to the class without changing the table (changeSchema=False).

It's like this because we couldn't spot a way to test whether the table 
column exists. Perhaps the sqlobject-admin module could help here?

To make the DeprecationWarning go away, you just need to repeat the 
above "hasattr" test for the except block (to call the method on sqlmeta 
if it has it).

(I noticed another Dep'Warning for the usage of _table. I've also 
cleaned that up now.)

Anyway, it is this second call which is the problem. It complains that 
is already has the attribute that is being added. This would seem to 
imply that the try: block did add the class attribute and not the column.

But then if I comment out the except block, in the hope that the class 
attribute will be set even if the database won't change, the tests also 
fail: the attribute is then missing. :-(

Anyway, it really works with SQLObject 0.6. So if you can run with that 
version, I suggest you do that, and we'll try to fix things for 0.7 ASAP.

>What version of SQLObject is kforge tested with ?


>Would I be better off trying cvs HEAD from gforge ?

No, there's really no point using gforge to fix this.

>BTW, do you anticipate hosting kforge under itself at any point ?

It is already:



(please don't be put off if you get asked to login - we're adjusting the 
access control system at the moment)

Best regards,


>(current trace...)
># /home/w/com/motd/kforge kforge-test
>/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1500-py2.4.egg/sqlobject/main.py:581: DeprecationWarning: Use of this attribute should be replaced with .sqlmeta.addColumn
>  '.sqlmeta.%s' % self.name, level=self.deprecation_level)
>Traceback (most recent call last):
>  File "/home/w/com/motd/kforge/bin/kforge-test", line 36, in ?
>    import kforge.test
>  File "/home/w/com/motd/kforge/lib/python/kforge/test/__init__.py", line 4, in ?
>    import kforge.command.test
>  File "/home/w/com/motd/kforge/lib/python/kforge/command/__init__.py", line 5, in ?
>    from kforge.command.state import *
>  File "/home/w/com/motd/kforge/lib/python/kforge/command/state.py", line 1, in ?
>    from kforge.core.command import Command
>  File "/home/w/com/motd/kforge/lib/python/kforge/core/command/__init__.py", line 5, in ?
>    import kforge.dom
>  File "/home/w/com/motd/kforge/lib/python/kforge/dom/__init__.py", line 5, in ?
>    import kforge.dom.accesscontrol
>  File "/home/w/com/motd/kforge/lib/python/kforge/dom/accesscontrol.py", line 100, in ?
>    DomainRegistry().registerDomainClass(PermissionType)
>  File "/home/w/com/motd/kforge/lib/python/kforge/core/dom/registry.py", line 61, in registerDomainClass
>    self.setDeferredAttributesOnRegisteredClasses(domainClass)
>  File "/home/w/com/motd/kforge/lib/python/kforge/core/dom/registry.py", line 112, in setDeferredAttributesOnRegisteredClasses
>    self.addPersistenceAttribute(className, deferredAttr)
>  File "/home/w/com/motd/kforge/lib/python/kforge/core/dom/registry.py", line 142, in addPersistenceAttribute
>    self.database.addPersistenceAttribute(className, attribute)
>  File "/home/w/com/motd/kforge/lib/python/kforge/core/db/__init__.py", line 211, in addPersistenceAttribute
>    mapperClass.addColumn(sqlAttribute, changeSchema=False)
>  File "/usr/lib/python2.4/site-packages/SQLObject-0.7.1dev_r1500-py2.4.egg/sqlobject/main.py", line 298, in addColumn
>    assert name not in sqlmeta.columns, (
>AssertionError: The class sqlobject.declarative.Permission already has a column 'permissionTypeID' (<KeyCol 486bf594 permissionTypeID>), you cannot add the column <KeyCol 486bf594 permissionTypeID>

More information about the kforge-dev mailing list