Acquisition: DTML Methods vs Documents
Hello! Can anyone here explain clearly what is the difference between DTML Methods and DTML Documents regarding acquisition? Well, in simple cases I think I understand it. When I call a Method through the web, it use dynamic (based on current URL) acquisition path. A Document uses static (based on its position in ZODB) path. But what if I want to look a bit deeper? What are acquision paths for a Method called from a Document, not directly from the web? I beleive when a Document called from a Method it always uses static acquisition path. But what about a Method called from a Document? It seems my Methods stopped using dynamic paths and use static paths, provided by its callee. Right? Let's see a running demo. The site http://phd.russ.ru/pcgi/TEST/ constructed as follows: /TEST - folder index_html - standard DTML Document with default content standard_html_header - DTML Method standard_html_footer - DTML Method 2 - folder, empty Both folders /TEST and /TEST/2 have a property "foobar". In /TEST its value is "First test!", in /TEST/2 - "This is SECOND test." standard_html_header show the property with <dtml-var foobar>. When I call standard_html_header directly through the web, it acquires foobar using dynamic acquisition path: http://phd.russ.ru/pcgi/TEST/standard_html_header show foobar from root (/TEST) http://phd.russ.ru/pcgi/TEST/2/standard_html_header show foobar from /TEST/2 But then I call standard_html_header from DTML Document index_html: http://phd.russ.ru/pcgi/TEST/index_html show foobar from root (/TEST); exactly as I expected, no problem http://phd.russ.ru/pcgi/TEST/2/index_html WOW! It show foobar again from root, not from /TEST/2! standard_html_header acquires using static path provided by index_html! Is it normal and intended behaviour? If it is, how can I "solve" my problem? (I want to acquire different properties in standard_html_header, but call standard_html_header from different DTML Documents). Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
On Friday 5 January 2001, at 12 h 26, the keyboard of Oleg Broytmann <phd@phd.pp.ru> wrote:
Can anyone here explain clearly what is the difference between DTML Methods and DTML Documents regarding acquisition?
Not me but this HOWTO: http://www.zope.org/Members/michel/HowTos/DTMLMethodsandDocsHowTo saved my life.
On Fri, 5 Jan 2001, Stephane Bortzmeyer wrote:
http://www.zope.org/Members/michel/HowTos/DTMLMethodsandDocsHowTo saved my life.
Thanks. I'be read it yesterday. It does not help much because it does not answer my question: If I call http://machine:port/top/middle/AFolder/ADocument (in terms of this HOWTO), and ADocument calls <dtml-var AMethod>, what is acquisition path for AMethod? I showed an example, where AMethod do acquisition using static path, and I think it is a bug. Or, may be, just my misunderstanding... Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
On Fri, 5 Jan 2001, Stephane Bortzmeyer wrote:
http://www.zope.org/Members/michel/HowTos/DTMLMethodsandDocsHowTo saved my life.
Thanks. I'be read it yesterday. It does not help much because it does not answer my question:
If I call http://machine:port/top/middle/AFolder/ADocument (in terms of this HOWTO), and ADocument calls <dtml-var AMethod>, what is acquisition path for AMethod?
Oleg, what might come handy in your case is the howto "Shane's Aquisition Understander" at http://www.zope.org/Members/chrisw/showaq it'll help you visualize the acquisition path from your document. You may also want to look at my howto Changing Contexts in Zope http://www.zope.org/Members/Hoekstra/ChangingZopeContexts Or Jim's acquisition algebra from a Python point of view of these matters: http://www.zope.org/Members/jim/Info/IPC8/AcquisitionAlgebra/index.html hth Rik
Hello! Many thanks to all who replied! Sorry for late answer - twas XMas holidays in Russia (Russian Orthodox church celebrates XMas Jan 7). On Fri, 5 Jan 2001, Rik Hoekstra wrote:
If I call http://machine:port/top/middle/AFolder/ADocument (in terms of this HOWTO), and ADocument calls <dtml-var AMethod>, what is acquisition path for AMethod?
what might come handy in your case is the howto "Shane's Aquisition Understander" at
http://www.zope.org/Members/chrisw/showaq it'll help you visualize the acquisition path from your document.
I used it for sometime, sure...
You may also want to look at my howto Changing Contexts in Zope http://www.zope.org/Members/Hoekstra/ChangingZopeContexts
Read and reread it many times, sure. Cannot live without it :) The thing that I didn't understand from this (and the thing is still cloudy) is that there is One Acquisition Path for a request. When I call a Method through the web, I have proper path, so I can call Documents and Methods from each other. But when I call a Document through the web, I have "wrong" path - static path, and when I try to call a Method from the Document, the Method will use this static path. I thought the Method will use dynamic path, based on request (URL). That was my mistake.
Or Jim's acquisition algebra from a Python point of view of these matters: http://www.zope.org/Members/jim/Info/IPC8/AcquisitionAlgebra/index.html
Of course. Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
On Friday 5 January 2001, at 12 h 26, the keyboard of Oleg Broytmann <phd@phd.pp.ru> wrote:
When I call standard_html_header directly through the web, it acquires foobar using dynamic acquisition path:
Actually, if I understand it myself :-) it acquires foobar because a method has no poperties, so it looks first in the innermost container, the folder TEST or TEST/2.
But then I call standard_html_header from DTML Document index_html:
In that case, you start the acquisition with the document index_html (reread the HOWTO <http://www.zope.org/Members/michel/HowTos/DTMLMethodsandDocsHowTo>: the acquisition can start from a document or a folder, not from a method).
http://phd.russ.ru/pcgi/TEST/index_html show foobar from root (/TEST); exactly as I expected, no problem http://phd.russ.ru/pcgi/TEST/2/index_html WOW! It show foobar again from root, not from /TEST/2! standard_html_header acquires using static path provided by index_html!
You started acquisition from index_html. Since it has no foobar, it looked into its own container, /TEST, then in root.
Is it normal and intended behaviour? If it is, how can I "solve" my problem? (I want to acquire different properties in standard_html_header, but call standard_html_header from different DTML Documents).
You can but the "problem" in your case, comes from the acquisition of an index_html document in a different folder. I suggest to add index_html documents in every folder *or* make index_html a method (this is what I use).
On Fri, 5 Jan 2001, Stephane Bortzmeyer wrote:
http://phd.russ.ru/pcgi/TEST/2/index_html WOW! It show foobar again from root, not from /TEST/2! standard_html_header acquires using static path provided by index_html!
You started acquisition from index_html. Since it has no foobar, it looked into its own container, /TEST, then in root.
Exactly as I wrote - in this situation standard_html_header acquires using static path provided by index_html :(
You can but the "problem" in your case, comes from the acquisition of an index_html document in a different folder. I suggest to add index_html documents in every folder *or* make index_html a method (this is what I use).
There are many Documents on my site, not only index_html. Should I make them all Methods? Why after this I need Documents at all? Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
On Friday 5 January 2001, at 17 h 58, the keyboard of Oleg Broytmann <phd@phd.pp.ru> wrote:
There are many Documents on my site, not only index_html. Should I make them all Methods? Why after this I need Documents at all?
Because not all documents are acquired (from an above folder). For index_html, for instance, it is common to have a different index_html (and in that case a document) in each folder.
Hello! I think hade a similar problem. It seems that you can only use methods for acquisition, not documents. I had an index_html DOC where I specified the structure of my site. In index_html I used <dtml-var some_doc> that and in some_doc I once <dtml-var other_doc>. The idea was that in my subfolers I only needed to have the objects some_doc and other_doc, and that I would use the structure from the index_html higher up. This way I could provide "modules" to managers of subfolders, so they need not to concern themselvs with the proper way of setting up their index_html. It didn't work unitl I changed index_html and all other objects from dtml-docs to dtml-methods. Otherwise I would always end up with the parent (in my case the root level) documents. I wanted to have DTML-documents in the firts place, because I noticed that in dtml-methods the <dtml-var title_or_id> call has no effect; it does not use the methods title_or_id, it uses the toplevel (or the calling documents) title_or_id. Is this a similar situation to yours? /dario ----- Original Message ----- From: "Oleg Broytmann" <phd@phd.pp.ru>
There are many Documents on my site, not only index_html. Should I make them all Methods? Why after this I need Documents at all?
Oleg.
Oleg Broytmann wrote:
There are many Documents on my site, not only index_html. Should I make them all Methods? Why after this I need Documents at all?
The ONLY time I use a Document is, as a container for properties. For example a patient is seen by a doctor. The date/time, vital signs etc. would be recorded in properties of a DTML Document. The DTML code in the Document is used to display this information anytime later. (Okay, FreePM is really more complicated than that but it's the basic idea. <g>) -- Tim Cook -- Help the new U.S. President (and your Country). Visit http://www.petitiononline.com/sphinx84/petition.html Censorship: The reaction of the ignorant to freedom.
Hello I'm relatively new to Zope, and have been working on getting mySql connected via ZODBC on Win2k. The connection is working, however, I have one column which repeatedly throws an error when I try to access data. The column contains text with many "\n" to retain formatting for email messages (it's an archive). The error seems to be from the ODBC driver: Error, sql.error: ('24000', 0, '[Microsoft][ODBC Driver Manager] Invalid cursor state') however I can successfully access values from this column directly from the mysql console AND through the exact same datasource used by zope but from other apps (I used Excel as a test, and successfully returned data). IOW, only Zope produces this error. Any thoughts or pointers would be greatly appreciated. Doug Brewer
I have worked with ODBC and Zope under Win2k and had no such problems with MSSQL,Oracle and Access. Since you work with mysql the problem seems to happen in conjunction with the mysql ODBC AND Zope, I don't have experiences with MySQL ODBc, but: If you work with mysql & Zope I would anyhow recommend Zope's native mysql adapter since it is full-threaded and ZODBCDA is not. *********** REPLY SEPARATOR *********** On 06.01.2001 at 10:41 Doug Brewer wrote:
Hello
I'm relatively new to Zope, and have been working on getting mySql connected via ZODBC on Win2k. The connection is working, however, I have one column which repeatedly throws an error when I try to access data. The column contains text with many "\n" to retain formatting for email messages (it's an archive).
The error seems to be from the ODBC driver:
Error, sql.error: ('24000', 0, '[Microsoft][ODBC Driver Manager] Invalid cursor state')
however I can successfully access values from this column directly from the mysql console AND through the exact same datasource used by zope but from other apps (I used Excel as a test, and successfully returned data). IOW, only Zope produces this error.
Any thoughts or pointers would be greatly appreciated.
Doug Brewer
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (7)
-
Dario Lopez-K�sten -
Doug Brewer -
Oleg Broytmann -
Philipp Auersperg -
Rik Hoekstra -
Stephane Bortzmeyer -
Tim Cook