Hi, got a small question here using the following ZPT: | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | <!-- "http://www.w3.org/TR/html4/transitional.dtd"> --> | <html metal:use-macro="here/std_template/macros/template"> | | <span metal:fill-slot="body"> | <span tal:condition="python: not here.is_logged_on()"> | <h3>Sie sind nun Ausgeloggt</h3> | <a href="index_html" tal:attributes="href request/came_from">Zurück</a> | </span> | <span tal:condition="python:here.is_logged_on()"> | Sie sind noch mittels HTTP-Authentication eingelogged. Sie sich müssen | eventuell <a href="/manage_zmi_logout">aus dem Zope Managment Interface | ausloggen</a>. | </span> | </span> | </html> I get an attribute error about request when opening this ZPT with the following link logout_form?came_from=http://localhost:9673/index_html How can this happen? I have not "request" within the macro, the only request/ object is up there in the ZPT. Another question: Is it possible to call python methods from ZPT, which are defined in a python script? I have several scripts and would like to hold them in 1 script-Object in Zope, as they all belong to the login-process. Andreas -- Your reasoning is excellent -- it's only your basic assumptions that are wrong.
got a small question here using the following ZPT:
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | <!-- "http://www.w3.org/TR/html4/transitional.dtd"> --> | <html metal:use-macro="here/std_template/macros/template"> | | <span metal:fill-slot="body"> | <span tal:condition="python: not here.is_logged_on()"> | <h3>Sie sind nun Ausgeloggt</h3> | <a href="index_html" tal:attributes="href request/came_from">Zurück</a> | </span> | <span tal:condition="python:here.is_logged_on()"> | Sie sind noch mittels HTTP-Authentication eingelogged. Sie sich müssen | eventuell <a href="/manage_zmi_logout">aus dem Zope Managment Interface | ausloggen</a>. | </span> | </span> | </html>
I get an attribute error about request when opening this ZPT with the following link logout_form?came_from=http://localhost:9673/index_html
How can this happen? I have not "request" within the macro, the only request/ object is up there in the ZPT.
Are you sure about that? There's something going on outside what you have written above. It worked for me with a dead simple std_template and without the is_logged_on() bits. So I suspect one of those is the culprit. How does it work without the macro and/or method calls?
Another question: Is it possible to call python methods from ZPT, which are defined in a python script? I have several scripts and would like to hold them in 1 script-Object in Zope, as they all belong to the login-process.
A Python script is really a method in itself. You can stick a bunch of them in a folder and call them like 'folder.somescript()' if you want to simulate a module for organizational reasons. --jcc
On 20.Mai 2003 - 16:30:34, J Cameron Cooper wrote:
got a small question here using the following ZPT:
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | <!-- "http://www.w3.org/TR/html4/transitional.dtd"> --> | <html metal:use-macro="here/std_template/macros/template"> | | <span metal:fill-slot="body"> | <span tal:condition="python: not here.is_logged_on()"> | <h3>Sie sind nun Ausgeloggt</h3> | <a href="index_html" tal:attributes="href request/came_from">Zurück</a> | </span> | <span tal:condition="python:here.is_logged_on()"> | Sie sind noch mittels HTTP-Authentication eingelogged. Sie sich müssen | eventuell <a href="/manage_zmi_logout">aus dem Zope Managment Interface | ausloggen</a>. | </span> | </span> | </html>
I get an attribute error about request when opening this ZPT with the following link logout_form?came_from=http://localhost:9673/index_html
How can this happen? I have not "request" within the macro, the only request/ object is up there in the ZPT.
Are you sure about that? There's something going on outside what you have written above. It worked for me with a dead simple std_template and without the is_logged_on() bits. So I suspect one of those is the culprit. How does it work without the macro and/or method calls?
This was really my fault, I confused python and tal request Objects, the python one has to be written in uppercase, which solved this. Also I don't need any python script in this anymore :)
Another question: Is it possible to call python methods from ZPT, which are defined in a python script? I have several scripts and would like to hold them in 1 script-Object in Zope, as they all belong to the login-process.
A Python script is really a method in itself. You can stick a bunch of them in a folder and call them like 'folder.somescript()' if you want to simulate a module for organizational reasons.
As said above, I don't need them anymore, but that solution is not as beautiful as a real module with methods. Andreas -- Your step will soil many countries.
Another question: Is it possible to call python methods from ZPT, which are defined in a python script? I have several scripts and would like to hold them in 1 script-Object in Zope, as they all belong to the login-process.
A Python script is really a method in itself. You can stick a bunch of them in a folder and call them like 'folder.somescript()' if you want to simulate a module for organizational reasons.
As said above, I don't need them anymore, but that solution is not as beautiful as a real module with methods.
They're pretty much the same thing. A folder is essentially the Zope-application analogue of a module: a collection of methods. True, you can't have folder-level code, but you can contain types of methods other than Python: ZPT, SQL, Perl, or whatnot, and call them all similarly. Of course, in Zope3 we will (probably!) have a structure just like you describe. But for the moment, that's neither here nor there. --jcc
participants (2)
-
Andreas Pakulat -
J Cameron Cooper