[z3-five] objects, security,etc

kevin7kal plone at kevinkal.com
Wed Jul 19 21:31:11 CEST 2006


Ok, I have written a sample product that illustrates what I am trying to 
accomplish and I have a sample python script for ttw testing that shows 
where my issues are.
Attached is the product and here is some sample script

in the zmi, create 'my Zclass object'
then in a Script('Python') try this code
MZ = context.Zclass2
#print MZ.attribute1b.method1()
print MZ.attribute1b
print MZ.attribute1a
return printed

this is what is returned

<class 'Products.sampleProduct.myClass.class1'>
attribute 1a

but if line 4 in uncommented, the security error is returned and I don't 
understand how to get around that.

All help is appreciated and if the answer was simple, please excuse my 
ignorance :-)



kevin7kal wrote:
> I'm still having issues with this.  I have tried adding
> <class class="class.class1">
> <require permission="zope2.View" attributes="attribute1 attribute2" />
> </class>
> and continue to recieve unauthorized error.  I can create a my 'zclass' 
> and do something like
> test=context.zclass.method2
> print test
> return printed
>
> but continue to recieve unauthorized errors when I try to access the 
> attributes
> print test.attribute1
>
> I have tried to have class1 inherit from Aquisition.Explicit as well and 
> still cannot access this object.
>
> Any suggestions are appreciated.
>
> kevin7kal wrote:
>   
>> I should mention, this is zope 2.9.3
>>
>>
>> kevin7kal wrote:
>>   
>>     
>>> I am attempting to bring a new object class into zope five and having 
>>> some issues that hopefully someone can help with.
>>> Here is a simple example of my situation.
>>> I have class.py,zclass.py
>>> class.py
>>>
>>> class1(object):
>>>    '''a simple class''''
>>>     attribute1='a string''
>>>     attribute2='another string'
>>>
>>> class2(object):
>>>      def __init__(self,value1,value2):
>>>      
>>>      def method1():
>>>      print somemethod
>>>
>>>      def method2():
>>>      returnobject = class1()
>>>      return returnobject
>>>
>>> zclass.py
>>> import class
>>>
>>> zclass2(SimpleItem,class.class2):
>>> """"doctstring""""
>>>     implements(Izclass2)
>>>      def __init__(self,,tmpID='',tmpTITLE='')
>>>      return
>>>
>>> I have all of the interface things done and the all classes in class.py 
>>> are five traversable.
>>> I can use class2.method1 with no problems, but class2.method2 returns a 
>>> class1 object.  The problem is when I try to access any methods or 
>>> attributes on the class1 object that is returned, I have permission 
>>> denied.  How can I make it so the methods and attributes of this object 
>>> are accessable?
>>>
>>> _______________________________________________
>>> z3-five mailing list
>>> z3-five at codespeak.net
>>> http://codespeak.net/mailman/listinfo/z3-five
>>>
>>>   
>>>     
>>>       
>> _______________________________________________
>> z3-five mailing list
>> z3-five at codespeak.net
>> http://codespeak.net/mailman/listinfo/z3-five
>>
>>   
>>     
> _______________________________________________
> z3-five mailing list
> z3-five at codespeak.net
> http://codespeak.net/mailman/listinfo/z3-five
>
>   
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sampleProduct.tgz
Type: application/x-compressed
Size: 1200 bytes
Desc: not available
Url : http://codespeak.net/pipermail/z3-five/attachments/20060719/6b07fe13/attachment.bin 


More information about the z3-five mailing list