[Zope] Bug Export Product and inheritance (2). Any more description about XML export format?

2001-01-21 Thread Thierry Nabeth

Hello,

I am still struggling to find a way to solve the bug (even manualy)
relate to exporting a package in which a class inherits from a class
of another package.

Do you have any more details about the Import XML format ?
I want to see if I can edit manually this file in order to solve
the fact that I lost inheritance from one class to another class
that is defined in another package.




For instance in the file
.../OFS/XMLExportImport.py

we have:

def save_record(parser, tag, data):
file=parser.file
write=file.write
pos=file.tell()
file.seek(pos)
a=data[1]
if a.has_key('id'): oid=a['id']
oid=ppml.p64(string.atoi(oid))
v=''
for x in data[2:]:
v=v+x
l=ppml.p64(len(v))
v=oid+l+v
return v

def importXML(jar, file, clue=''):
import Shared.DC.xml.pyexpat.pyexpat
pyexpat=Shared.DC.xml.pyexpat.pyexpat
if type(file) is StringType:
file=open(file)
outfile=TemporaryFile()
data=file.read()
F=ppml.xmlPickler()
F.end_handlers['record'] = save_record
F.end_handlers['ZopeData'] = save_zopedata
F.start_handlers['ZopeData'] = start_zopedata
F.binary=1
F.file=outfile
p=pyexpat.ParserCreate()
p.CharacterDataHandler=F.handle_data
p.StartElementHandler=F.unknown_starttag
p.EndElementHandler=F.unknown_endtag
r=p.Parse(data)
outfile.seek(0)
return jar.importFile(outfile,clue)


Would it be possible to have a couple of lines of comments ?

Thank you


Thierry Nabeth
INSEAD CALT
http://www.insead.edu/CALT/



Note:
This BUG makes almost impossible all serious reuse of package
in Zope. (if you want to use inheritance, since you can not
get newer version of the package you reuse).
I am very surprised that nobody did not give any comment to my previous
message !!!


___
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] Serious BUG in Export. == pb of lost inheritance if export / reimport.

2001-01-06 Thread Thierry Nabeth

Hello,

I would like to mention a very serious bug (for me), that prevent to use
inheritance between two classes defined in two different package, if
you have to export and reimport those packages.

In a previous mail I mentionned a problem of Inheritance lost between
packages.

I spent a lot of time investigating the problem, and in particular looking
in the
export file (xml version).

First here is the test:

Phase 1: create the products and the classes.

Create a product PA
Create a class A in the product PA.
Create a method "test" in class A.  (this method display "before").

Create a product PB
Create a class B in the product PB which inherits from A.

Create an instance a of A.
Create an instance b of B.

Phase 2: test the inheritance.  == everything works fine

Executing the method "test" on those two instances return.
a.test  == "before"
b.test  == "before"
The result is correct.

Phase 3: export / reimport product PB, and modify methode "test".

Export the product PB. (PB.zexp is generated)
Delete the product PB and restart zope.
Import the product PB (PB.zexp) and restart zope.

Modify the method "test" in class A..  (this method display "after").

Phase 4: test the inheritance.  == B does not work correctly.

Executing the method "test" on those two instances return.
a.test  == "after"
b.test  == "before"  ### this is incorect. !!


I spent a lot of time investing this problem, in particular looking
in the xml export file.
The problem is that when you export PB, the exported file also
contain the definition of class A.
When you re-import PB, B inherits from a class A that is different
from the class A that is in the product PA.
You have a kind of Zombie class A.
(note: reimporting class A doesn't solve the problem).

If someone has some idea how to fix this bug which almost forbid
the use of inheritance between products in zope (unless you have a
master server that never import anything) ?!

Thierry Nabeth
Research Fellow,
INSEAD CALT (The Centre for Advanced Learning Technologies)
http://www.insead.edu/CALT/
[EMAIL PROTECTED]


___
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] Pb. of Inheritance lost between packages. (after too manyexport/imports ?)export/imports ?)

2001-01-05 Thread Thierry Nabeth

Hello,

Here is this problem again that has reappeared  
I already posted about this problem some months ago,
but did not manage to make it work, and I had to rewrite
all the class from scratch.
(of course, I did a lot of cut and past, but you
have to do a lot of manual work recreating the
Properties, and you loose all the instance you had created).

Here is my problem: 

I have 3 Products PA PB PC
and I have the 3 classes A, B and C defined in each of the
different Products.

PA has class A
PB has class B
PC has class C.

Besides, the inheritence tree is the following:

A -- B  -- C.
(A inherits from B, etc.)

The problem is that after some time (after many export and re-import of
Products),
the inheritance does not work anymore between the package.

For instance if I define a new method in class A,
it is invisible from class B.
Or if I redefine a method in a Class A, the class B still 
see the old method of class B.

Note that at the beginning, when you create those three packages
and classes, everything seems to work fine.
(I have done the test).

Did someone already encountered a similar problems ?
Do someone has an idea what could be wrong, and has some idea about
how to fix the problem ? 
(my guess is that something wrong happens after too many
export and imports which confuses python).

Thierry Nabeth
Research Fellow,
INSEAD CALT (The Centre for Advanced Learning Technologies)
http://www.insead.edu/CALT/
[EMAIL PROTECTED]

___
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] geting the type of an object from within dtml ???

2000-06-25 Thread Thierry Nabeth

Hello,

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

for instance:
dtml-var meta_type
does not return the correct type.

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

Any suggestion, ideas ?

Thanks

Thierry Nabeth,
INSEAD CALT
http://www.insead.fr/CALT/


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