Re: [Zope-dev] wrapping unexistent objects

2002-12-03 Thread Maurizio Boriani
 Casey == Casey Duncan [EMAIL PROTECTED] writes:

Casey If you want an object to be able to handle calls to
Casey undefined methods, you'll probably need to use a
Casey __getattr__ hook. They can be a little tricky to get right
Casey (you want to filter out names that start with _ or aq
Casey or else you'll be in trouble), and they don't have access
Casey to acquisition, but they will allow you to intercept calls
Casey to arbitrary names on an object.

have you some examples or docs about this? I'm tring using it but my product
felt in an unfinisched loop. Any suggestion

Casey -Casey

TIA,
baux

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



Re: [Zope-dev] wrapping unexistent objects

2002-12-03 Thread Maurizio Boriani
 Casey == Casey Duncan [EMAIL PROTECTED] writes:

Casey Its easy to create an infinite loop. To avoid these, do
Casey attribute lookups from the instance __dict__ rather than
Casey directly from self:

Casey IOW, don't do:

Casey foo = self.foo

Casey or getattr(self, 'foo')

Casey (This can trigger another __getattr__ call)

Casey Instead do:

Casey foo = self.__dict__['foo']

in my case foo is a method not a properties

Casey (This won't cause another getattr call)

Casey As for examples, there is a complex one in the CMF
Casey Skinnable module and a simpler one in the Document module
Casey of my DocumentLibrary product.

I tried this too but zope return an error ('Type Error, unsubscriptable object').

Exactly this is my case:

I've a class called, for example, pippo. This cotain another class called pluto.

So wath I'd like to do is:
dtml-with pippo
  dtml-with pluto
dtml-var expr=ciccio('parameter')
  /dtml-with
/dtml-with

the expr or method ciccio doesn't exist in pluto but I'd like to pass to a defined 
method the expr and its parameters.

A big thanks anymore for your help

bye,
baux 


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



Re: [Zope-dev] wrapping unexistent objects

2002-12-03 Thread Maurizio Boriani
 Casey == Casey Duncan [EMAIL PROTECTED] writes:

Casey Can you just use acquisition?

But how could I without knowing wich method will be call? 


-- 
Maurizio Boriani -- Debian Developer
E-mail address: [EMAIL PROTECTED]
GPG key: 0xCC0FBF8F
fingerprint = E429 A37C 5259 763C 9DEE  FC8B 5D61 C796 CC0F BF8F = fingerprint

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



[Zope-dev] wrapping unexistent objects

2002-12-02 Thread Maurizio Boriani

Hi all,
I've a little bit tricky problem:
How could I wrap a request of an inexistent object and handle request
in a transparent way using a defined method? I've searched about
 __before_publishing_traverse__ and __bobo_traverse__ but them are too few 
documented (or I didn't understand them).

Better explain:
I'd like to build a generic product which permit to call undefined 
function with parameters using dtml as any other python script but this
functions aren't define and will be handled by product.

Does anyone has some suggestion/Doc about this?

TIA,
baux


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



[Zope-dev] Re: wrapping unexistent objects

2002-12-02 Thread Maurizio Boriani
 Casey == Casey [EMAIL PROTECTED] writes:

 Casey If you want an object to be able to handle calls to undefined methods,
 Casey you'll=20 probably need to use a __getattr__ hook. They can be a 
 Casey little tricky to get20 right (you want to filter out names that start 
 Casey with _ or aq or else=20 you'll be in trouble), and they don't have
 Casey access to acquisition, but they=20
 Casey will allow you to intercept calls to arbitrary names on an object.

 Casey __bobo_traverse__ and __before_publishing_traverse__ are hooks for 
 Casey URL traversal inside ZPublisher. They won't work for calls made 
 Casey inside DTML.

Thanks very much! Have you also some docs to point me to? Or a dummy example?

Thanks anymore,
baux

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