[z3] SQLOS Issues
Michael MacFadden
mike at macfadden.org
Tue Apr 26 22:21:16 CEST 2005
All,
I have been trying out the sqlos package. For the most part it is going
really well. Great package. I have run into two issues that aren't
covered by the docs that I have seen.
I have set up things pretty much just like the example online details.
I have a both the container implemented as well as the table row
object. When I add the container to my zope instance and click on it I
see all of the items in my table listed. When I click on the item I get
the edit schema form which is populated with the correct data. This
much is working just fine.
The first problem is introspection on the table row objects doesn't
work. I can introspect the container just fine, but when I try to click
the introspection tab for the table row object I get the following error:
File
"/opt/zope-foo/build/lib.linux-i686-2.3/zope/tal/talinterpreter.py",
line 208, in interpret
handlers[opcode](self, args)
File
"/opt/zope-foo/build/lib.linux-i686-2.3/zope/tal/talinterpreter.py",
line 427, in do_setLocal_tal
self.engine.setLocal(name, self.engine.evaluateValue(expr))
File "/opt/zope-foo/build/lib.linux-i686-2.3/zope/tales/tales.py",
line 698, in evaluate
return expression(self)
File
"/opt/zope-foo/build/lib.linux-i686-2.3/zope/tales/pythonexpr.py", line
58, in __call__
return eval(self._code, vars)
File "<string>", line 0, in ?
File
"/opt/zope-foo/build/lib.linux-i686-2.3/zope/app/introspector/__init__.py",
line 85, in getModule
return self.currentclass.__module__
ForbiddenAttribute: ('__module__', <class
'fitnesstracker.database.fooditem.FoodItem'>)
Not sure what is going on here. The permissions for the container and
for the row object seem to be similar so I am not sure why I can
introspect on but not the other. The permissions were pretty much
copied right out of the online example.
The second problem I have is trying to add a new row to my table. I
have added an addMenuItem and addform statements to my configure file.
When I click on the add item, I get the schema based add form, but
submitting this form gives this error:
File
"/opt/zope-foo/build/lib.linux-i686-2.3/zope/tal/talinterpreter.py",
line 208, in interpret
handlers[opcode](self, args)
File
"/opt/zope-foo/build/lib.linux-i686-2.3/zope/tal/talinterpreter.py",
line 427, in do_setLocal_tal
self.engine.setLocal(name, self.engine.evaluateValue(expr))
File "/opt/zope-foo/build/lib.linux-i686-2.3/zope/tales/tales.py",
line 698, in evaluate
return expression(self)
File
"/opt/zope-foo/build/lib.linux-i686-2.3/zope/tales/expressions.py", line
207, in __call__
return self._eval(econtext)
File
"/opt/zope-foo/build/lib.linux-i686-2.3/zope/tales/expressions.py", line
201, in _eval
return ob()
File
"/opt/zope-foo/build/lib.linux-i686-2.3/zope/app/form/browser/add.py",
line 59, in update
self.createAndAdd(data)
File
"/opt/zope-foo/build/lib.linux-i686-2.3/zope/app/form/browser/add.py",
line 90, in createAndAdd
content = self.create(*args, **kw)
File
"/opt/zope-foo/build/lib.linux-i686-2.3/zope/app/form/browser/add.py",
line 71, in create
return self._factory(*args, **kw)
File "/srv/zope3/testing/lib/python/sqlobject/main.py", line 890, in
__init__
self._create(id, **kw)
File "/srv/zope3/testing/lib/python/sqlobject/main.py", line 915, in
_create
raise TypeError, "%s() did not get expected keyword argument %s" %
(self.__class__.__name__, column.name)
TypeError: FoodItem() did not get expected keyword argument category_id
I am guessing this error is something I have wrong in either the python
code in either the interface or the class for the table row object.
Just not sure what this error is telling me, so I am having trouble
tracking it down. If you need more information from me..i.e source code
I would be happy to provide it. Thanks.
~Mike
More information about the z3
mailing list