> Yes. You're not supposed to do that. Views work with requests, not
> content objects.
> If you told us what you want to achieve, we could help you find a way to
> do it that works with Zope 3 rather than against it.
I'am creating form (CRUD) based on formlib, but this
is supposed to work with relational database.
Design is simple:
content_object -> view(based on formlib.form)
My content_object gets data from RDBMS and stores
data into RDBMS. So I want to be able to call something like:
to get and set data for row with row_id = 1 in RDBMS or
to remove data from RDBMS etc.
Simply, I don't have x content objects that are
mappings of x rows in RDBMS, but I have one
object to do CRUD operations on every row in database.
content_object is responsible for calling sql statements
so it needs data from the request. Possibly I have to pass
them (or the whole request) from the view?
>> >>> root = rootFolder()
>> >>> root['my_object'] = my_object = MyObject()
>> >>> getPath(my_object)
Hm... My doctest:
>>> from zope.app.folder import rootFolder
>>> from zope.traversing.api import getPath
>>> root = rootFolder()
>>> root['test_content'] = test_content = DBCrudContent()
and I get:
File "dbcrudbase.txt", line 83, in dbcrudbase.txt
Traceback (most recent call last):
line 1256, in __run
compileflags, 1) in test.globs
File "<doctest dbcrudbase.txt>", line 1, in ?
line 62, in getPath
TypeError: ('Could not adapt',
<dbcrudbase.tests.dbcrudbasetest.DBCrudContent object at 0xb7442b6c>,
Zope3-users mailing list