[Zope] Want to access ZClass Instance from external program

Jon Prettyman jprettyman@acm.org
19 Oct 2000 10:53:43 -0700


This works like a charm.  Thanks much for the help.

-jon

Ender <kthangavelu@earthlink.net> writes:

> Sorry Jon, i've lead you down a slippery slope...
> 
> unlike ttw dtml-methods and the rest of zope which relies on the
> security context soley, for a filesys python method to be exposed
> through the web via xml-rpc it must have a doc string as well as have
> proper credentials.
> 
> looking through propertysheets there is no 'proper' way to do this...
> but i lead you down the path, so here is a way back out... 
> 
> there are a couple of options.
> 
> the easiest is to have dtml_method for this zclass that functions as a
> helper method, 
> like
> 
> dtml method -- external_helper
> 
> <dtml-var "propertysheets.propertyMap()">
> 
> and in the client
> 
> x = root.subfolder.zclass.external_helper()
> meta_info=eval(x)
> print meta_info
> ({'id': 'vvv', 'type': 'int', 'meta': {}, 'mode': 'w'}, {'id': 'aaa',
> 'type': 'lines', 'meta': {}, 'mode': 'w'}, {'id': 'ssss', 'type':
> 'tokens', 'meta': {}, 'mode': 'w'}, {'id': '122', 'type': 'date',
> 'meta': {}, 'mode': 'w'}, {'id': 'ff', 'type': 'float', 'meta': {},
> 'mode': 'w'}, {'id': '>>', 'type': 'text', 'meta': {}, 'mode': 'w'})
> 
> or if external_helper returned propertyItems()
> 
> [('vvv', 1), ('aaa', ['bbbb']), ('ssss', ['ss', 'aa1113', '3', '4']),
> ('122', DateTime('1900/01/01')), ('ff', 455.0), ('>>', '')]
> 
> 
> if you're working with DateTime values in your propertysheets this will
> be trickier as you'll need to either retrieve the property you want
> independently or import Zope's DateTime module. also remember to set the
> security on the helper method so its not helping somebody hack your
> site.
>