Re: [Zope-dev] Re: self = self.this() in Factory Methods [Was: Dynpersist.so and makefile.pre.in]

2002-02-02 Thread Florent Guillaume

Andrew Kenneth Milton  [EMAIL PROTECTED] wrote:
 If someone gives me a sane reason why this isn't correct and that calling
 self = self.this() in every product constructor is actually the correct 
 behaviour I'll put it in (as opposed to catering for lazy ZClass 
 programmers d8) Not that this seems to be in very many constructors for
 Zope stuff or other products I have installed.
 
 Since it seems this is going to occur repeatedly, having spent 10 seconds
 looking at it, it seems that the 'correct' way is to call
 
 self.Destination()._setObject()
 
 so in essence self.Destination().__allow_groups__ will also get what we
 want. 
 
 This is actually documented (although it's not clear what versions of Zope
 this will work with, or whether this will do the same thing as 
 self._setObject(), it's late, I've had no sleep, I'll look later, or someone
 who actually knows can fill in the blanks for us, but, I think it's 2.4 only)

Yes, here is the idiom I now use everywhere, according to what I read
in the code and documentation:

def addFoo(dispatcher, id, REQUEST=None, **kw):
 Adds a Foo. 
ob = Foo(id)
container = dispatcher.Destination()
container._setObject(id, ob)
if REQUEST is not None:
dispatcher.manage_main(dispatcher, REQUEST)

In any case calling the first argument self is really overloading
the meaning of the word, as we are nowhere near a method here.


Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 10  http://nuxeo.com  mailto:[EMAIL PROTECTED]

___
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] dynamically using inheritance

2002-02-02 Thread Ed Colmar


Hey all. 

I'm working ona little skinning implementation where I want to pull a 
folder name out of a database, then navigate to it to get dtml methods.

Hardcoding it is easy, but how exactly would I insert a variable into this 
simple dtml-with?

dtml-with skins.default
dtml-var standard_skin_appearance
/dtml-with

to get an idea of how the site is layed out, here's where the skins 
and inside data would live:

www.mysite.com:8080/skins/default/standard_skin_appearance

I tried variations on:

dtml-call REQUEST.set('skinname', 'skins.default')
dtml-with _.string(skinname)

with no luck...  

In the docs, I'm seeingt that it shoulod be possible with the right 
syntax.  What would that be?

Thanks so much!

-ed-


___
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 )