On 22 Dez., 17:52, "Víctor" <[EMAIL PROTECTED]> wrote:
> I'm using SQLObject. My model.py looks like:
>
> class User(SQLObject):
>     """Users table"""
>     username = UnicodeCol(alternateID=True, length=50)
>     password = UnicodeCol(length=25)
>     de = IntCol()
>     en = IntCol()
>     es = IntCol()
>     fr = IntCol()
>     it = IntCol()
>     nl = IntCol()
>     photos = RelatedJoin("Photo")
>     magicnumber = UnicodeCol(length=15)
>     sessions = MultipleJoin("Session")
>     score = IntCol(default=0)
>     prec = FloatCol(default=0)
>     avgtime = FloatCol(default=0)
>
> As I said before, I can query this table with no hassle from the
> interpreter but when querying from my controllers.py file, I get the
> error message "type object 'User' has no attribute 'select'".

I'm guessing that the "User" object that you use in the "getUsers"
controller method is not what you think. Maybe it gets overwritten by
some other code in your controllers.py file.

Try to diagnose by adding a little debug logging:

    @wsexpose(str)
    def getUsers(self):
        log.debug("User: %r", User)
        log.debug("Type of 'User' object: %s": type(User))
        log.debug(User.__dict__)
        users = User.select()
        return "There are %s users in the DB" % users.count()

Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to