Re: [Zope] Add python class to Zope.
Pattreeya Tanisaro writes:
I found some python sources which declared "class" inside. I tried to call the function inside this class with external method and python script but it didn't work out.
class Guestbook: def __init__ .... def signGuestBook .... def feedBack. .. How can I call the function "feedBack" to Zope? Read the paper on Zope Security. Otherwise, you will not be lucky.
You would not call the function directly from Zope, but as a method of an instance "gb" of "Guestbook". Once you have such an instance, you would use <dtml-with gb> <dtml-var feedback> </dtml-with> Note that function definitions in Python have parameter declaration. It's probably advicable to look into a Python book or its online documentation, too. ... before you start your project. Probably, you should also read the Zope book... Dieter
Hi Deiter, Checked your response for one of the 'Add Python Class' queries. If I have a scenario,where I return a list of objects of my Class, and then try to loop through them from DTML,say like this, <dtml-in objectList mapping> <dtml-var objectMethod> </dtml-in> Can I call objectMethod on each of the objects.It popped up the Authentication Window when I tried to access the object method with mapping,but the other object attributes are accessible. Should I have some is_method_supported or something of that sort for the objects of my class. Can I display the objects if I have a __repr__ defined in my class for an object which returns the object representation within a dtml-in with a mapping attribute call.I cant do <dtml-var sequence-item> as sequence-item is not accessible within a mapping and I dont want to do <dtml-var __repr__> How do I get rid of this mapping attribute to loop through an objectList and still have the access to sequence-item and such stuffs of dtml-in. Should I inherit from Acquisition,and then set the aq_parent and aq_base appropriately. Kindly help me. Bye, A.R.Karthick
Pattreeya Tanisaro writes:
I found some python sources which declared "class" inside. I tried to call the function inside this class with external method and python script but it didn't work out.
class Guestbook: def __init__ .... def signGuestBook .... def feedBack. .. How can I call the function "feedBack" to Zope? Read the paper on Zope Security. Otherwise, you will not be lucky.
You would not call the function directly from Zope, but as a method of an instance "gb" of "Guestbook". Once you have such an instance, you would use
<dtml-with gb> <dtml-var feedback> </dtml-with>
Note that function definitions in Python have parameter declaration.
It's probably advicable to look into a Python book or its online documentation, too. ... before you start your project.
Probably, you should also read the Zope book...
Dieter
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Hello Dieter, how can I create the instance "gb" that inherit the Guestbook 's property from Guestbook class in Zope? I know how to do it in python but I don't know how to do so in Zope. Thank you in advance. pattreeya.
class Guestbook: def __init__ .... def signGuestBook .... def feedBack. .. How can I call the function "feedBack" to Zope?
Read the paper on Zope Security. Otherwise, you will not be lucky.
You would not call the function directly from Zope, but as a method of an instance "gb" of "Guestbook". Once you have such an instance, you would use
<dtml-with gb> <dtml-var feedback> </dtml-with>
Note that function definitions in Python have parameter declaration.
It's probably advicable to look into a Python book or its online documentation, too. ... before you start your project.
Probably, you should also read the Zope book...
Dieter
Pattreeya Tanisaro writes:
Hello Dieter, how can I create the instance "gb" that inherit the Guestbook 's property from Guestbook class in Zope? I know how to do it in python but I don't know how to do so in Zope. Look at zope.org for the "Product Developper Guide".
Dieter
participants (3)
-
Dieter Maurer -
karthick ramanarayanan -
Pattreeya Tanisaro