[PEAK] A question re peak.storage.xmi

Phillip J. Eby pje at telecommunity.com
Tue Sep 28 00:29:10 EDT 2004


At 12:10 AM 9/28/04 -0400, Stephen Waterbury wrote:
>Any hints on what might be the problem in the session below?
>Using the latest cvs version of PEAK:
>
>Python 2.3.3 (#1, Dec 21 2003, 00:52:10) [GCC 3.2.2 20030222 (Red Hat 
>Linux 3.2.2-5)] on linux2
>Type "help", "copyright", "credits" or "license" for more information.
>>>>from peak.api import storage
>>>>dm = storage.xmi.fromFile('pgefenterprise.xmi', None)

You need a parent component (such as 'config.makeRoot()'); None isn't 
useful here.

See 'peak help config.makeRoot' for info on config.makeRoot.

Your next likely hurdle will be that you need to be in a 
transaction.  Here's a simple script for starters:

from peak.api import *
root = config.makeRoot()
storage.beginTransaction(root)
items = storage.xmi.fromFile('pgefenterprise.xmi', root)
print items
storage.abortTransaction(root)

'items' will be a sequence of the serialized roots of the XMI document in 
question.




More information about the PEAK mailing list