Re: [Zope] Python Classes and Zope.

2005-12-05 Thread Chris Withers
Paul Winkler wrote: 1) create a derived or wrapper class that inherits from Acquisition.Implicit or Acquisition.Explicit. This can either inherit from your existing class, or wrap it, as you prefer. You don't actually have to do this. 2) in the wrapper class, use ClassSecurityInfo() to

Re: [Zope] Python Classes and Zope.

2005-12-05 Thread Chris Withers
Chris McDonough wrote: Not really, and that's why Zope 3 has avoided through the web code so far. I hope this avoidance continues at least in the core, whatever that is, but I see rumblings every so often about why this is a can't-live-without thing (with which I strongly disagree).

Re: [Zope] Python Classes and Zope.

2005-12-02 Thread Chris Withers
Dario Lopez-Kästen wrote: Most, if not all examples, out there assume that the external packages/modules/classes can freely be converted to Zope-classes. No so, all you have to do is provide security assertions for them. I usually do this is a dummy product's __init__.py. See the examples

Re: [Zope] Python Classes and Zope.

2005-12-02 Thread Chris Withers
Fernando Lujan wrote: For instance, if I create the class: class MyClass: A simple example class i = 12345 def f(self): return 'hello world' Can I invoke the following code inside a Python Script? x = MyClass() x.f() Yes, but you shouldn't want to ;-) I'm using zope

Re: [Zope] Python Classes and Zope.

2005-12-02 Thread Chris Withers
Willi Langenberger wrote: You could add __allow_access_to_unprotected_subobjects__ = 1 You _could_, but that's a very old, deprecated interface. And, with the work Jim's talking about doing, it might actually stop working. nowadays you should do: security = ClassSecurityInfo()

Re: [Zope] Python Classes and Zope.

2005-12-02 Thread Paul Winkler
On Fri, Dec 02, 2005 at 09:38:56AM +, Chris Withers wrote: Dario Lopez-K?sten wrote: Most, if not all examples, out there assume that the external packages/modules/classes can freely be converted to Zope-classes. No so, all you have to do is provide security assertions for them. I

Re: [Zope] Python Classes and Zope.

2005-12-02 Thread Paul Winkler
On Thu, Dec 01, 2005 at 09:04:11PM +0100, Jean-Marc Orliaguet wrote: You need to call InitializeClass on your object, and that's it. cf http://www.upfrontsystems.co.za/courses/zope/ch04.html under Zopifying our Python classes initializeClass() only helps if the class you feed it inherits

Re: [Zope] Python Classes and Zope.

2005-12-02 Thread Chris McDonough
On Dec 2, 2005, at 9:49 AM, Paul Winkler wrote: You know, some days I wonder why it is that Zope is the only framework around that needs to distinguish between trusted and untrusted code. Nobody else seems to be looking at us with envy in this regard. Historically I know it was because there was

Re: [Zope] Python Classes and Zope.

2005-12-02 Thread Jean-Marc Orliaguet
Paul Winkler wrote: On Thu, Dec 01, 2005 at 09:04:11PM +0100, Jean-Marc Orliaguet wrote: You need to call InitializeClass on your object, and that's it. cf http://www.upfrontsystems.co.za/courses/zope/ch04.html under Zopifying our Python classes initializeClass() only helps if the

Re: [Zope] Python Classes and Zope.

2005-12-02 Thread Paul Winkler
On Fri, Dec 02, 2005 at 04:12:01PM +0100, Jean-Marc Orliaguet wrote: does zope2 do an access control based on acquisition for public methods, that would be a waste of resources since the answer is always yes, granted ? Well, the thing is, the declaration that makes the method public *has no

Re: [Zope] Python Classes and Zope.

2005-12-02 Thread Paul Winkler
On Fri, Dec 02, 2005 at 09:49:25AM -0500, Paul Winkler wrote: 2) in the wrapper class, use ClassSecurityInfo() to declare the methods you need public or permission-protected, or use allowAny(). Brain fart, sorry. There is no allowAny in ClassSecurityInfo or elsewhere. The quick-and-easy

Re: [Zope] Python Classes and Zope.

2005-12-01 Thread Martijn Pieters
On 12/1/05, Fernando Lujan [EMAIL PROTECTED] wrote: There's a way to use a Python class inside zope? For instance, if I create the class: class MyClass: A simple example class i = 12345 def f(self): return 'hello world' Can I invoke the following code inside a

Re: [Zope] Python Classes and Zope.

2005-12-01 Thread Andreas Jung
--On 1. Dezember 2005 13:46:55 -0200 Fernando Lujan [EMAIL PROTECTED] wrote: There's a way to use a Python class inside zope? For instance, if I create the class: class MyClass: A simple example class i = 12345 def f(self): return 'hello world' Can I invoke the

Re: [Zope] Python Classes and Zope.

2005-12-01 Thread Martijn Pieters
PythonScripts are for *scripting* not for implementing complex logic and for programming tasks that require classes. PythonScripts don't provide full Python functionality that why were are talking of *Restriced Python*. Consider writing your functionality as Python product. And sometimes a

Re: [Zope] Python Classes and Zope.

2005-12-01 Thread Peter Bengtsson
Sure you can. It's usually called a python product and there are tutorials and examples you can download from zope.org The core principle is to inherit from one of the zope classes that you can find in zope/lib/python/OFS such as Folder, SimpleItem or UniqueItem. When you do that you can save

Re: [Zope] Python Classes and Zope.

2005-12-01 Thread Andreas Jung
--On 1. Dezember 2005 17:00:09 +0100 Martijn Pieters [EMAIL PROTECTED] wrote: PythonScripts are for *scripting* not for implementing complex logic and for programming tasks that require classes. PythonScripts don't provide full Python functionality that why were are talking of *Restriced

Re: [Zope] Python Classes and Zope.

2005-12-01 Thread Fernando Lujan
Andreas Jung wrote: Sure you can but you shouldn't..you start with one class and at the end you have an application with tons of such codeyou can program that way but you shouldn't :-) I will print and read the Developer Book... ;) Thanks for all replies. Fernando Lujan

Re: [Zope] Python Classes and Zope.

2005-12-01 Thread Dario Lopez-Kästen
Andreas Jung wrote: --On 1. Dezember 2005 13:46:55 -0200 Fernando Lujan [EMAIL PROTECTED] wrote: There's a way to use a Python class inside zope? For instance, if I create the class: class MyClass: A simple example class i = 12345 def f(self): return 'hello world'

Re: [Zope] Python Classes and Zope.

2005-12-01 Thread Jean-Marc Orliaguet
Dario Lopez-Kästen wrote: Andreas Jung wrote: --On 1. Dezember 2005 13:46:55 -0200 Fernando Lujan [EMAIL PROTECTED] wrote: There's a way to use a Python class inside zope? For instance, if I create the class: class MyClass: A simple example class i = 12345 def f(self):

Re: [Zope] Python Classes and Zope.

2005-12-01 Thread Chris McDonough
So far I have not had any success with anything else than writing special methods in my Classes that converts the objects to dictionaries before passing them to the zpt or Script(Python) in question. But that feels like a very awkward way of doing things, and it makeas it *very*

Re: [Zope] Python Classes and Zope.

2005-12-01 Thread Willi Langenberger
According to Dario Lopez-Kästen: But in order to even display it in a zpt I must transmogrify it into a special zope-object, and *that* is not so easy as I have discovered. In my case I am not so interested in importing the moduels or classes into a Script(Python) - I have allready passed