RE: [Zope-dev] Re: Better encapsulation is good...

2000-08-25 Thread odysseus

On Fri, 25 Aug 2000, Chris McDonough wrote:
> 
> Did you run the Article class through Globals.default__class_init__()?
> E.g. (at the module level), e.g.:
> 
> Globals.default__class_init__(Article)
> 

Yes, I tried this too, (saw it in the mailing list archive). 

I still don't understand why it's not working. I can give you the exact
line where in the validate() method in ZopeSecurityPolicy.py it's failing
(line 161), if it helps at all (again, I'm not well versed in the Zope
security internals):
   if p is None:
p=getattr(container,
  '__allow_access_to_unprotected_subobjects__', None)

getattr() returns None, then this happens:

   if not p:
if (containerbase is accessedbase):
raise 'Unauthorized', cleanupName(name, value)

Any suggestions would be helpful,

-Lance



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




[Zope-dev] Re: Yup, the problem's still there...

2000-08-22 Thread odysseus


Ah That would explain it!

How about this, instead of an attribute, I created a method:
 def icon(self):
   return 'misc_/Squishdot/squishfile_img'

This seemed to work. Attached is the patch. Comments?

-Lance

On Tue, 22 Aug 2000, Chris Withers wrote:

> Lance wrote:
> > I think you have to not only
> > inherit RoleManager, but OFS.SimpleItem.Item as well. At least, that's what
> > the Security HOWTO seems to imply.
> 
> No, it shouldn't :(
> 
> SimpleItem.Item has __allow_access_to_unprotected_subobjects__=1 in it,
> so it just masks the problem rather than solving it properly...
> 
> cheers,
> 
> Chris
> 


*** Squishfile.py   Tue Aug 22 09:50:10 2000
--- Squishfile.py.orig  Mon Aug 21 20:21:01 2000
***
*** 127,144 
  from Globals import Persistent  
  from Acquisition import Acquirer  
  from Globals import HTML  
! from ImageFile import ImageFile
! from AccessControl.Role import RoleManager
! 
  #from creosote import spew  

  sep=re.compile('|/|:')  # handle windows(\)/unix(/)/mac(:) path separators  

! class Squishfile(Acquirer,Persistent,RoleManager):  
  """ """  
! __ac_permissions__=(
! ('Use Squishfile Objects',['file_name','file_type','content_type', 
'file_kbytes', 'date_created','date_modified','icon','file_bytes'], ('Anonymous', 
'Manager')),
! )
  _types={'application/octet-stream': 'Binary File',  
  'application/x-gzip' :  'Compressed File',  
  'application/x-compress':   'Compressed File',  
--- 127,141 
  from Globals import Persistent  
  from Acquisition import Acquirer  
  from Globals import HTML  
! from ImageFile import ImageFile  
  #from creosote import spew  

  sep=re.compile('|/|:')  # handle windows(\)/unix(/)/mac(:) path separators  

! class Squishfile(Acquirer,Persistent):  
  """ """  
! icon='misc_/Squishdot/squishfile_img'  
!   
  _types={'application/octet-stream': 'Binary File',  
  'application/x-gzip' :  'Compressed File',  
  'application/x-compress':   'Compressed File',  
***
*** 173,180 
  #spew('sqf ctype: ' + self._ctype)  
  self._created =time.time()  
  self._modified=self._created  
- def icon(self):
-   return 'misc_/Squishdot/squishfile_img'

  def content_type(self):  
  """ content type """  
--- 170,175 
***
*** 213,221 
  return self._file  

  index_html=__repr__  
- 
- 
- 
- 
- 
- 
--- 208,210