David Johnson wrote:
Thanks for the help. I think I understand, however, I think I might be
missing something. You specified that you would get a URL such as:
This looks good, but it seems that the object is not persistent, and a
restart of the server would cause the URL to be invalid. Am I understanding
correctly? This also seems to be for a relatively small number of objects,
since you are creating objects on the fly. A larger number of objects may
consume the memory.
No, actually the objects ARE persistent, just not in the ZODB.
When Zope3 traveral reaches the "venture" folder, which is a ZODB-persistent
object with one attribute of a "RDB connection name", that connection name
is looked up and turned into a volatile "RDB connection instance". Then a
query to obtain the items in the folder is translated into SQL queries whose
responses are wrapped in non-persistent classes.
To continue the example the traversal engine then picks the "IBM" object,
which both acts as a folder representing a business venture -and- has
attributes about IBM, such as legalname and such. The "IBM" venture object
is transient in memory but recreated as needed. Since the Zope3 component
"SQLMethod" I build on caches the SQL query and response, recreation takes
little time for each successive traversal.
Now when the traversal engine queries the "IBM" object for its members, that
object returns a brief canned list of magic subfolders, such as ledger,
journal, transaction, statements, etc. These are transient classes as well,
that appear as folders to Zope3. So in this case it returns the "ledger"
And then when the traversal engine queries the "ledger" object for ledger
#100, the ledger transient object has retained as an attribute from its
creation a reference to its parent, as part of the ILocation interface.
Using such explicit locational acquisition, the ledger object can issue an
SQL query, contextualized by the parent(s) to look for ledger #100 -OF THE
VENTURE IBM-, and wrap that response in a transient Ledger class as well.
And now we can locate and return views based on the ILedger interface.
Zope3-users mailing list