[Zope-dev] Question about import code

Shane Hathaway shane@digicool.com
Thu, 10 May 2001 13:21:00 -0400


Fred Wilson Horch wrote:
> You wrote:
> >
> > Importing multiple objects simultaneously could result in a fair amount
> > of confusion...
> 
> Can you elaborate?  When you import a folder, for example, it imports
> the folder and all objects in it.

If there are some objects in the folder that have conflicting names and
others that don't, what do you do?  Also, if you're thinking about
providing this functionality, what about spanning multiple folders? What
if some folders already exist?

The capability could change user expectations, you see, and you may need
to deal with them.  But that's just advice and you can freely ignore it.
:-)

> Thanks for the heads up.  When you say "subtransaction", a
> subtransaction of what?  I'm familiar with subtransactions being atomic
> parts of a larger transaction.  I'm not sure what this larger
> transaction would be in this case.  If I start an import, does that
> start a transaction with each object's import being a subtransaction of
> the whole thing?

That's right.

> Is there any documentation on how to export from and import to the ZODB?

Perhaps.  Look at the interfaces Wiki.

> The code I'm wading through has a lot of extraneous stuff thrown in.
> I'd like to be able to just try exporting and importing objects from a
> simple Python script so I understand what's going on.

An external method could do it.  Look at what _getCopy() does in
OFS/CopySupport.py.

Shane