Hello,

trying to understand SQLObject (using ist with Turbogears), but I don't
get it to work properly.

Got the model:

class Worktime(SQLObject):
    start = DateTimeCol()
    end = DateTimeCol( default=None )
    user = ForeignKey("User")

class User(SQLObject):
    user_name = UnicodeCol(length=16, alternateID=True,
                           alternateMethodName='by_user_name')
    email_address = UnicodeCol(length=255, alternateID=True,
                               alternateMethodName='by_email_address')
    display_name = UnicodeCol(length=255)
    password = UnicodeCol(length=40)
    worktimes = MultipleJoin("Worktime")



This call results in an Error:
wt = Worktime.select(Worktime.q.user==identity.current.user)
" AttributeError: Worktime instance has no attribute 'user' "

I see the attribute   :)
The strangest thing is, this error occures since an update to SO 0.9.2.

Before that, I was using SO 0.7.7, which didn't show that error, but
returned (with the same call) every row twice.

I don't get SQLObject, I thought it should speed up my development, but
I clearly does not.

Thanks a lot, for listening to my whinig   :)  , hope you can help me!

Sincerly,

Nicolas


PS:

Using python2.4.4.

Whole Error:

Page handler: <bound method Root.index of <ntime.controllers.Root object
at 0x206d070>>
Traceback (most recent call last):
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py",
line 105, in _run
    self.main()
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py",
line 254, in main
    body = page_handler(*virtual_path, **self.params)
  File "<string>", line 3, in index
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/TurboGears-1.0.4b1-py2.4.egg/turbogears/controllers.py",
line 342, in expose
    output = database.run_with_transaction(
  File "<string>", line 5, in run_with_transaction
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/TurboGears-1.0.4b1-py2.4.egg/turbogears/database.py",
line 316, in so_rwt
    retval = func(*args, **kw)
  File "<string>", line 5, in _expose
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/TurboGears-1.0.4b1-py2.4.egg/turbogears/controllers.py",
line 359, in <lambda>
    mapping, fragment, args, kw)))
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/TurboGears-1.0.4b1-py2.4.egg/turbogears/controllers.py",
line 386, in _execute_func
    output = errorhandling.try_call(func, *args, **kw)
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/TurboGears-1.0.4b1-py2.4.egg/turbogears/errorhandling.py",
line 72, in try_call
    return func(self, *args, **kw)
  File "<string>", line 3, in index
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/TurboGears-1.0.4b1-py2.4.egg/turbogears/identity/conditions.py",
line 235, in require
    return fn(self, *args, **kwargs)
  File "/Users/nr/sw/nTime/ntime/controllers.py", line 76, in index
    return dict( worklist = wts, times = times, nowworking =
self._isworking(),
  File "/Users/nr/sw/nTime/ntime/controllers.py", line 125, in _isworking
    wt = Worktime.select(Worktime.q.user==identity.current.user)
  File
"/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/SQLObject-0.9.2-py2.4.egg/sqlobject/sqlbuilder.py",
line 394, in __getattr__
    raise AttributeError("%s instance has no attribute '%s'" %
(self.soClass.__name__, attr))
AttributeError: Worktime instance has no attribute 'user'

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to