Hello! In ExternalMethods.html I found: "ernal Methods operate just like normal methods". But what are "normal" methods? The only thing I know is DTML Scripts. Are there other? Could I put Python code into Object Database? Should I? Oleg. ---- Oleg Broytmann National Research Surgery Centre http://sun.med.ru/~phd/ Programmers don't die, they just GOSUB without RETURN.
Oleg Broytmann wrote:
Hello!
In ExternalMethods.html I found: "ernal Methods operate just like normal methods". But what are "normal" methods? The only thing I know is DTML Scripts. Are there other? Could I put Python code into Object Database? Should I?
I think that DTML Methods (or Documents?) are meant. They are like methods to the folder objects that Zope publishes. Look at: http://localhost/Zope/foo/bar/doc as asking Zope 'okay, folder 'foo', I want your subfolder 'bar' (this could be seen as using a method on foo to request 'bar'), and then I want to view 'doc' (which is, let's say, a DTML method) in bar. 'doc' in that case is a method of the bar object, which, when called, returns HTML code (to the browser). An *external* method is a method which comes from outside the Zope object database (though it's loaded into it, and behaves just like a normal internal method). If all this talk turns out to be correct (somebody tell me or send corrections), then I can turn this into a FAQ entry. If anybody else feels like writing this up in a nice way for the FAQ (Oleg?) that'd even be better. Just send your contributions to the ZDP list. Regards, Martijn
Hi! That is, there are DTML Scripts and External Methods. Python code is used in External Methods and Products, but never goes into Object Database. On Thu, 11 Mar 1999, Martijn Faassen wrote:
In ExternalMethods.html I found: "ernal Methods operate just like normal methods". But what are "normal" methods? The only thing I know is DTML Scripts. Are there other? Could I put Python code into Object Database? Should I?
I think that DTML Methods (or Documents?) are meant. They are like methods to the folder objects that Zope publishes. Look at: http://localhost/Zope/foo/bar/doc as asking Zope 'okay, folder 'foo', I want your subfolder 'bar' (this could be seen as using a method on foo to request 'bar'), and then I want to view 'doc' (which is, let's say, a DTML method) in bar. 'doc' in that case is a method of the bar object, which, when called, returns HTML code (to the browser).
An *external* method is a method which comes from outside the Zope object database (though it's loaded into it, and behaves just like a normal internal method).
If all this talk turns out to be correct (somebody tell me or send corrections), then I can turn this into a FAQ entry. If anybody else feels like writing this up in a nice way for the FAQ (Oleg?) that'd even be better. Just send your contributions to the ZDP list.
Regards,
Martijn
Oleg. ---- Oleg Broytmann National Research Surgery Centre http://sun.med.ru/~phd/ Programmers don't die, they just GOSUB without RETURN.
Oleg Broytmann wrote:
Hi!
That is, there are DTML Scripts and External Methods. Python code is used in External Methods and Products, but never goes into Object Database.
I think it's true Product python code doesn't go into the Object Database, but I'm unclear about what happens with External Method python code. You need press the 'edit' button for an external method in Zope each time you changed something in it and want it updated. This would imply Python code can indeed be part of the Object database, right? Regards, Martijn
On Thu, 11 Mar 1999, Martijn Faassen wrote:
I think it's true Product python code doesn't go into the Object Database, but I'm unclear about what happens with External Method python code. You need press the 'edit' button for an external method in Zope each time you changed something in it and want it updated. This would imply Python code can indeed be part of the Object database, right?
Actually not. For security reasons the code of an External method does not reside in the Object Database but in the filesystem. When you press the 'edit' button the code is read and evaluated and it is the evaluated code that is stored in the Object Database. There was a thread about whether the source code should be included in the Object Database but I think thge Digital Creators were not convinced. Pavlos
On Thu, 11 Mar 1999, Pavlos Christoforou wrote:
imply Python code can indeed be part of the Object database, right?
Actually not. For security reasons the code of an External method does not reside in the Object Database but in the filesystem. When you press the 'edit' button the code is read and evaluated and it is the evaluated
What is "evaluated"? Compiled?
code that is stored in the Object Database. There was a thread about whether the source code should be included in the Object Database but I
I watched the thread and did understand the security implications.
think thge Digital Creators were not convinced.
Pavlos
Oleg. ---- Oleg Broytmann National Research Surgery Centre http://sun.med.ru/~phd/ Programmers don't die, they just GOSUB without RETURN.
On Thu, 11 Mar 1999, Oleg Broytmann wrote:
What is "evaluated"? Compiled?
code that is stored in the Object Database. There was a thread about whether the source code should be included in the Object Database but I
I watched the thread and did understand the security implications.
Well this is how I understood the process. Basically the code is read and exec-ed and the the func_code func_code.co_varnames are extracted. Then they apply all the clever tricks to turn the function into a valid Zope method, by (I assume) creating a Zope method and replacing its func_code and the associated func_defaults and arguments with the ones extracted from the external function. The relevant code can be found in Zope/lib/python/App/Extensions.py and Zope/lib/python/Products/ExternalMethod/ExternalMethod.py Pavlos
Hi! Thank you! On Thu, 11 Mar 1999, Pavlos Christoforou wrote:
Well this is how I understood the process.
Basically the code is read and exec-ed and the the func_code func_code.co_varnames are extracted. Then they apply all the clever tricks to turn the function into a valid Zope method, by (I assume) creating a Zope method and replacing its func_code and the associated func_defaults and arguments with the ones extracted from the external function.
The relevant code can be found in Zope/lib/python/App/Extensions.py and Zope/lib/python/Products/ExternalMethod/ExternalMethod.py
Pavlos
Oleg. ---- Oleg Broytmann National Research Surgery Centre http://sun.med.ru/~phd/ Programmers don't die, they just GOSUB without RETURN.
On Thu, 11 Mar 1999, Martijn Faassen wrote:
I think it's true Product python code doesn't go into the Object Database, but I'm unclear about what happens with External Method python code. You need press the 'edit' button for an external method in Zope each time you changed something in it and want it updated. This would imply Python code can indeed be part of the Object database, right?
May be... Thanks for replaying.
Regards,
Martijn
Oleg. ---- Oleg Broytmann National Research Surgery Centre http://sun.med.ru/~phd/ Programmers don't die, they just GOSUB without RETURN.
At 16:14 11/03/99 , Martijn Faassen wrote:
Oleg Broytmann wrote:
Hi!
That is, there are DTML Scripts and External Methods. Python code is used in External Methods and Products, but never goes into Object Database.
I think it's true Product python code doesn't go into the Object Database, but I'm unclear about what happens with External Method python code. You need press the 'edit' button for an external method in Zope each time you changed something in it and want it updated. This would imply Python code can indeed be part of the Object database, right?
No, it forces Python to recompile the code. The code itself is NOT stored int the object database. Only instance data is stored in the object database, no code is. Zope classes are said to change all this, aren't they, DC? -- M.J. Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-6254545 Fax: +31-35-6254555 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
Martijn Pieters wrote:
Martijn Faassen wrote:
You need press the 'edit' button for an external method in Zope each time you changed something in it and want it updated. This would imply Python code can indeed be part of the Object database, right?
No, it forces Python to recompile the code. The code itself is NOT stored int the object database. Only instance data is stored in the object database, no code is. Zope classes are said to change all this, aren't they, DC?
Aah, of course, I see. Thanks! Martijn
participants (4)
-
Martijn Faassen -
Martijn Pieters -
Oleg Broytmann -
Pavlos Christoforou