[Zope-dev] Re: is an object in a folder

2004-08-26 Thread sureshvv
Why not:

  def hasObject(self, id):
  Test if an object is in the current object.
  return id in self.objectIds()

Suresh

Florent Guillaume [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I'd like to add a method like

  def hasObject(self, id):
  Test if an object is in the current object.
  for o in self._objects:
  if o['id'] == id:
  return 1
  return 0

 to ObjectManager.

 This would bring it in line with BTreeFolder2 (who already has an
 hasObject method) and we could then always use the most efficient method
 to test if a folder has a given subobject id.

 Opinions ?

 Florent

 -- 
 Florent Guillaume, Nuxeo (Paris, France)
 +33 1 40 33 71 59  http://nuxeo.com  mailto:[EMAIL PROTECTED]
 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 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 maillist  -  [EMAIL PROTECTED]
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] Re: Zope 2.7.2, restrictedTraverse or hasattr

2004-08-20 Thread sureshvv
Why dont you try:

'myobject' in Object3.objectIds('meta_type_name')

HTH,  Suresh

Kai Hoppert [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi all,

i actually have a Problem with restrictedTraverse and hasattr.

Object1
Object2
Object3


I want to test if there exists a Object in Object3 wich has the same id and
meta type how Object2 (id=myobject).
so i ask

Object3.restrictedTraverse('myobject',None) or

hasattr(Object3,'myobject')

i every time get's true back. I know that he jump's to Object2. i testet
this with absolute_url, but this makes no sense i think. Either i never
noticed that this both funktions works in this way or it is a bug. If it is
no bug has anybody a solution for my problem?

Greetings

Kai Hoppert
___
tomcom Gesellschaft für Informationstechnologie mbH
Heuriedweg 14 | D-88131 Lindau
Fon +49 (0)8382 975844 | Fax +49 (0)8382 975855
[EMAIL PROTECTED] | http://www.tomcom.de

This document should only be read by those persons to whom it is addressed
and is not intended to be relied upon by any person without subsequent
written confirmation of its contents.  tomcom disclaims all responsibility
and accepts no liability for the consequences of any person acting, or
refraining from acting on the contents of this document.  Any unauthorised
form of dissemination, copying, disclosure, modification, distribution
and/or publication of this message is strictly prohibited. For information
about tomcom please contact us on +49.8382.975844 or visit our web site at
www.tomcom.de


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
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 maillist  -  [EMAIL PROTECTED]
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] Re: Update Zope Site With Unix Python Scripts

2004-06-07 Thread sureshvv
Sure. Use Client.py.


Adriana Monti [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello,

 I am looking for a way to run custom python scripts in Unix, scheduled
 through cron, that will update the ZODB of our Zope site.  The requirement
 is that our site cannot be shut down to accommodate this.  We are running
 Zope 2.7.0.  I tried zopectl run, but I had to bring down our site to
run
 the script.

 Does anyone update their Zope site using batch scripts without shutting
 down their site?

 Thank you,
 Adriana




_
 Scanned by IBM Email Security Management Services powered by MessageLabs.
For more information please visit http://www.ers.ibm.com


_

 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 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 maillist  -  [EMAIL PROTECTED]
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] Re: Product Testing

2004-06-07 Thread sureshvv
Go to the Control Panel and click on your broken Product. You will see a
traceback.


Marshall Powers [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I'm somewhat new to zope in general, and I've been having some trouble
 developing products. Im running 2.7 on WinXP as a windows service. My
 biggest problem is with debugging my products. Right now, the only
 feedback I get is whether or not the zope service starts successfully.
 It would really help if I could get some error message as to what part
 of my product zope choked on. Any Ideas?


 Thank You,
 Marshall

 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 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 maillist  -  [EMAIL PROTECTED]
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] Re: How to create a product with all_meta_types and the

2004-03-23 Thread sureshvv
Maybe you can use the:

invokeFactory(id=xx, type=xx) method.

Garito [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi Max
 I understand what you explain but what about if I install a new product?
 Rewrite the factory?
 I think is not a good solution don't you think?

 Thanks!!

 - Original Message - 
 From: Max M [EMAIL PROTECTED]
 To: Garito [EMAIL PROTECTED]
 Cc: Lista Oficial de Zope [EMAIL PROTECTED]
 Sent: Friday, March 12, 2004 10:34 AM
 Subject: Re: [Zope-dev] How to create a product with all_meta_types and
the


  Garito wrote:
 
   Hi Chris!
  
   Want I want exactly is to create a product's object by his name
   programmatically not by the construction form
   Is this posible?
 
 
  You cannot know the name of the constructor function, unless you read
  the source.
 
  The constructors added to Zope during the product initialisation can be
  both forms and actual function methods. There is no way of knowing
  which. And there can be more than two.
 
  So you would need to write a factory function based on the info you can
  get from the source. Ie. in an external method. Something like::
 
 
  def portal_factory(self, parent, portal_type, id='', title='',):
 
   Adds the content. A factory function.
 
   # generate a general id
   if id == '':
   id = self.ZopeTime().strftime(portal_type + '_%Y%m%d_%H%M%S')
 
   zope_factory = parent.manage_addProduct
 
   # add the content
   if 'Document' == portal_type:
   zope_factory['Document'].manage_addDocumentAction(id)
 
   elif 'Some Type' == portal_type:
   zope_factory['Some Type'].manage_addSomeTypeAction(id)
 
   else:
   raise 'Error adding portal_type'
 
   # get the newly added content
   obj = getattr(parent, id)
   # Add the title
   obj.title = title
 
   return obj
 
 
  -- 
 
  hilsen/regards Max M, Denmark
 
  http://www.mxm.dk/
  IT's Mad Science
 


 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 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 maillist  -  [EMAIL PROTECTED]
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 )