Jan Pokorný wrote:
Hello,

I have created an external method which returns an class object:

def validateUser(username,password):
   res = Result()
   ... some code producing reply ...
   if reply != None:
       res.success = True
   return res

The method works well.

But when I try use res.success (in another script or in TAL in a page template), Plone returns an error saying Unauthorized: You are not allowed to access 'success' in this context .


Try to set

__allow_access_to_unprotected_subobjects__ = 1

as attribute of the Result class.
See eg. Products/CMFPlone/PloneBatch.py/class Batch.

If you want to import Result class from Python script or Page template, you must use allow_module/allow_class as Hedley wrote.

--
Radim Novotny


For example:

if res.success == True:
   return 'OK'
else:
   return 'KO'

Is there any restriction in returning class objects from external methods? Have I missed something?

Thank you for any help.

Jan


_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to