[Zope] RE[3]: [Zope] Product inheritance question. ==> Pb. moving class from a product to another + etc.s from a product to another + etc.

2000-08-30 Thread NABETH Thierry
Title: RE[3]: [Zope] Product inheritance question.  ==>  Pb. moving class from a product to another + etc.





Hello,


>> If it is a class method, it must be inherited by any derived
class.


This is what I had done.



However, I had the time finally to conduce the following tests.
 - create a Product P1 
  (Note: I used the word "package" instead of Product in my previous postings)
 - create a Class A in P1
 - create a method z in the Class A
 - create a Product P2
 - create a Class AA that inherits A in product P2.
 - create an object 'o' instance of Class AA.
 - make the test of calling the method z on 'o'.


Results: everything works fine !!
So everything seems to work correctly with the new version.


However, when I try to do the same (create a method z and test) for Packages
that I had created in the previous version of Zope, it just does not work !!
(I have imported in the new version the class I had created in the previous
version).


I believe that this had to do with the trick I used to split and existing Product
in several Products: Since I could not move a class directly from a package to another,
I created 2 copies of the same packages. I deleted from the first package the class I wanted
to move. From the second package, I deleted the classes I didn't want to move.
The result was 2 packages with each the correct set of classes.
The problem is that this seems to have generated some kind of inconsistancy,
in particular related to the namespace: the second package do not have access to
the namespace of the first package.


I know this was a relatively ugly way to proceed, but I found at that having
a zillion of classes in a same package was even more ugly, and I needed to reduce
this complexity by introducing more modularity.


Of course, at the beginning I couldn't predict which Products and which classes
 would exist and I decided to start with one package and split it later.
If you had nor noticed I used some kind of incremental/prototypical/evolutionary/blablabla
methodology.


Unfortunatly, not being able -- to move classes from one product to another -- makes
the use of this methodology problematic :-(.


Another similar problem is that you can not modify a posteriori the inheritance tree.
(for instance when you decompose a class into 2 subclasses that inherit from one another).



To conclude, I find Zope to be a very interesting systems (because it is dynamic,
object-oriented, integrate seamlessly an OO database, etc.).
However, it would be an even better system if it provided more flexibility to
reengineer an architecture. (very important when you use a prototypical approach).


Or perhaps, there is something I have not understood ?


Thierry Nabeth
Research Fellow
INSEAD CALT (the Centre for Advanced Learning Technologies)
http://www.insead.fr/CALT/



-Original Message-
From: Dieter Maurer [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 21, 2000 10:47 PM
To: [EMAIL PROTECTED]
Subject: Re: RE[2]: [Zope] Product inheritance question (similar
question)



NABETH Thierry writes:
 > What I will have to do:
 > - create a Package (Zope product).
 > - create a class in this package, and a method (my_method)
This should be a method of the class,
not a method in the packages.


If it is a class method, it must be inherited by any derived
class.


Dieter



-Original Message-
From: NABETH Thierry 
Sent: Friday, August 18, 2000 9:29 AM
To: '[EMAIL PROTECTED]'
Subject: RE: [Zope] Product inhetitance question (similar question)



And what happen if the Class A is in a package PA.
Clabb B is in a package PB.


How do you access the namespace of PA from PB ?


When I have tried, the inherited methods from A where not visible
from B, and I and to recreate a copie of the method.
(which is ugly !!!).


Any suggestion ?


Thierry Nabeth
Research Fellow
INSEAD CALT (the Centre for Advanced Learning Technologies)
http://www.insead.fr/CALT/





[Zope] RE[2]: [Zope] Product inheritance question (similar question)

2000-08-21 Thread NABETH Thierry
Title: RE[2]: [Zope] Product inheritance question (similar question)






>> from PA import A, . 


I am only using dtml and not writing directly python code !
So I do not believe this is possible.


>> Almost unbelievable.


But true.
But I will have again to do some test. 
(I do not have the time right now, and I did most of my
test with the previous version of Zope)


What I will have to do:
- create a Package (Zope product).
- create a class in this package, and a method (my_method)
- create another package.
- create a class in this package that inherits the class of the other package.


- check that the method my_method is visible from within the second package.


Thierry Nabeth
Research Fellow
INSEAD CALT (the Centre for Advanced Learning Technologies)
http://www.insead.fr/CALT/




-Original Message-
From: Dieter Maurer [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 18, 2000 9:49 PM
To: NABETH Thierry
Cc: '[EMAIL PROTECTED]'
Subject: RE: [Zope] Product inhetitance question (similar question)



NABETH Thierry writes:
 > And what happen if the Class A is in a package PA.
 > Clabb B is in a package PB.
 > 
 > How do you access the namespace of PA from PB ?
from PA import A, . 


class B(A): 


 > When I have tried, the inherited methods from A where not visible
 > from B, and I and to recreate a copie of the method.
 > (which is ugly !!!).
Almost unbelievable.



Dieter





RE: [Zope] Product inhetitance question (similar question)

2000-08-18 Thread NABETH Thierry
Title: RE: [Zope] Product inhetitance question (similar question)







And what happen if the Class A is in a package PA.
Clabb B is in a package PB.


How do you access the namespace of PA from PB ?


When I have tried, the inherited methods from A where not visible
from B, and I and to recreate a copie of the method.
(which is ugly !!!).


Any suggestion ?


Thierry Nabeth
Research Fellow
INSEAD CALT (the Centre for Advanced Learning Technologies)
http://www.insead.fr/CALT/



--
From: "Andy McKay" <[EMAIL PROTECTED]>
To: "Daniel Rusch" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
Subject: Re: [Zope] Product inhetitance question
Date: Thu, 17 Aug 2000 08:54:49 -0700
charset="iso-8859-1"


> Say I have a fully functional (and more importantly, working) Product
> will call A.
>
> I want to extend this Product's capabilities so I wish to derive another
> class from it, call it B.
>
> No problem,
>
> class B(A):
> .
>
>
> The question is, (I think the answer is no) is there a way to inherit
> (i.e. reuse common code and extend it) the manage_Add function and the
> dtml files from A???


Well by inheritance B has all the methods, properties etc you have in A. So
the answer is yes, if A has the foobar method then B will have a foobar
method.


Or do I misunderstand your question?
--
 Andy McKay, Developer, ActiveState
 http://www.ActiveState.com
 Programming for the People


--





[Zope] Accessing the namespace of another Product/Package ? (pb when the superclass belong to another package)e superclass belong to another package)

2000-07-11 Thread NABETH Thierry
Title: Accessing the namespace of another Product/Package ?  (pb when the superclass belong to another package)





Hello,


In order to have a system more modular, I have split a package (product)
into several other product.


In particular, I have a package (BaseClassesPackage) that define some kind of abstract classes,
and other (more application specific) packages (Package1, Package2), that define some class
that inherit some class defined in the BaseClassesPackage.


BaseClassesPackage  (Product)
   MyFolderClass


Package1
   MyClass1 (inherits MyFolderClass)


Package2
   MyClass2 (inherits MyFolderClass)



The problem is that the namespace of BaseClassesPackage is not visible
from the packages Package1 and Package2.


Any idea to fixe this ?


More generaly, do you know about any approaches / guidelines to make an application
more modular (defined in several packages that use one another)?
Does Zope 2.2 address this issue at some point ?





I have already tried to look at the code without any success.


For instance there are somewhere a few functions that can be relevant
(open somewhat the namespace):



  # namespace of the package anotherPackage is available for object creation





  # the namespace of the package where the class of the object REQUEST.script + PointerToIUD
  # is define is available.


   (the object does not exist)



There are a few (python) function that seem to have something to do with namespace and acquisition,
but it is not very clear for me how they have to be used. (in particular from within a dtml method).
aq_acquire(), DT_Util.namespace(), ...


Thanks


Thierry Nabeth
Research Fellow
INSEAD CALT (the Centre for Advanced Learning Technologies)
http://www.insead.fr/CALT/














RE: [Zope] geting the type of an object from within dtml ??? ==> it works

2000-06-26 Thread NABETH Thierry
Title: RE: [Zope] geting the type of an object from within dtml ??? ==> it works





Hello,


>>  works.


Yes, it display the correct meta type. Thanks.


When I had done some tests, I forgot to set the meta_type field,
and the system was displaying the meta type of the superclass instead.
(which had confused me).


Note:
I am still not very confortable to use the "meta_type" field to get the class name,
and would rather have prefered to have the real class itself. (python type function).




Thank you again for your help.


Thierry


Thierry Nabeth
Research Fellow
INSEAD CALT (the Centre for Advanced Learning Technologies)
http://www.insead.fr/CALT/



-Original Message-
From: ethan mindlace fremen [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 26, 2000 3:43 AM
To: Thierry Nabeth
Cc: [EMAIL PROTECTED]
Subject: Re: [Zope] geting the type of an object from within dtml ???



Thierry Nabeth wrote:


> for instance:
> 
> does not return the correct type.


 works.  You can also use things like



hope that helps,
-- 
ethan mindlace fremen
Zopatista Community Liason





RE: [Zope] getting the type of an object from within dtml ???

2000-06-26 Thread NABETH Thierry
Title: RE: [Zope] getting the type of an object from within dtml ???





Hello,


>> would you please elaborate what are you trying to determine the type of?


Sorry for my lack of clarity.


I would like to get the class of the object, just using dtml. (and without using external method)


Typically, the idea would be to define a dtml method (for instance getclass) that return the class
of the object, so that I could write:


--- in a dtml-method defined for a Class A, and that can be called from instance
of class A or subclasses of A.
...
My class is :
...



>> Zope namespace ... eventually the namespace will be explained and
documented better.


I believe this is not a matter of documentation.
It is just that is is uselessly too complicate.


Note:
I very much like some of the ideas behind Zope. (such as the good integration
of an OO database in the system, use of a dynamic language, etc.)
But I can really not get used to some of the other aspects that are very well
addressed by other systems, but are so poorly addressed by Zope such as:
  * the namespace.
  * bad integration with python.
  * can not change the inheritance tree once a class has been created.
    (I have tried one of the trick that was posted somewhere, but it does not work 100%).
  * very bad support for pointers (object1 --> object2).


Thierry


Thierry Nabeth
Research Fellow
INSEAD CALT (the Centre for Advanced Learning Technologies)
http://www.insead.fr/CALT/



-Original Message-
From: alan runyan [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 26, 2000 5:36 AM
To: Thierry Nabeth; [EMAIL PROTECTED]
Subject: Re: [Zope] geting the type of an object from within dtml ???



> I have unsuccessifully been trying to figure out ou to get the type of an
> object
> from withing html.


are you talking about a ZOPE object? remember if you are a DTML Method your
'meta_type' will return the container object (it doenst have its own
namespace)


you could try

  



> Python is supposed to have a function type(object) that return the type,
> but I was not able to find a way to call it. (and I would rather prefere
not
> to have
> to define an external function.).


would you please elaborate what are you trying to determine the type of?


> My problem seems to have to do with the Zope namespace (which model I
> believe is
> a real pain in the ass :-).


I agree.  _[_['blah']] is probably the nastiest thing I've ever seen.  and
then someone will start adding lambdas to it and it will be all crap to
maintain from there... :(  eventually the namespace will be explained and
documented better, this is mainly a python/ZOPE framework idea that needs to
be experienced.  I still dont 100% get it.  I can usually make things work,
but sometimes I just dont quite 'get it'.


>
> Any suggestion, ideas ?


be abit more specific, you using python methods,. external methods, or
trying to do this from within DTML?


~runyaga





RE: [Zope] Pointers in zope ??? object1 --> object2 ==> "REQUEST.resolve_url('my_url')"

2000-06-21 Thread NABETH Thierry
Title: RE: [Zope] Pointers in zope ???  object1 --> object2   ==>  "REQUEST.resolve_url('my_url')"





Thank you David,


I really would have had difficulties finding it myself.




http://zope-server/path to the object')">
  


  Error in resolve_url: unable to get the object from the url.
  does the url matches the REQUEST.script:  ?






Note:
In the resolve url, you have to be carefull that
zope-server is exactly the same as the machine name.
More specifically zope-server has to be the same as REQUEST.script
or it will generate an error.



Thierry Nabeth
Research Fellow
INSEAD CALT (the Centre for Advanced Learning Technologies)
http://www.insead.fr/CALT/



-Original Message-
From: R. David Murray [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 20, 2000 9:22 PM
To: NABETH Thierry
Subject: RE: [Zope] Pointers in zope ??? object1 --> object2



On Tue, 20 Jun 2000, NABETH Thierry wrote:
> Please, let me know if you remember of anything that could help me
> to identify the way to get the object from an url.


Looks like it's 'REQUEST.resolve_url()'.


--RDM





[Zope] Pointers in zope ??? object1 --> object2

2000-06-20 Thread NABETH Thierry
Title: Pointers in zope ???  object1 --> object2





Hello,


I am trying to figure out how I can find a way to implement pointers in Zope.
In other words, I would like to be able that the content of an attribute reference another object.
 object1 --> object2
and say for instance: object1.aaa := object2
and then get this object with object1.aaa 



I have spent a lot of time, looking for instance how the name space work.


I had thought for instance that I would create a string field in which I would store
the id of the other object. But the problem, is that I do know how to get
the object from this id in the system, unless it belongs to the same namespace.


I had also thought that I could store in this field, the url of the object.
From this url, I would then be able to get the object.
(since you can call an kind of method by  /)
But it didn't work.
For instance
>
   

raise an error.




eventually, you can imagine that you can access an object specified in a absulute way
by using plenty of dtml-with.
for instance for accessing the /root/b/c/d/e object, we would use

  
    
  
  
   
    
 
   



But really this is too complicate, and really can not be implemented.



Do you know an answer to this question.
I can not believe that this is not possible, given the OO approach of zope, and the fact that it relies on python.



Thanks,


Thierry Nabeth
Research Fellow
INSEAD CALT (the Centre for Advanced Learning Technologies)