Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Dev

subobject in BaseObject

 

 

Zope dev RSS feed   Index | Next | Previous | View Threaded


panjy at zopechina

Jan 11, 2005, 10:00 AM

Post #1 of 3 (825 views)
Permalink
subobject in BaseObject

Archetypes has a cool feature: when MS doc are transform to html,
pictures in the doc are stored as subobject of the content.

After many tests, the feature works only when anonymous can view the
content. Or the picture will not show even I login at admin.

I traced it, and found it fails at the last step: it returns the correct
wrapper object, but fails when call the following __call__ method(no
permission). It is quite strange since the
__allow_access_to_unprotected_subobjects__ is already in the Wrapper class.

Any hint for me?

# the Wrapper class in BaseObject.py:
class Wrapper:
"""wrapper object for access to sub objects """
__allow_access_to_unprotected_subobjects__ = 1

def __init__(self, data, filename, mimetype):
self._data = data
self._filename = filename
self._mimetype = mimetype

def __call__(self, REQUEST=None, RESPONSE=None):
if RESPONSE is None:
RESPONSE = REQUEST.RESPONSE
if RESPONSE is not None:
mt = self._mimetype
name =self._filename
RESPONSE.setHeader('Content-type', str(mt))
RESPONSE.setHeader('Content-Disposition',
'inline;filename=%s' % name)
RESPONSE.setHeader('Content-Length', len(self._data))
return self._data

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


fg at nuxeo

Jan 12, 2005, 10:29 AM

Post #2 of 3 (782 views)
Permalink
Re: subobject in BaseObject [In reply to]

Please report Plone or Archetypes problems on their appropriate lists.

Florent

Pan Junyong <panjy [at] zopechina> wrote:
> Archetypes has a cool feature: when MS doc are transform to html,
> pictures in the doc are stored as subobject of the content.
>
> After many tests, the feature works only when anonymous can view the
> content. Or the picture will not show even I login at admin.
>
> I traced it, and found it fails at the last step: it returns the correct
> wrapper object, but fails when call the following __call__ method(no
> permission). It is quite strange since the
> __allow_access_to_unprotected_subobjects__ is already in the Wrapper class.
>
> Any hint for me?
>
> # the Wrapper class in BaseObject.py:
> class Wrapper:
> """wrapper object for access to sub objects """
> __allow_access_to_unprotected_subobjects__ = 1
>
> def __init__(self, data, filename, mimetype):
> self._data = data
> self._filename = filename
> self._mimetype = mimetype
>
> def __call__(self, REQUEST=None, RESPONSE=None):
> if RESPONSE is None:
> RESPONSE = REQUEST.RESPONSE
> if RESPONSE is not None:
> mt = self._mimetype
> name =self._filename
> RESPONSE.setHeader('Content-type', str(mt))
> RESPONSE.setHeader('Content-Disposition',
> 'inline;filename=%s' % name)
> RESPONSE.setHeader('Content-Length', len(self._data))
> return self._data
>
> _______________________________________________
> Zope-Dev maillist - Zope-Dev [at] zope
> http://mail.zope.org/mailman/listinfo/zope-dev
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope )
>


--
Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg [at] nuxeo
_______________________________________________
Zope-Dev maillist - Zope-Dev [at] zope
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )


dieter at handshake

Jan 13, 2005, 1:24 PM

Post #3 of 3 (780 views)
Permalink
Re: subobject in BaseObject [In reply to]

Pan Junyong wrote at 2005-1-12 02:00 +0800:
>Archetypes has a cool feature: when MS doc are transform to html,
>pictures in the doc are stored as subobject of the content.
>
>After many tests, the feature works only when anonymous can view the
>content. Or the picture will not show even I login at admin.
>
>I traced it, and found it fails at the last step: it returns the correct
>wrapper object, but fails when call the following __call__ method(no
>permission).

Did you read already that questions must always be accompanied
with complete information -- especially the precise error text,
the corresponding traceback an a code snippet that caused the
exception?

Furthermore, the "VerboseSecurity" product can help you
to analyse permission problems.

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

Zope dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.