Passing a string argument by URL to a Z SQL Method
I'm working on Chapter 10 of the Zope Book (Relational Database Connectivity), and have had problems passing a string argument by URL to a Z SQL Method, although I was able to implement the example in the book of passing an integer argument by URL. My test is as follows: 1) I have a Z SQL Method named list_reqs, located at http://localhost:8080/Zoo/Employees/Departments: Arguments: department_id SQL: select * from requisitions where <dtml-sqltest department_id op=eq type=string> When I test the Method, I get these results: -- DEPARTMENT ID REQ ID DESCRIPTION UNIT COST QUANTITY Sales 1 paper clips 10.0 1000 Sales 2 golf clubs 500.0 10 Sales 4 staples 10.0 500 ---------------------------------------------------------------- SQL used: select * from requisitions where department_id = 'Sales' -- Under the Advanced tab of the Method, I have the "Allow 'simple' direct traversal" box checked. 2) I have a DTML Method named reqs, located in the same folder as the list_reqs Z SQL Method. I call the DTML Method on the Z SQL Method and attempt to pass it Sales as the department_id using this URL: http://localhost:8080/Zoo/Employees/Departments/list_reqs/Sales/reqs. When I do so, I get the following error: -- Site Error An error was encountered while publishing this resource. Debugging Notice Zope has encountered a problem publishing your object. Cannot locate object at: http://localhost:8080/Zoo/Employees/Departments/list_reqs/Sales -- Is there a reason why Zope won't accept the Sales ID in the URL as an argument, but instead tries to access it as a folder? The obvious workaround is to use an integer for the Department ID instead of a varchar, but that would make the URL less readable. Besides, I want to do it this way!
participants (1)
-
Ben Gustafson