Re: [Zope] proxy role for an external method
On Mon, Oct 10, 2005 at 07:27:11PM +0200, Andreas Jung wrote:
Are you using CMF/Plone?
yes. the main part of the function is: for brain in self.portal_catalog(portal_type='User', SearchableText=SearchableText): user = brain.getObject() if user is None: continue results.append(getUserInfo(user)) This works in a pyhton script but not in an external one -- __________________________________________________ "Nothing is as subjective as reality" Reinoud van Leeuwen reinoud.v@n.leeuwen.net http://www.xs4all.nl/~reinoud __________________________________________________
2005/10/10, Reinoud van Leeuwen <reinoud.v@n.leeuwen.net>:
On Mon, Oct 10, 2005 at 07:27:11PM +0200, Andreas Jung wrote:
Are you using CMF/Plone?
yes. the main part of the function is:
for brain in self.portal_catalog(portal_type='User', SearchableText=SearchableText): user = brain.getObject() if user is None: continue results.append(getUserInfo(user))
This works in a pyhton script but not in an external one
I find this hard to believe. But, for the External Method you might need to allow Anonymous to View it if it's at all protected. What's the output when you do it via xmlrpc? Is it [] or error? -- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com
On Mon, Oct 10, 2005 at 10:57:25PM +0100, Peter Bengtsson wrote:
2005/10/10, Reinoud van Leeuwen <reinoud.v@n.leeuwen.net>:
On Mon, Oct 10, 2005 at 07:27:11PM +0200, Andreas Jung wrote:
Are you using CMF/Plone?
yes. the main part of the function is:
for brain in self.portal_catalog(portal_type='User', SearchableText=SearchableText): user = brain.getObject() if user is None: continue results.append(getUserInfo(user))
This works in a pyhton script but not in an external one
I find this hard to believe. But, for the External Method you might need to allow Anonymous to View it if it's at all protected.
Done that
What's the output when you do it via xmlrpc? Is it [] or error? []
I understood that Plone does some extra magic, so I have to setup a securoty context... I'll post it here if I have a working solution -- __________________________________________________ "Nothing is as subjective as reality" Reinoud van Leeuwen reinoud.v@n.leeuwen.net http://www.xs4all.nl/~reinoud __________________________________________________
2005/10/10, Reinoud van Leeuwen <reinoud.v@n.leeuwen.net>:
On Mon, Oct 10, 2005 at 10:57:25PM +0100, Peter Bengtsson wrote:
2005/10/10, Reinoud van Leeuwen <reinoud.v@n.leeuwen.net>:
On Mon, Oct 10, 2005 at 07:27:11PM +0200, Andreas Jung wrote:
Are you using CMF/Plone?
yes. the main part of the function is:
for brain in self.portal_catalog(portal_type='User', SearchableText=SearchableText): user = brain.getObject() if user is None: continue results.append(getUserInfo(user))
This works in a pyhton script but not in an external one
I find this hard to believe. But, for the External Method you might need to allow Anonymous to View it if it's at all protected.
Done that
What's the output when you do it via xmlrpc? Is it [] or error? []
Can you then debug wether it that's because portal_catalog(**kws) doesn't return anything or because brain.getObject() constantly returns None?
I understood that Plone does some extra magic, so I have to setup a securoty context... I'll post it here if I have a working solution
Shouldn't really be the problem. Isn't portal_catalog just another ZCatalog that has nothing to do with Plone except it's located inside a Plone instance.
-- __________________________________________________ "Nothing is as subjective as reality" Reinoud van Leeuwen reinoud.v@n.leeuwen.net http://www.xs4all.nl/~reinoud __________________________________________________ _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com
On 10 Oct 2005, at 23:14, Peter Bengtsson wrote:
I understood that Plone does some extra magic, so I have to setup a securoty context... I'll post it here if I have a working solution
Shouldn't really be the problem. Isn't portal_catalog just another ZCatalog that has nothing to do with Plone except it's located inside a Plone instance.
It *is* a problem. The reason is most likiely all the extra stuff the catalog tool adds to the query before it reaches the actual catalog. The workaround is something like this: from Products.ZCatalog.ZCatalog import ZCatalog results = ZCatalog.searchResults(portal_catalog, **kws) That way you circumvent any query munging done in the catalog tool searchResults method, specifically the effective/expires and allowedRolesAndUsers filtering. jens
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jens Vagelpohl wrote:
On 10 Oct 2005, at 23:14, Peter Bengtsson wrote:
I understood that Plone does some extra magic, so I have to setup a securoty context... I'll post it here if I have a working solution
Shouldn't really be the problem. Isn't portal_catalog just another ZCatalog that has nothing to do with Plone except it's located inside a Plone instance.
It *is* a problem. The reason is most likiely all the extra stuff the catalog tool adds to the query before it reaches the actual catalog. The workaround is something like this:
from Products.ZCatalog.ZCatalog import ZCatalog results = ZCatalog.searchResults(portal_catalog, **kws)
That way you circumvent any query munging done in the catalog tool searchResults method, specifically the effective/expires and allowedRolesAndUsers filtering.
CMF's CatalogTool grep an 'unrestrictedSearchResults' method which does exactly that -- it can only be called from trusted code, but an ExternalMethod certainly qualifies. Tres. - -- =================================================================== Tres Seaver +1 202-558-7113 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFDS7f5+gerLs4ltQ4RAhkSAKC7zy58wb+UmoiFb0e5fhCRB9SjSgCgzkRK qIGTnVO1neNoaAD1hr9T/Og= =T5H3 -----END PGP SIGNATURE-----
Reinoud van Leeuwen wrote:
On Mon, Oct 10, 2005 at 07:27:11PM +0200, Andreas Jung wrote:
Are you using CMF/Plone?
yes. the main part of the function is:
for brain in self.portal_catalog(portal_type='User', SearchableText=SearchableText): user = brain.getObject() if user is None: continue results.append(getUserInfo(user))
This works in a pyhton script but not in an external one
At this point I'd recommend my SainBrains product: http://www.simplistix.co.uk/software/zope/sanebrains Then, change your user = line to: user = brain._unrestrictedGetObject() cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
On Tue, Oct 11, 2005 at 07:29:27AM +0100, Chris Withers wrote:
Reinoud van Leeuwen wrote:
On Mon, Oct 10, 2005 at 07:27:11PM +0200, Andreas Jung wrote:
Are you using CMF/Plone?
yes. the main part of the function is:
for brain in self.portal_catalog(portal_type='User', SearchableText=SearchableText): user = brain.getObject() if user is None: continue results.append(getUserInfo(user))
This works in a pyhton script but not in an external one
At this point I'd recommend my SainBrains product: http://www.simplistix.co.uk/software/zope/sanebrains
Then, change your user = line to:
user = brain._unrestrictedGetObject()
That is exactly what I need! Thanks! I'll clean up the code and paste it here this afternoon so a working solution ends up in the archives. (I hate it to find discussions on google without the final solution to the problem ";-) -- __________________________________________________ "Nothing is as subjective as reality" Reinoud van Leeuwen reinoud.v@n.leeuwen.net http://www.xs4all.nl/~reinoud __________________________________________________
participants (5)
-
Chris Withers -
Jens Vagelpohl -
Peter Bengtsson -
Reinoud van Leeuwen -
Tres Seaver