Hello Zope-Masters ! Please help me with some examples/answers ! 1.) I cannot show results of Z-SQL method. I see the examples on web, on tutorial, but... ZSQL method name: testgroup. select id,name from inst_group Under KInterBase Connection, the test show the results. But if I wrinte into index.html: ... <dtml-in testgroup> x <li><dtml-var id>: <dtml-var name></li> </dtml-in> ... then it is don't show the results. Why ? Every example do this way. I do it with another tables, and another databases (ex. Gadfly) to avoid possible IB errors/bugs. But no result. Why ? What I do wrong ? 2.) I want to process the result of zsql query under PythonScript (select * from xxx). How to I call this method from PythonScript ? How to I get the result rows ? Please show with an example ! 3.) There is an (K)InterBase Connection. I want to access the IB specials. These are: - start transaction/Commit/Rollback, more if possible - call stored procs - set the transactions isolation level How to I do it under Zope ? I have an examples ? 4.) If there are two requests in zope, and the scripts are have use (K)InterBase Connection, that the connection object is duplicated ? The ZSQL method objects are duplicated also ? So: the requests' processes are separated ? 5.) I wan to log in users under zope just like php. This is the logical scheme (pseudo): browser session handling on handler: if mainsession is empty: result= form username/pwd /form submit button elif: get submitted form check username/pwd if wrong: result=errorform else: mainsession set to(userid,username,otherdatas) result=mainform for logined user So: the login form is one the main form, but some menus are disabled. When user have been logined, the menus are enabled. The checking is based on ZSQL method (select check). The questions are: - how to I do it under Zope, to Zope use the Session ID like PHP, and how to I write the session datas to session variable(s); and how to load/get values from it ? - how to I force Zope to the logined user is set to an existing zope user (only one for all logined user). I don't want to duplicate the user management into zope, I want to use my usernames in my IB database. 6.) Under Zope I how to create/set an variable in PyScript what useable in DTML ? So how to set more DTML variables under PyScript ? (example: dtml_username='xxx'; dtml_func="8"; etc.) or only I do it only with one with this: <dtml-var expr="myscript"> myscript.return(vmi) ? 7.) If I write this: <dtml-var expr="myzsqlmethod"> I get all of results of the method ? 8.) What is the ZSQL method caching (1000 row)? Is this an data packet size ? How to I get more records ? Can you show an example (not the Book's Batch, please show another) ? 9.) How to I import XML file ? I export my zope folder in home. I want to use another site. But I cannot do import. I try with these variations: c:\test.xml file://localhost/C:/test.xml Thanx for any help, examples, links. But please: don't say to I read the main book, every day I do, but my special questions I cannot found in it. KK -- Best regards, fowlertrainer mailto:fowlertrainer@anonym.hu
fowlertrainer@anonym.hu wrote at 2003-12-1 10:38 +0100:
1.) I cannot show results of Z-SQL method.
I see the examples on web, on tutorial, but...
ZSQL method name: testgroup. ... But no result. ... in template ...
Add a "Z Search Interface" for your Z SQL Method (via the "Add list"). Adjust the generated "report page" as needed. Note that the batching links for the generated ZPT "report page" are broken. I posted a patch to the mailing list (may be a bit difficult to find; search for "url_query").
2.) I want to process the result of zsql query under PythonScript (select * from xxx).
Please read the respective chapter in the Zope Book (online 2.6 edition).
3.) There is an (K)InterBase Connection. I want to access the IB specials.
These are: - start transaction/Commit/Rollback, more if possible
This is done automatically for you (transactions are tied to Zope's requests).
- call stored procs
Many DA's support a "callproc" method. Check whether your DA belongs to this class.
- set the transactions isolation level
The default set by the DA should be "serialized". I fear, you will need to change its code when you want something else.
4.) If there are two requests in zope, and the scripts are have use (K)InterBase Connection, that the connection object is duplicated ? The ZSQL method objects are duplicated also ? So: the requests' processes are separated ?
The DA authors should handle this for you such that you do not need to worry about these details...
5.)
Note: it is *much* better to send several small messages (each with a well chosen "Subject) than a huge message with dozens of questions. I am going to loose patience....
I wan to log in users under zope just like php. This is the logical scheme (pseudo):
Usually, Zope DA's do not support this (as connections are often expensive and most databases only allow authentication when the connection is opened).
6.) Under Zope I how to create/set an variable in PyScript what useable in DTML ? So how to set more DTML variables under PyScript ? (example: dtml_username='xxx'; dtml_func="8"; etc.)
You can set request variables (with the request's "set" method). But, it is not very good style.
7.) If I write this: <dtml-var expr="myzsqlmethod">
I get all of results of the method ?
No, you get none at all. What you get is the Z SQL Method object itself. The context will probably coerce it into a string and the result looks like "<ZSQLMethod at 0xfdfdff>". Your browser will not understand this funny tag and ignore it.
8.) What is the ZSQL method caching (1000 row)?
You must read more carefully! It says: * "Maximum rows to retrieve": this limits the number of rows retrieved from the database (per request). Use "0" for unlimited * "Maximum results to cache": this limits the number of query results (i.e. calls of the ZSQL Method) held in the cache * "Maximum time (sec) to cache": this limits the time a single result is held in the cache.
9.) How to I import XML file ? I export my zope folder in home. I want to use another site. But I cannot do import. I try with these variations:
c:\test.xml file://localhost/C:/test.xml
Please read the Zope Book! Carefully, if you already did! For security reasons, files are only imported from Zope's "import" folder... -- Dieter
At 1/12/2003 10:38, you wrote:
<dtml-in testgroup> x <li><dtml-var id>: <dtml-var name></li> </dtml-in> ...
then it is don't show the results. Why ? Every example do this way.
That should work. What do you see as a response? Other parts of the template (like a <dtml-if>) could prevent this to be evaluated.
2.) I want to process the result of zsql query under PythonScript (select * from xxx).
How to I call this method from PythonScript ? How to I get the result rows ?
Please show with an example !
See the Zope Book, chapter Relational Database Connectivity, there are examples. And see Appendix B, class ZSQLMethod too. You call it as any other callable object, with (), including keyword arguments if applicable. The return value is a sequence-like object, see the same souces, or http://www.zope.org/Members/spinwing/ZSQL_Results
4.) If there are two requests in zope, and the scripts are have use (K)InterBase Connection, that the connection object is duplicated ? The ZSQL method objects are duplicated also ? So: the requests' processes are separated ?
I'm not completely sure but there might be 4 connection objects created at the time (one per cache, if you run Zope using the default 4 threads).
5.) I wan to log in users under zope just like php. This is the logical scheme (pseudo):
Try the CookieCrumbler product.
7.) If I write this: <dtml-var expr="myzsqlmethod">
I get all of results of the method ?
Why don't you try it yourself and see what happens? Use 'View source" on the generated page.
8.) What is the ZSQL method caching (1000 row)? Is this an data packet size ? How to I get more records ?
See the Zope Book again, chapter Relational Database Connectivity.
Can you show an example (not the Book's Batch, please show another) ?
Those settings have nothing to do with batching. In the 'Advanced' tab, you say how many rows (at maximum) you want to retrieve, and how many results set you want to store cached.
9.) How to I import XML file ? I export my zope folder in home. I want to use another site. But I cannot do import. I try with these variations:
Read the Zope Book: "Using The Zope Management Interface" - "Importing and Exporting Objects" Gabriel Genellina Softlab SRL
participants (3)
-
Dieter Maurer -
fowlertrainerļ¼ anonym.hu -
Gabriel Genellina