Hi,

I tried to override a query method (by_user_name) but that didn't work as expected (see example attached). This is with Python 2.4.4 and SQLObject 0.7 on Fedora Core 6 (x86_64). Is it possible at all? Any workarounds? Am I missing something?

fs

PS: I'm using SQLObject in a scenario where I don't control the modules, where x.by_user_name is called so I can't do the lowercasing there.
#!/usr/bin/env python

from sqlobject import *

class User(SQLObject):
    user_name = UnicodeCol(length=16, alternateID=True,
                           alternateMethodName="by_user_name")
                           
    @classmethod
    def by_user_name(self, user_name):
        print "FELIX by_user_name(%s)" % user_name
        user_name = user_name.lower()
        return super(User, self).by_user_name


connection = connectionForURI("sqlite:/:memory:")
sqlhub.processConnection = connection

User.createTable()
User(user_name="felix")

print User.by_user_name("Felix")
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to