Re: [Zope] Want to access ZClass Instance from external program

2000-10-19 Thread Jon Prettyman

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

-jon

Ender [EMAIL PROTECTED] 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': '', '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', ['']), ('', ['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.
 

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




Re: [Zope] Want to access ZClass Instance from external program

2000-10-18 Thread Jon Prettyman

Well, I've gotten xmlprclib and fixed it up so I can talk to my
server.  So far I can retrieve objectIds and retrieve objects via an
objectid, but I can't figure out how to get to the property sheets.

Here's what I've got:

server = Server( "http://jonprettyman.com" )

print server

for k,v in
server.EBQ.id_company_apply_html.propertysheets.common.propertyItems():
print "%-15s: %s" % (k, v)

My ZClass has a propertysheet named ``common''

The error I get is:
  -2 Unexpected Zope Error Value
  
and a bunch of HTML which boils down to:

   Resource not found

-jon


Kapil Thangavelu [EMAIL PROTECTED] writes:

 its easiest to it with (IMO)
 
 xml-rpc 
 
 and find your zclasses with calls to objectids and query the
 propertysheets directly for property info.
 
 
 check out 
 
 http://www.zope.org/Members/Amos/xmlrpclib.py
 you'll need to fix a base class and an import.
 
 www.xml-rpc.com
 
 www.xml.com search for amos
 
 and zope.org for howtos on xmlrpc
 
 Cheers
 
 Kapil
 
 ___
 Zope maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists - 
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope-dev )

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




Re: [Zope] Want to access ZClass Instance from external program

2000-10-18 Thread Ender

Jon Prettyman wrote:
 
 Well, I've gotten xmlprclib and fixed it up so I can talk to my
 server.  So far I can retrieve objectIds and retrieve objects via an
 objectid, but I can't figure out how to get to the property sheets.
 
 Here's what I've got:
 
 server = Server( "http://jonprettyman.com" )
 
 print server
 
 for k,v in
 server.EBQ.id_company_apply_html.propertysheets.common.propertyItems():
 print "%-15s: %s" % (k, v)
 
 My ZClass has a propertysheet named ``common''
 
 The error I get is:
   -2 Unexpected Zope Error Value
 
 and a bunch of HTML which boils down to:
 
Resource not found
 
 -jon

hmmm...

try and take it a step back and query the propertysheet container for
 names of propertysheets it contains. you'll need to check out the ZQR 
for the syntax, i think its propertyIds().


you might also want to check that your authenticating with a user
that has the proper security roles to query this info. 


if you're still having problems tell me and i'll play with it once i get
back from work.

Cheers

Kapil

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




Re: [Zope] Want to access ZClass Instance from external program

2000-10-18 Thread Jon Prettyman

Adding:
try:
for k in
server.EBQ.id_company_apply_html.propertysheets.propertyIds():
print "%-15s:" % (k)
except Error, v:
print server
print "ERROR", v

Gives me output, although I'm pretty shure it's not the right thing.  
Output:
   title
   base

Both of these are properties of server.EBQ.

-jon

Ender [EMAIL PROTECTED] writes:

 Jon Prettyman wrote:
  
  Well, I've gotten xmlprclib and fixed it up so I can talk to my
  server.  So far I can retrieve objectIds and retrieve objects via an
  objectid, but I can't figure out how to get to the property sheets.
  
  Here's what I've got:
  
  server = Server( "http://jonprettyman.com" )
  
  print server
  
  for k,v in
  server.EBQ.id_company_apply_html.propertysheets.common.propertyItems():
  print "%-15s: %s" % (k, v)
  -jon
 
 hmmm...
 
 try and take it a step back and query the propertysheet container for
  names of propertysheets it contains. you'll need to check out the ZQR 
 for the syntax, i think its propertyIds().
 
 
 you might also want to check that your authenticating with a user
 that has the proper security roles to query this info. 
 
 
 if you're still having problems tell me and i'll play with it once i get
 back from work.
 
 Cheers
 
 Kapil
 
 ___
 Zope maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists - 
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope-dev )

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




Re: [Zope] Want to access ZClass Instance from external program

2000-10-18 Thread Ender

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': '', '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', ['']), ('', ['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.

the rest of the ways are exercises in wasting time... IMO

hope that helps out

Cheers

Kapil

Jon Prettyman wrote:
 
 Adding:
 try:
 for k in
 server.EBQ.id_company_apply_html.propertysheets.propertyIds():
 print "%-15s:" % (k)
 except Error, v:
 print server
 print "ERROR", v
 
 Gives me output, although I'm pretty shure it's not the right thing.
 Output:
title
base
 
 Both of these are properties of server.EBQ.
 
 -jon
 
 Ender [EMAIL PROTECTED] writes:
 
  Jon Prettyman wrote:
  
   Well, I've gotten xmlprclib and fixed it up so I can talk to my
   server.  So far I can retrieve objectIds and retrieve objects via an
   objectid, but I can't figure out how to get to the property sheets.
  
   Here's what I've got:
  
   server = Server( "http://jonprettyman.com" )
  
   print server
  
   for k,v in
   server.EBQ.id_company_apply_html.propertysheets.common.propertyItems():
   print "%-15s: %s" % (k, v)
   -jon
 
  hmmm...
 
  try and take it a step back and query the propertysheet container for
   names of propertysheets it contains. you'll need to check out the ZQR
  for the syntax, i think its propertyIds().
 
 
  you might also want to check that your authenticating with a user
  that has the proper security roles to query this info.
 
 
  if you're still having problems tell me and i'll play with it once i get
  back from work.
 
  Cheers
 
  Kapil
 
  ___
  Zope maillist  -  [EMAIL PROTECTED]
  http://lists.zope.org/mailman/listinfo/zope
  **   No cross posts or HTML encoding!  **
  (Related lists -
   http://lists.zope.org/mailman/listinfo/zope-announce
   http://lists.zope.org/mailman/listinfo/zope-dev )
 
 ___
 Zope maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists -
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope-dev )

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




[Zope] Want to access ZClass Instance from external program

2000-10-17 Thread Jon Prettyman

I have a folder containing a bunch of ZClass instances that I want to
access from an external (non-web) python application.

I need to be able to read the values of the instance properties.

Is there a way to do this with the ZClient stuff?  If not, what can I
use.  If yes, any pointers?

-jon

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




Re: [Zope] Want to access ZClass Instance from external program

2000-10-17 Thread Kapil Thangavelu

Jon Prettyman wrote:
 
 I have a folder containing a bunch of ZClass instances that I want to
 access from an external (non-web) python application.
 
 I need to be able to read the values of the instance properties.
 
 Is there a way to do this with the ZClient stuff?  If not, what can I
 use.  If yes, any pointers?
 
 -jon


its easiest to it with (IMO)

xml-rpc 

and find your zclasses with calls to objectids and query the
propertysheets directly for property info.


check out 

http://www.zope.org/Members/Amos/xmlrpclib.py
you'll need to fix a base class and an import.

www.xml-rpc.com

www.xml.com search for amos

and zope.org for howtos on xmlrpc

Cheers

Kapil

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